Last active
September 25, 2020 15:51
-
-
Save chadspencer/b2d6987b385f5e7bbe0eeb1d41ec8dd3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { cx, css } from 'emotion'; | |
const button = { | |
background: black, | |
color: white, | |
'& + &': { | |
marginLeft: '8px', | |
} | |
}; | |
const buttonPrimary = { | |
background: red, | |
}; | |
const buttonSecondary = { | |
background: green, | |
}; | |
const sibling = { | |
'& + &': { | |
marginLeft: '8px', | |
} | |
}; | |
const classes = cx( | |
css(button), | |
{[css(buttonPrimary)]: this.props.type === 'primary'}, | |
{[css(buttonSecondary)]: this.props.type === 'secondary'}, | |
); | |
render( | |
<button | |
className={`${classes} ${css(sibling)}`} | |
/> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment