2020-07-22 16:50:10 +05:30
|
|
|
import React, { ComponentType } from 'react';
|
2019-12-08 01:13:08 +05:30
|
|
|
import clsx from 'clsx';
|
2020-07-22 16:50:10 +05:30
|
|
|
|
2019-12-08 00:32:00 +05:30
|
|
|
import { COLOR_GREEN } from 'app/components/ui';
|
|
|
|
import { Color } from 'app/components/ui';
|
2016-05-02 12:45:42 +05:30
|
|
|
|
2019-12-09 13:17:51 +05:30
|
|
|
import buttons from '../buttons.scss';
|
2016-05-02 14:50:50 +05:30
|
|
|
|
2020-07-22 16:50:10 +05:30
|
|
|
interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
|
block?: boolean;
|
|
|
|
small?: boolean;
|
|
|
|
loading?: boolean;
|
|
|
|
className?: string;
|
|
|
|
color?: Color;
|
|
|
|
disabled?: boolean;
|
|
|
|
component?: string | React.ComponentType<any>;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Button: ComponentType<Props> = ({
|
|
|
|
color = COLOR_GREEN,
|
|
|
|
block,
|
|
|
|
small,
|
|
|
|
disabled,
|
|
|
|
className,
|
|
|
|
loading,
|
|
|
|
component: ComponentProp = 'button',
|
|
|
|
...restProps
|
|
|
|
}) => (
|
|
|
|
<ComponentProp
|
|
|
|
className={clsx(
|
|
|
|
buttons[color],
|
|
|
|
{
|
|
|
|
[buttons.loading]: loading,
|
|
|
|
[buttons.block]: block,
|
|
|
|
[buttons.smallButton]: small,
|
|
|
|
[buttons.disabled]: disabled,
|
|
|
|
},
|
2020-05-24 04:38:24 +05:30
|
|
|
className,
|
2020-07-22 16:50:10 +05:30
|
|
|
)}
|
|
|
|
disabled={disabled}
|
|
|
|
{...restProps}
|
|
|
|
/>
|
|
|
|
);
|
2016-05-02 12:45:42 +05:30
|
|
|
|
2020-07-22 16:50:10 +05:30
|
|
|
export default Button;
|