Add active prop

This commit is contained in:
Justin Edmund 2022-02-24 18:18:39 -08:00
parent f9857eb772
commit 7e6e1209dd

View file

@ -14,6 +14,7 @@ import './index.scss'
import { ButtonType } from '~utils/enums' import { ButtonType } from '~utils/enums'
interface Props { interface Props {
active: boolean
disabled: boolean disabled: boolean
icon: string | null icon: string | null
type: ButtonType type: ButtonType
@ -26,6 +27,7 @@ interface State {
class Button extends React.Component<Props, State> { class Button extends React.Component<Props, State> {
static defaultProps: Props = { static defaultProps: Props = {
active: false,
disabled: false, disabled: false,
icon: null, icon: null,
type: ButtonType.Base, type: ButtonType.Base,
@ -65,6 +67,7 @@ class Button extends React.Component<Props, State> {
const classes = classNames({ const classes = classNames({
Button: true, Button: true,
'Active': this.props.active,
'btn-pressed': this.state.isPressed, 'btn-pressed': this.state.isPressed,
'btn-disabled': this.props.disabled, 'btn-disabled': this.props.disabled,
'destructive': this.props.type == ButtonType.Destructive 'destructive': this.props.type == ButtonType.Destructive