Skip to content

Commit

Permalink
fix: Allow inheriting of colors in system icon
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel.carrera committed Sep 18, 2024
1 parent 20e2b89 commit 2279926
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions modules/react/icon/lib/SystemIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {CSSObject} from '@emotion/styled';
import {Icon, IconProps} from './Icon';
import {createComponent, getColor} from '@workday/canvas-kit-react/common';
import {SystemPropValues} from '@workday/canvas-kit-react/layout';
import {cssVar} from '@workday/canvas-kit-styling';

export interface SystemIconStyles {
/**
Expand Down Expand Up @@ -61,30 +62,30 @@ export interface SystemIconProps
export const systemIconStyles = ({
accent,
accentHover,
background = 'transparent',
backgroundHover = 'transparent',
color = iconColors.standard,
background = '',
backgroundHover = '',
color = '',
colorHover = iconColors.hover,
fill,
fillHover,
}: SystemIconStyles): CSSObject => ({
'& .wd-icon-fill': {
fill: getColor(fill) || getColor(color),
fill: getColor(fill) || getColor(cssVar(color, iconColors.standard)),
},
':hover .wd-icon-fill': {
fill: getColor(fillHover) || getColor(colorHover),
},
'& .wd-icon-accent, & .wd-icon-accent2': {
fill: getColor(accent) || getColor(color),
fill: getColor(accent) || getColor(cssVar(color, iconColors.standard)),
},
':hover .wd-icon-accent, :hover .wd-icon-accent2': {
fill: getColor(accentHover) || getColor(colorHover),
},
'& .wd-icon-background': {
fill: getColor(background),
fill: getColor(cssVar(background, 'transparent')),
},
':hover .wd-icon-background': {
fill: getColor(backgroundHover),
fill: getColor(cssVar(backgroundHover, 'transparent')),
},
});

Expand Down

0 comments on commit 2279926

Please sign in to comment.