dispatch/client/js/components/ui/Button.js

22 lines
401 B
JavaScript
Raw Normal View History

import React from 'react';
2019-01-23 06:34:39 +00:00
import cn from 'classnames';
2020-04-29 01:10:13 +00:00
const Button = ({ children, category, className, icon: Icon, ...props }) => (
2019-01-23 06:34:39 +00:00
<button
2020-04-29 01:10:13 +00:00
className={cn(
{
[`button-${category}`]: category,
'icon-button': Icon && !children
},
className
)}
2019-01-23 06:34:39 +00:00
type="button"
{...props}
>
2020-04-29 01:10:13 +00:00
{Icon && <Icon />}
{children}
</button>
);
export default Button;