Refactor buttons.

This commit is contained in:
Mike Cao 2020-08-07 00:24:01 -07:00
parent 000f84df96
commit 30b87bc4c4
16 changed files with 175 additions and 63 deletions

View file

@ -3,10 +3,24 @@ import classNames from 'classnames';
import Icon from './Icon';
import styles from './Button.module.css';
export default function Button({ icon, type = 'button', children, className, onClick = () => {} }) {
export default function Button({
type = 'button',
icon,
size,
children,
className,
onClick = () => {},
}) {
return (
<button type={type} className={classNames(styles.button, className)} onClick={onClick}>
{icon && <Icon icon={icon} />}
<button
type={type}
className={classNames(styles.button, className, {
[styles.small]: size === 'S',
[styles.large]: size === 'L',
})}
onClick={onClick}
>
{icon && <Icon icon={icon} size={size} />}
{children}
</button>
);