2018-11-04 06:22:46 +00:00
|
|
|
import React from 'react';
|
2019-01-23 06:34:39 +00:00
|
|
|
import cn from 'classnames';
|
2018-11-04 06:22:46 +00:00
|
|
|
|
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 />}
|
2018-11-04 06:22:46 +00:00
|
|
|
{children}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default Button;
|