ActionButton.tsx 651 Bytes
Newer Older
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
1
2
3
import * as React from 'react';
import Button from '@material-ui/core/Button';

Maxym Borodenko's avatar
Maxym Borodenko committed
4
interface IActionButtonProps extends React.ClassAttributes<any> {
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
5
6
7
8
9
10
    variant?: 'text' | 'flat' | 'outlined' | 'contained' | 'raised' | 'fab' | 'extendedFab';
    title: string;
    action: any;
    style?: any;
}

Maxym Borodenko's avatar
Maxym Borodenko committed
11
class ActionButton extends React.Component<IActionButtonProps, any> {
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
12
13

    public render() {
Matija Obreza's avatar
Matija Obreza committed
14
        const { title, action, variant = 'raised', style } = this.props;
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
15
16
        return (
            <Button style={ style } variant={ variant } onClick={ action }>
Matija Obreza's avatar
Matija Obreza committed
17
                { title }
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
18
19
20
21
22
            </Button>
        );
    }
}

Matija Obreza's avatar
Matija Obreza committed
23
export default ActionButton;