import {Spinner} from '@blueprintjs/core'; import {computed} from 'mobx'; import {observer} from 'mobx-react'; import * as React from 'react'; import {Intent} from '../../interfaces'; import {Icon, IconName} from '../Icon'; import styles from './Button.scss'; import classNames from 'classnames'; interface ButtonProps { text?: string; type?: 'button' | 'submit' | 'reset'; onClick?: (e: React.MouseEvent) => void; leftIcon?: IconName | JSX.Element; rightIcon?: IconName | JSX.Element; minimal?: boolean; disabled?: boolean; isLoading?: boolean; intent?: Intent; className?: string; } @observer export class Button extends React.Component { @computed private get intentStyle() { const {intent = Intent.SUCCESS} = this.props; const intentStyleMap = { [Intent.SUCCESS]: styles.intentSuccess, [Intent.PRIMARY]: styles.intentPrimary, [Intent.SECONDARY]: styles.intentSecondary, [Intent.WARNING]: styles.intentWarning, [Intent.DANGER]: styles.intentDanger }; return intentStyleMap[intent]; } private renderLoader() { return ( ); } private renderContent() { const {text, leftIcon, rightIcon} = this.props; const leftIconElement = typeof leftIcon === 'string' ? : leftIcon as JSX.Element; const rightIconElement = typeof rightIcon === 'string' ? : rightIcon as JSX.Element; return ( <> {leftIconElement} {text && {text}} {rightIconElement} ); } public render() { const {type, onClick, minimal, disabled, isLoading, className} = this.props; return ( ); } }