Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [IOAPPFD0-167] Add the new LogoPaymentCard component to the Design System #5077

Merged
merged 19 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
afed9b1
Update `io-app-design-system`
dmnplb Oct 5, 2023
38b8fb9
Add `LogoPaymentCard` to `DSLogos` page
dmnplb Oct 5, 2023
bd70993
Update jest snapshots
dmnplb Oct 5, 2023
d1fe74d
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 5, 2023
30ba775
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 5, 2023
33f85f5
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 6, 2023
3674388
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 6, 2023
5c4d1b3
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 6, 2023
e239d6b
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 9, 2023
9ce6d59
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 10, 2023
80ec733
Prettify codebase
dmnplb Oct 10, 2023
23b152c
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 10, 2023
1a81554
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 10, 2023
86fa337
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 10, 2023
7edfc5c
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 13, 2023
e873c78
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 13, 2023
eb7d30d
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 13, 2023
ae5e022
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 16, 2023
dea6415
Merge branch 'master' into IOAPPFD0-167-add-logo-payment-card
dmnplb Oct 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ts/features/design-system/components/DSComponentViewerBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const styles = StyleSheet.create({
componentWrapper: {
marginBottom: 24
},
componentWrapperFullWidth: {
flexGrow: 1
},
lastItem: {
marginBottom: 0
},
Expand All @@ -26,6 +29,7 @@ const styles = StyleSheet.create({
type DSComponentViewerBoxProps = {
name: string;
colorMode?: "dark" | "light";
fullWidth?: boolean;
last?: boolean;
children: React.ReactNode;
};
Expand All @@ -34,12 +38,18 @@ export const DSComponentViewerBox = ({
name,
colorMode = "light",
last = false,
fullWidth = false,
children
}: DSComponentViewerBoxProps) => {
const theme = useIOTheme();

return (
<View style={last ? styles.lastItem : styles.componentWrapper}>
<View
style={[
last ? styles.lastItem : styles.componentWrapper,
fullWidth && styles.componentWrapperFullWidth
]}
>
{children}
<View style={styles.labelWrapper}>
{name && (
Expand Down
25 changes: 23 additions & 2 deletions ts/features/design-system/components/DSLogoPaymentViewerBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,22 @@ const styles = StyleSheet.create({
logoWrapperLarge: {
width: "25%"
},
logoWrapperFull: {
width: "100%"
},
fakeTransparentBg: {
position: "absolute",
width: "275%",
height: "275%",
opacity: 0.4
},
fakeTransparentBgFull: {
position: "absolute",
top: "-25%",
width: "150%",
height: "150%",
opacity: 0.4
},
nameWrapper: {
display: "flex",
flexDirection: "row",
Expand All @@ -45,6 +55,9 @@ const styles = StyleSheet.create({
logoItemLarge: {
aspectRatio: 4 / 3
},
logoItemFull: {
aspectRatio: undefined
},
iconLabel: {
fontSize: 10
}
Expand All @@ -53,7 +66,7 @@ const styles = StyleSheet.create({
type DSLogoPaymentViewerBoxProps = {
name: string;
image: React.ReactNode;
size: "medium" | "large";
size: "medium" | "large" | "full";
};

const sizeMap = {
Expand All @@ -64,6 +77,10 @@ const sizeMap = {
large: {
wrapper: styles.logoWrapperLarge,
item: styles.logoItemLarge
},
full: {
wrapper: styles.logoWrapperFull,
item: styles.logoItemFull
}
};

Expand All @@ -78,7 +95,11 @@ export const DSLogoPaymentViewerBox = ({
<View style={[styles.logoWrapper, sizeMap[size].wrapper]}>
<View style={[styles.logoItem, sizeMap[size].item]}>
<ImageBackground
style={styles.fakeTransparentBg}
style={
size === "full"
? styles.fakeTransparentBgFull
: styles.fakeTransparentBg
}
source={FakeTransparentBg}
/>
{image}
Expand Down
66 changes: 55 additions & 11 deletions ts/features/design-system/core/DSLogos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import {
IOPaymentLogos,
LogoPayment,
LogoPaymentExt,
LogoPaymentCard,
IOPaymentCardLogos,
IOLogoPaymentCardType,
IOColors,
hexToRgba,
Avatar,
IOVisualCostants
} from "@pagopa/io-app-design-system";
Expand Down Expand Up @@ -84,6 +89,17 @@ export const DSLogos = () => {
Banks (Extended)
</H2>
{renderLogoPaymentExtended()}

<VSpacer size={16} />

<H2
color={theme["textHeading-default"]}
weight={"SemiBold"}
style={{ marginBottom: 16 }}
>
Payment Networks (Card)
</H2>
{renderPaymentLogosCard()}
</DesignSystemScreen>
);
};
Expand Down Expand Up @@ -244,17 +260,45 @@ const renderLogoPaymentExtended = () => (
dimensions={{ height: 33, width: 150 }}
/>
</DSComponentViewerBox>
<DSComponentViewerBox name={`LogoPaymentExtended · icon = payPal`}>
<LogoPaymentExtended
icon="payPal"
dimensions={{ height: 33, width: 150 }}
/>
</DSComponentViewerBox>
<DSComponentViewerBox name={`LogoPaymentExtended · icon = bpay`}>
<LogoPaymentExtended
icon="bpay"
dimensions={{ height: 33, width: 220 }}
</>
);

const renderPaymentLogosCard = () => (
<View style={styles.itemsWrapper}>
{Object.entries(IOPaymentCardLogos).map(([logoItemName]) => (
<DSLogoPaymentViewerBox
key={logoItemName}
name={logoItemName}
size="full"
image={
<LogoPaymentCard
align="start"
height={32}
name={logoItemName as IOLogoPaymentCardType}
/>
}
/>
))}
<VSpacer size={24} />
<DSComponentViewerBox
fullWidth
name="Debug mode enabled, possible align values"
>
<View
style={{
borderRadius: 16,
padding: 16,
backgroundColor: IOColors.white,
borderColor: hexToRgba(IOColors.black, 0.15),
borderWidth: 1
}}
>
<LogoPaymentCard debugMode height={32} name="payPal" align="start" />
<VSpacer size={8} />
<LogoPaymentCard debugMode height={32} name="payPal" align="center" />
<VSpacer size={8} />
<LogoPaymentCard debugMode height={32} name="payPal" align="end" />
</View>
</DSComponentViewerBox>
</>
</View>
);