Created
August 8, 2016 22:11
-
-
Save hshoff/87bd6792abd3c320c70f5f8d6f71a7d5 to your computer and use it in GitHub Desktop.
Spacing
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
import React from 'react'; | |
import cx from 'classnames'; | |
export default function Spacing(Component) { | |
return (props) => { | |
const { spaceTop, spaceBottom } = props; | |
const classes = cx({ | |
[`space-top-${spaceTop}`]: !!spaceTop, | |
[`space-${spaceBottom}`]: !!spaceBottom, | |
}); | |
return ( | |
<div className={classes}> | |
<Component {...props} /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment