Created
May 28, 2019 21:19
-
-
Save jepser/a35a93b859525f463f6c41cea19a31fc to your computer and use it in GitHub Desktop.
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
const Spacer = ({ | |
top, left, bottom, right, children, | |
}) => { | |
return ( | |
<Root | |
top={ top } | |
left={ left } | |
bottom={ bottom } | |
right={ right } | |
> | |
{children} | |
</Root> | |
); | |
}; | |
// styled-components.js | |
const Root = styled.div` | |
$({ | |
top, left, right, bottom, | |
}) => css` | |
margin-top: ${top ? unitizedPx(top) : null}; | |
margin-right: ${right ? unitizedPx(right) : null}; | |
margin-bottom: ${bottom ? unitizedPx(bottom) : null}; | |
margin-left: ${left ? unitizedPx(left) : null}; | |
` | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment