Skip to content

Commit f84f7c6

Browse files
authored
Fix color SvgIcons type (#599)
1 parent 617f280 commit f84f7c6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nordcloud/gnui",
33
"description": "Nordcloud Design System - a collection of reusable React components used in Nordcloud's SaaS products",
4-
"version": "8.6.0",
4+
"version": "8.6.1",
55
"license": "MIT",
66
"repository": {
77
"type": "git",

src/components/svgicon/SVGIcon.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const StyledSVGIcon = styled.svg<Pick<SVGIconProps, "color" | "size">>`
1313
${({ color }) =>
1414
color &&
1515
css`
16-
fill: ${theme.colors[color] || color};
16+
fill: ${theme.colors[color as SingleColors] || color};
1717
`}
1818
1919
${({ size }) =>
@@ -26,9 +26,12 @@ const StyledSVGIcon = styled.svg<Pick<SVGIconProps, "color" | "size">>`
2626

2727
const VIEW_BOX = "0 0 24 24";
2828

29+
type AnyString = Record<never, never> & string;
30+
type SvgColor = AnyString | SingleColors;
31+
2932
export type SVGIconProps = React.HTMLAttributes<HTMLOrSVGElement> & {
3033
name: PathName;
31-
color?: SingleColors;
34+
color?: SvgColor;
3235
size?: keyof typeof theme.iconSize;
3336
};
3437

0 commit comments

Comments
 (0)