Skip to content

Commit

Permalink
Fix tag bg color props
Browse files Browse the repository at this point in the history
  • Loading branch information
khola committed May 21, 2020
1 parent e263c76 commit 1b06746
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nordcloud/gnui",
"version": "0.2.4",
"version": "0.2.5",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "git://github.com/nordcloud/gnui.git",
Expand Down
13 changes: 3 additions & 10 deletions src/components/tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ interface TagProps {
color?: string;
text?: string;
}
const changeTagColor = (color: string) => css`
background-color: ${theme.colors[color]};
`;

export const StyledTag = styled.div`
display: inline-block;
text-transform: capitalize;
Expand All @@ -20,13 +18,8 @@ export const StyledTag = styled.div`
margin: ${theme.spacing.spacing01};
border-radius: 1rem;
color: ${theme.colors.lights[0]};
background-color: ${theme.colors.lights[3]};
${({ color }) =>
color &&
css`
${changeTagColor(color)}
`}
background-color: ${({ color }) =>
color ? theme.colors[color] || color : theme.colors.lights[3]};
`;

export const Tag: React.FC<TagProps> = ({ color, text }) => {
Expand Down
1 change: 1 addition & 0 deletions src/stories/Tag.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { Container } from "../components/container";
<Tag color="danger" text="failed" />
<Tag color="notification" text="starting" />
<Tag color="primary" text="primary" />
<Tag color="#daffad" text="custom" />
<Tag text="No data" />
</Container>
</Story>
Expand Down

0 comments on commit 1b06746

Please sign in to comment.