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: add iconColor prop to ListItemNav #128

Merged
merged 3 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions example/src/pages/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ const renderListItemNav = () => (
}}
accessibilityLabel="Empty just for testing purposes"
/>
<ListItemNav
value={"Value"}
description="Description"
icon="productPagoPA"
iconColor="blueIO-500"
onPress={() => {
alert("Action triggered");
}}
accessibilityLabel="Empty just for testing purposes"
/>
<ListItemNav
value={"Value"}
description="This is a list item nav with a payment logo"
Expand Down
17 changes: 10 additions & 7 deletions src/components/listitems/ListItemNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import {
import { makeFontStyleObject } from "../../utils/fonts";
import { WithTestID } from "../../utils/types";
import { IOIcons, Icon } from "../icons";
import { Body, H6, LabelSmall } from "../typography";
import { IOLogoPaymentType, LogoPayment } from "../logos";
import { Body, H6, LabelSmall } from "../typography";

// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
const legacyStyles = StyleSheet.create({
Expand All @@ -51,9 +51,9 @@ type ListItemNavPartialProps = WithTestID<{
}>;

export type ListItemNavGraphicProps =
| { icon?: never; paymentLogo: IOLogoPaymentType }
| { icon: IOIcons; paymentLogo?: never }
| { icon?: never; paymentLogo?: never };
| { icon?: never; iconColor?: never; paymentLogo: IOLogoPaymentType }
| { icon: IOIcons; iconColor?: IOColors; paymentLogo?: never }
| { icon?: never; iconColor?: never; paymentLogo?: never };

export type ListItemNav = ListItemNavPartialProps & ListItemNavGraphicProps;

Expand All @@ -62,6 +62,7 @@ export const ListItemNav = ({
description,
onPress,
icon,
iconColor = "grey-450",
paymentLogo,
accessibilityLabel,
testID
Expand Down Expand Up @@ -108,7 +109,9 @@ export const ListItemNav = ({
pressed: IOColors[theme["listItem-pressed"]]
};

const iconColor = isExperimental ? theme["interactiveElem-default"] : "blue";
const navIconColor = isExperimental
? theme["interactiveElem-default"]
: "blue";

// Scaling transformation applied when the button is pressed
const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
Expand Down Expand Up @@ -172,7 +175,7 @@ export const ListItemNav = ({
<View style={{ marginRight: IOListItemVisualParams.iconMargin }}>
<Icon
name={icon}
color="grey-450"
color={iconColor}
size={IOListItemVisualParams.iconSize}
/>
</View>
Expand All @@ -189,7 +192,7 @@ export const ListItemNav = ({
<View style={{ marginLeft: IOListItemVisualParams.iconMargin }}>
<Icon
name="chevronRightListItem"
color={iconColor}
color={navIconColor}
size={IOListItemVisualParams.chevronSize}
/>
</View>
Expand Down