Skip to content

Commit 1b06746

Browse files
author
kuba holak
authored
Fix tag bg color props
1 parent e263c76 commit 1b06746

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nordcloud/gnui",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"repository": "git://github.com/nordcloud/gnui.git",

src/components/tag/Tag.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ interface TagProps {
66
color?: string;
77
text?: string;
88
}
9-
const changeTagColor = (color: string) => css`
10-
background-color: ${theme.colors[color]};
11-
`;
9+
1210
export const StyledTag = styled.div`
1311
display: inline-block;
1412
text-transform: capitalize;
@@ -20,13 +18,8 @@ export const StyledTag = styled.div`
2018
margin: ${theme.spacing.spacing01};
2119
border-radius: 1rem;
2220
color: ${theme.colors.lights[0]};
23-
background-color: ${theme.colors.lights[3]};
24-
25-
${({ color }) =>
26-
color &&
27-
css`
28-
${changeTagColor(color)}
29-
`}
21+
background-color: ${({ color }) =>
22+
color ? theme.colors[color] || color : theme.colors.lights[3]};
3023
`;
3124

3225
export const Tag: React.FC<TagProps> = ({ color, text }) => {

src/stories/Tag.stories.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { Container } from "../components/container";
2727
<Tag color="danger" text="failed" />
2828
<Tag color="notification" text="starting" />
2929
<Tag color="primary" text="primary" />
30+
<Tag color="#daffad" text="custom" />
3031
<Tag text="No data" />
3132
</Container>
3233
</Story>

0 commit comments

Comments
 (0)