Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jepser/f535f2f0306f8b14424697e47ab938c0 to your computer and use it in GitHub Desktop.
Save jepser/f535f2f0306f8b14424697e47ab938c0 to your computer and use it in GitHub Desktop.
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