Skip to content

Commit

Permalink
feat: Add custom classname for icon and trailing icon
Browse files Browse the repository at this point in the history
  • Loading branch information
dexterca committed Oct 18, 2023
1 parent fa39849 commit ec60fdb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ export interface ListItemProps extends React.ComponentPropsWithoutRef<'li'> {
children?: React.ReactNode;
disabled?: boolean;
icon?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
iconClassName?: string;
onClick?: any;
secondaryText?: string;
text?: string;
trailingIcon?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
trailingIconClassName?: string;
}

export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
Expand All @@ -95,10 +97,12 @@ export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
children,
disabled,
icon: Icon,
iconClassName,
onClick,
secondaryText,
text,
trailingIcon: TrailingIcon,
trailingIconClassName,
...rootProps
},
ref
Expand All @@ -121,7 +125,7 @@ export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
<Icon
role="img"
aria-hidden
className={classes.icon}
className={clsx(classes.icon, iconClassName)}
width={18}
height={18}
/>
Expand All @@ -146,7 +150,11 @@ export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
<TrailingIcon
role="img"
aria-hidden
className={clsx(classes.icon, classes.trailingIcon)}
className={clsx(
classes.icon,
classes.trailingIcon,
trailingIconClassName
)}
width={18}
height={18}
/>
Expand Down

0 comments on commit ec60fdb

Please sign in to comment.