Skip to content

Instantly share code, notes, and snippets.

@renatorib
Last active March 10, 2017 03:32
Show Gist options
  • Select an option

  • Save renatorib/8fe4068b70e98b25e27fa03830f88b11 to your computer and use it in GitHub Desktop.

Select an option

Save renatorib/8fe4068b70e98b25e27fa03830f88b11 to your computer and use it in GitHub Desktop.
A Button, wrong way.
import React from 'react';
import cn from 'classnames';
type Props = {
type: 'square' | 'round' | 'circle' | 'outline',
color: 'red' | 'orange' | 'green' | 'lightgray',
children: string,
};
const Button = ({ children, type = 'square', color = 'red' }: Props) => {
const classes = cn('Button', `Button--${type}`, `Button--${color}`);
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