Skip to content

Instantly share code, notes, and snippets.

@adeelibr
Last active April 16, 2019 19:12
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 adeelibr/4c4aa70fd1dfffb81a28b46ea95b5ebc to your computer and use it in GitHub Desktop.
Save adeelibr/4c4aa70fd1dfffb81a28b46ea95b5ebc to your computer and use it in GitHub Desktop.
If/else hell & it's atonement Part 3
const MyButton = ({ theme, rounded, hover, content }) => {
let className = '';
if (theme === 'default') {
className = rounded ? 'default-btn rounded' : 'default-btn';
} else if (theme === 'primary') {
className = rounded ? 'primary-btn rounded' : 'primary-btn';
}
if (hover) {
className = className + ' hover';
}
return (
<button className={className}>{content}</button>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment