Skip to content

Instantly share code, notes, and snippets.

@chadspencer
Last active November 29, 2021 00:17
Show Gist options
  • Save chadspencer/11e7a03cb7f7bb6ebafbde53648f22ad to your computer and use it in GitHub Desktop.
Save chadspencer/11e7a03cb7f7bb6ebafbde53648f22ad to your computer and use it in GitHub Desktop.
import { cx, css } from 'emotion';
const button = {
background: black,
color: white,
'& + &': {
marginLeft: '8px',
}
};
const buttonPrimary = {
background: red,
};
const buttonSecondary = {
background: green,
};
const classes = cx(
css(button),
{[css(buttonPrimary)]: this.props.type === 'primary'},
{[css(buttonSecondary)]: this.props.type === 'secondary'},
);
render(
<button
className={classes}
/>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment