-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Card): Add theme props in Card component
- Loading branch information
1 parent
2207c68
commit d5d8c96
Showing
12 changed files
with
361 additions
and
74 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
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
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,11 +1,39 @@ | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { | ||
spacing, | ||
baseFontSize as defaultBaseFontSize, | ||
} from '../../shared/theme'; | ||
|
||
const Content = styled.div` | ||
padding: 12px 20px; | ||
font-size: 14px; | ||
margin: 0; | ||
${({ | ||
theme: { | ||
baseFontSize, | ||
spacing: { small, medium }, | ||
}, | ||
}) => ` | ||
padding: ${small}px ${medium}px; | ||
font-size: ${baseFontSize * 0.875}px; | ||
`} | ||
`; | ||
|
||
Content.propTypes = { | ||
theme: PropTypes.shape({ | ||
baseFontSize: PropTypes.number, | ||
spacing: PropTypes.object, | ||
}), | ||
}; | ||
|
||
Content.defaultProps = { | ||
theme: { | ||
spacing, | ||
baseFontSize: defaultBaseFontSize, | ||
}, | ||
}; | ||
|
||
Content.displayName = 'Card.Content'; | ||
|
||
export default Content; |
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
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,9 +1,27 @@ | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
import { spacing } from '../../shared/theme'; | ||
|
||
const Footer = styled.footer` | ||
padding: 0 20px 20px; | ||
padding: ${({ | ||
theme: { | ||
spacing: { medium }, | ||
}, | ||
}) => `0 ${medium}px ${medium}px`}; | ||
`; | ||
|
||
Footer.propTypes = { | ||
theme: PropTypes.shape({ | ||
spacing: PropTypes.object, | ||
}), | ||
}; | ||
|
||
Footer.defaultProps = { | ||
theme: { | ||
spacing, | ||
}, | ||
}; | ||
|
||
Footer.displayName = 'Card.Footer'; | ||
|
||
export default Footer; |
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,18 +1,40 @@ | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { spacing } from '../../shared/theme'; | ||
|
||
const Header = styled.header` | ||
display: flex; | ||
padding: 20px 20px 0; | ||
> * { | ||
margin-right: 18px; | ||
} | ||
${({ | ||
theme: { | ||
spacing: { medium }, | ||
}, | ||
}) => ` | ||
padding: ${medium}px ${medium}px 0; | ||
> * { | ||
margin-right: ${medium}px; | ||
} | ||
> *:last-child { | ||
margin-right: 0; | ||
} | ||
> *:last-child { | ||
margin-right: 0; | ||
} | ||
`} | ||
`; | ||
|
||
Header.propTypes = { | ||
theme: PropTypes.shape({ | ||
spacing: PropTypes.object, | ||
}), | ||
}; | ||
|
||
Header.defaultProps = { | ||
theme: { | ||
spacing, | ||
}, | ||
}; | ||
|
||
Header.displayName = 'Card.Header'; | ||
|
||
export default Header; |
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
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
Oops, something went wrong.