Skip to content

Commit 617f280

Browse files
authored
Svgicon custom colors (#598)
1 parent 5a73fd3 commit 617f280

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-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.5.0",
4+
"version": "8.6.0",
55
"license": "MIT",
66
"repository": {
77
"type": "git",

src/components/svgicon/SVGIcon.stories.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { SVGIcon } from ".";
33
import { FlexContainer } from "../container";
44
import CopyToClipboard from "react-copy-to-clipboard";
55
import { Text } from "../text";
6+
import { theme } from "../../index";
67

78
<Meta title="Components/SVGIcon" component={SVGIcon} />
89

@@ -38,6 +39,7 @@ import { Text } from "../text";
3839
<SVGIcon name="dashboard" color="danger" />
3940
<SVGIcon name="dashboard" color="warning" />
4041
<SVGIcon name="dashboard" color="notification" />
42+
<SVGIcon name="dashboard" color={theme.color.support.purple} />
4143
</FlexContainer>
4244
</Story>
4345
</Canvas>

src/components/svgicon/SVGIcon.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import { SingleColors } from "../../theme/config";
55
import { getPath, PathName } from "./paths";
66

77
const StyledSVGIcon = styled.svg<Pick<SVGIconProps, "color" | "size">>`
8-
fill: ${theme.color.text.text01};
8+
fill: ${(props) => props.color || theme.color.text.text01};
99
width: ${theme.iconSize.md};
1010
height: ${theme.iconSize.md};
1111
vertical-align: middle;
1212
1313
${({ color }) =>
1414
color &&
1515
css`
16-
fill: ${theme.colors[color]};
16+
fill: ${theme.colors[color] || color};
1717
`}
1818
1919
${({ size }) =>

0 commit comments

Comments
 (0)