22 lines
401 B
JavaScript
Raw Normal View History

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