Skip to content

Commit

Permalink
feat(Tag): adds condensed mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Firsov committed Oct 23, 2019
1 parent 874696f commit 436b147
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions e2e/__tests__/tag.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { baisy } from '../setup/TestSuiter';
const SUITES = [
baisy.suite('Components/Tag', 'common'),
baisy.suite('Components/Tag', 'with large content'),
baisy.suite('Components/Tag', 'condensed'),
];


Expand Down
5 changes: 3 additions & 2 deletions src/components/Tag/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ type TagProps = {
children?: React$Node,
/** tag background color */
color?: string,
condensed?: boolean,
};

const Tag = ({ children, ...rest }: TagProps) => (
<TagOuter { ...rest } tagName="span">
const Tag = ({ children, condensed = false, ...rest }: TagProps) => (
<TagOuter condensed={ condensed } { ...rest } tagName="span">
<TagInner tagName="span">{ children }</TagInner>
</TagOuter>
);
Expand Down
19 changes: 19 additions & 0 deletions src/components/Tag/Tag.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,22 @@ export const withLargeContent = () => (
withLargeContent.story = {
name: 'with large content',
};

export const condensed = () => (
<Column>
<Tag condensed>Content</Tag>
<Tag condensed color="GRAY_50">Content</Tag>
<Tag condensed color="GRAY_40">Content</Tag>
<Tag condensed color="YELLOW_30">Content</Tag>
<Tag condensed color="PURPLE_10">Content</Tag>
<Tag condensed color="BLUE_10">Content</Tag>
<Tag condensed color="BLUE_20">Content</Tag>
<Tag condensed color="BLUE_30">Content</Tag>
<Tag condensed color="BLUE_40">Content</Tag>
<Tag condensed color="GREEN_40">Content</Tag>
</Column>
);

condensed.story = {
name: 'condensed tag',
};
4 changes: 4 additions & 0 deletions src/components/Tag/Tag.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const [TagOuter, themeOuter] = createThemeTag(name, ({ COLORS, FONTS }: *): * =>
color,
} : null)
, COLORS),
condensed: {
borderRadius: '5px',
minHeight: '16px',
},
},
}));

Expand Down

0 comments on commit 436b147

Please sign in to comment.