This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Text): New Text component; upgrade to styled-system@v5 (#79)
- Loading branch information
Showing
21 changed files
with
417 additions
and
235 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,50 +1,28 @@ | ||
import { css } from 'styled-components'; | ||
import { | ||
display, | ||
space, | ||
color, | ||
height, | ||
width, | ||
fontSize, | ||
fontWeight, | ||
textAlign, | ||
lineHeight, | ||
alignSelf, | ||
justifySelf, | ||
flex, | ||
} from 'styled-system'; | ||
import { compose, space, color, typography, layout, flexbox, position, background } from 'styled-system'; | ||
import propTypes from '@styled-system/prop-types'; | ||
import { createComponent } from '../utils'; | ||
|
||
const Box = createComponent({ | ||
name: 'Box', | ||
style: css` | ||
${display} | ||
${space} | ||
${color} | ||
${fontSize} | ||
${fontWeight} | ||
${textAlign} | ||
${lineHeight} | ||
${height} | ||
${width} | ||
${flex} | ||
${alignSelf} | ||
${justifySelf} | ||
`, | ||
style: compose( | ||
space, | ||
color, | ||
typography, | ||
layout, | ||
flexbox, | ||
position, | ||
background | ||
), | ||
}); | ||
|
||
Box.propTypes = { | ||
...display.propTypes, | ||
...space.propTypes, | ||
...color.propTypes, | ||
...width.propTypes, | ||
...fontSize.propTypes, | ||
...fontWeight.propTypes, | ||
...textAlign.propTypes, | ||
...lineHeight.propTypes, | ||
...flex.propTypes, | ||
...alignSelf.propTypes, | ||
...justifySelf.propTypes, | ||
...propTypes.space, | ||
...propTypes.color, | ||
...propTypes.typography, | ||
...propTypes.layout, | ||
...propTypes.flexbox, | ||
...propTypes.position, | ||
...propTypes.background, | ||
}; | ||
|
||
export default Box; |
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,35 +1,24 @@ | ||
import React from 'react'; | ||
import { css } from 'styled-components'; | ||
import { flexWrap, flexDirection, alignSelf, alignItems, justifyContent } from 'styled-system'; | ||
import Box from '../Box'; | ||
import { createComponent } from '../utils'; | ||
|
||
const BaseFlex = createComponent({ | ||
const StyledFlex = createComponent({ | ||
name: 'Flex', | ||
as: Box, | ||
style: () => css` | ||
display: flex; | ||
${flexWrap}; | ||
${flexDirection}; | ||
${alignItems}; | ||
${alignSelf}; | ||
${justifyContent}; | ||
`, | ||
}); | ||
|
||
/** Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities. For more complex implementations, custom CSS may be necessary. | ||
*/ | ||
const Flex = React.forwardRef((props, ref) => <BaseFlex {...props} ref={ref} />); | ||
const Flex = React.forwardRef((props, ref) => <StyledFlex {...props} ref={ref} />); | ||
|
||
Flex.displayName = 'Flex'; | ||
|
||
Flex.propTypes = { | ||
...flexWrap.propTypes, | ||
...flexDirection.propTypes, | ||
...alignItems.propTypes, | ||
...alignSelf.propTypes, | ||
...justifyContent.propTypes, | ||
...Box.propTypes, | ||
}; | ||
|
||
export default Flex; |
Oops, something went wrong.