diff --git a/CHANGELOG.md b/CHANGELOG.md index b1187aae05..cc4613501b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixes - Fix build on Windows @jurokapsiar ([#383](https://github.com/stardust-ui/react/pull/383)) - Add warning for rendering components outside provider @Bugaa92 ([#378](https://github.com/stardust-ui/react/pull/378)) +- Fix icon colors for Teams theme @codepretty ([#384](https://github.com/stardust-ui/react/pull/384)) ### Features - Export `mergeThemes` @levithomason ([#285](https://github.com/stardust-ui/react/pull/285)) diff --git a/docs/src/examples/components/Icon/States/IconExampleDisabled.shorthand.tsx b/docs/src/examples/components/Icon/States/IconExampleDisabled.shorthand.tsx index 587fee7e9e..395d07095f 100644 --- a/docs/src/examples/components/Icon/States/IconExampleDisabled.shorthand.tsx +++ b/docs/src/examples/components/Icon/States/IconExampleDisabled.shorthand.tsx @@ -4,9 +4,6 @@ import { Icon } from '@stardust-ui/react' const IconExampleDisabled = () => (
- - -
) diff --git a/docs/src/examples/components/Icon/Variations/IconExampleColor.shorthand.tsx b/docs/src/examples/components/Icon/Variations/IconExampleColor.shorthand.tsx new file mode 100644 index 0000000000..231e3bb8ae --- /dev/null +++ b/docs/src/examples/components/Icon/Variations/IconExampleColor.shorthand.tsx @@ -0,0 +1,13 @@ +import React from 'react' +import { Icon } from '@stardust-ui/react' + +const IconExampleColor = () => ( +
+ + + + +
+) + +export default IconExampleColor diff --git a/docs/src/examples/components/Icon/Variations/index.tsx b/docs/src/examples/components/Icon/Variations/index.tsx index 0cb86f7721..1f80f5d24f 100644 --- a/docs/src/examples/components/Icon/Variations/index.tsx +++ b/docs/src/examples/components/Icon/Variations/index.tsx @@ -9,6 +9,11 @@ const Variations = () => ( description="An icon can have space before, after or on both sides. 'none' value removes the default space around the icon." examplePath="components/Icon/Variations/IconExampleSpace" /> + ): IC return { fontFamily, - width: '1.18em', - fontStyle: 'normal', - fontWeight: 400, - textDecoration: 'inherit', textAlign: 'center', - - '-webkit-font-smoothing': 'antialiased', - '-moz-osx-font-smoothing': 'grayscale', - backfaceVisibility: 'hidden', - lineHeight: 1, + width: '1.18em', '::before': { content, - boxSizing: 'inherit', - background: '0 0', }, } } @@ -67,7 +57,6 @@ const getBorderedStyles = (isFontBased, circular, borderColor, color): ICSSInJSS return { ...getPaddedStyle(isFontBased), - // TODO: "black" here should actually match the Icon's fill or text color boxShadow: `0 0 0 0.05em ${borderColor || color || 'black'} inset`, ...(circular ? { borderRadius: '50%' } : {}), } @@ -87,34 +76,42 @@ const iconStyles: ComponentSlotStylesInput = { }): ICSSInJSStyle => { const iconSpec = theme.icons[name] const isFontBased = !iconSpec || !iconSpec.isSvg + const iconColor = v.color || 'currentColor' return { + backgroundColor: v.backgroundColor, display: 'inline-block', fontSize: getSize(size), - + margin: v.margin, + speak: 'none', + verticalAlign: 'middle', + overflow: 'hidden', width: '1em', height: '1em', ...(isFontBased && getFontStyles(name, callable(iconSpec && (iconSpec.icon as FontIconSpec))())), - ...(isFontBased && { color: v.color }), - backgroundColor: v.backgroundColor, + ...(isFontBased && { + color: iconColor, - opacity: 1, - margin: v.margin, + ...(disabled && { + color: v.disabledColor, + }), + }), - speak: 'none', + ...(!isFontBased && { + fill: iconColor, - verticalAlign: 'middle', - overflow: 'hidden', + ...(disabled && { + fill: v.disabledColor, + }), + }), ...getXSpacingStyles(xSpacing, v.horizontalSpace), ...((bordered || v.borderColor || circular) && getBorderedStyles(isFontBased, circular, v.borderColor, v.color)), - - ...(disabled && disabledStyle), } }, @@ -122,8 +119,8 @@ const iconStyles: ComponentSlotStylesInput = { g: getSvgStyle('g'), - /* additional SVG styles for different paths could be added/used in the same way */ path: getSvgStyle('path'), + secondaryPath: getSvgStyle('secondaryPath'), } diff --git a/src/themes/teams/components/Icon/iconVariables.ts b/src/themes/teams/components/Icon/iconVariables.ts index f222c2534e..11132ed0f3 100644 --- a/src/themes/teams/components/Icon/iconVariables.ts +++ b/src/themes/teams/components/Icon/iconVariables.ts @@ -9,15 +9,15 @@ export interface IconVariables { horizontalSpace: string margin: string secondaryColor: string + disabledColor: string } -export default (): IconVariables => ({ +export default (siteVars): IconVariables => ({ color: undefined, - // TODO move initial variable discovery to JSON files - // similar to how components have an info.json file backgroundColor: undefined, borderColor: undefined, horizontalSpace: pxToRem(10), margin: '0 0.25em 0 0', - secondaryColor: 'white', + secondaryColor: siteVars.white, + disabledColor: siteVars.gray06, })