-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(tag): add main tag structure * fix(tag): fix tag color
- Loading branch information
Eduardo Bittencourt
authored
Jun 18, 2020
1 parent
bfee7cc
commit 0c8399f
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import PropTypes from 'prop-types' | ||
import { color, layout, space, border } from 'styled-system' | ||
import { Typography } from '../' | ||
|
||
const Tag = ({ children, variant, fontWeight, color, ...props }) => { | ||
return ( | ||
<Base display='inline-block' p={2} m={2} borderRadius={2} {...props}> | ||
<Typography fontSize={`tag.${variant}`} fontWeight={fontWeight} color={color}> | ||
{children} | ||
</Typography> | ||
</Base> | ||
) | ||
} | ||
|
||
const Base = styled.div` | ||
${color} | ||
${layout} | ||
${space} | ||
${border} | ||
cursor: pointer; | ||
` | ||
|
||
Tag.defaultProps = { | ||
variant: 'md', | ||
fontWeight: 'tag', | ||
backgroundColor: 'blue.main', | ||
color: 'white' | ||
} | ||
|
||
Tag.propTypes = { | ||
variant: PropTypes.oneOf(['sm', 'md']) | ||
} | ||
|
||
export default Tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Tag from './Tag' | ||
|
||
export { Tag } | ||
|
||
export default Tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './Typography' | ||
export * from './Input' | ||
export * from './Grid' | ||
export * from './Tag' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Meta, Story, Preview, Props } from '@storybook/addon-docs/blocks' | ||
|
||
import { Tag } from '../components' | ||
import { ThemeProvider } from '../theme' | ||
|
||
<Meta title="Tag" component={Tag} /> | ||
|
||
# Tag | ||
|
||
Componente base de Tag | ||
|
||
<Preview> | ||
<Story name="Base" parameters={{ | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/O3bKxIcsj2rc1FNIRclJyT/Design-System?node-id=260%3A593' | ||
} | ||
}}> | ||
<ThemeProvider> | ||
<Tag>Selected</Tag> | ||
</ThemeProvider> | ||
</Story> | ||
</Preview> | ||
|
||
<Props of={Tag} /> |