Created
May 28, 2019 21:32
-
-
Save jepser/f535f2f0306f8b14424697e47ab938c0 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 BASE_PROPS = ['top', 'right', 'bottom', 'left'] | |
// with this component: | |
<Spacer sm={{ bottom: 1, top: 2 }} md={{ bottom: 2, top: 1 }} sl={{ top: 1 }} /> | |
const responsiveProps = generateResponsiveProps(props, BASE_PROPS) | |
// will generate this and remove sl because that's not in my media queries | |
{ | |
sm: { | |
bottom: 1, | |
top: 2, | |
left: null, | |
right: null | |
}, | |
md: { | |
bottom: 2, | |
top: 1, | |
left: null, | |
right: null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment