-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Carta Giovani Nazionale): [#178127305] Adds Department name and…
… Eyca Logo on card component (#3042) * [#178127305] Adds Department name and Eyca Logo on card component * [#178127305] Fixes failing tests * [#178127305] Changes blobs color and opacity Co-authored-by: Matteo Boschi <[email protected]>
- Loading branch information
1 parent
9a2e3ed
commit c8c9267
Showing
9 changed files
with
97 additions
and
57 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
ts/features/bonus/cgn/components/detail/DepartmentLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from "react"; | ||
import { Text } from "react-native"; | ||
import { | ||
IOFontFamily, | ||
IOFontWeight | ||
} from "../../../../../components/core/fonts"; | ||
import { IOColorType } from "../../../../../components/core/variables/IOColors"; | ||
import { typographyFactory } from "../../../../../components/core/typography/Factory"; | ||
|
||
type AllowedWeight = Extract<IOFontWeight, "Regular">; | ||
|
||
type AllowedColors = Extract<IOColorType, "black">; | ||
|
||
const fontName: IOFontFamily = "TitilliumWeb"; | ||
const fontSize = 12; | ||
|
||
type DepartmentLabelProps = Omit< | ||
React.ComponentPropsWithRef<typeof Text>, | ||
"style" | ||
>; | ||
|
||
// Custom Typography component to show the name of Department on CGN card component | ||
const DepartmentLabel: React.FunctionComponent<DepartmentLabelProps> = props => | ||
typographyFactory<AllowedWeight, AllowedColors>({ | ||
...props, | ||
defaultWeight: "Regular", | ||
defaultColor: "black", | ||
font: fontName, | ||
fontStyle: { fontSize } | ||
}); | ||
|
||
export default DepartmentLabel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
EycaDetailsState, | ||
EycaDetailStatus | ||
} from "../store/reducers/eyca/details"; | ||
import { isLoading, isReady } from "../../bpd/model/RemoteValue"; | ||
|
||
// return true if the EYCA details component can be shown | ||
export const canEycaCardBeShown = (card: EycaDetailsState): boolean => { | ||
if (isLoading(card)) { | ||
return true; | ||
} | ||
const evaluateReady = (status: EycaDetailStatus): boolean => { | ||
switch (status) { | ||
case "FOUND": | ||
case "NOT_FOUND": | ||
case "ERROR": | ||
return true; | ||
case "INELIGIBLE": | ||
return false; | ||
} | ||
}; | ||
if (isReady(card)) { | ||
return evaluateReady(card.value.status); | ||
} | ||
return false; | ||
}; |