Skip to content

Instantly share code, notes, and snippets.

@ericmasiello
Last active March 6, 2020 17:57
Show Gist options
  • Save ericmasiello/f461ea3348b5188d900452e3cd8a1661 to your computer and use it in GitHub Desktop.
Save ericmasiello/f461ea3348b5188d900452e3cd8a1661 to your computer and use it in GitHub Desktop.
import React from 'react';
import classNames from 'classnames';
import './Button.css';
function Button(props) {
const {
children,
className, // <-- destructure the className passed in
outline,
primary
} = props;
const classes = classNames(
'button',
className, // <-- pass it to classNames()
{
'button--outline': outline && !primary,
'button--outline-primary': outline && primary,
'button--primary': !outline && primary,
}
);
return (<button className={classes}>{children}</button>);
}
export default Button;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment