Skip to content

Commit

Permalink
[Tag] Novo componente de Tag (#71)
Browse files Browse the repository at this point in the history
* 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
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/components/Tag/Tag.jsx
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
5 changes: 5 additions & 0 deletions src/components/Tag/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Tag from './Tag'

export { Tag }

export default Tag
1 change: 1 addition & 0 deletions src/components/index.js
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'
25 changes: 25 additions & 0 deletions src/stories/Tag.stories.mdx
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} />

0 comments on commit 0c8399f

Please sign in to comment.