//@flow import React from "react"; import classNames from "classnames"; import { Link } from "react-router-dom"; export type ButtonProps = { label: string, loading?: boolean, disabled?: boolean, action?: () => void, link?: string, fullWidth?: boolean }; type Props = ButtonProps & { type: string }; class Button extends React.Component { renderButton = () => { const { label, loading, disabled, type, action, fullWidth } = this.props; const loadingClass = loading ? "is-loading" : ""; const fullWidthClass = fullWidth ? "is-fullwidth" : ""; return ( ); }; render() { const { link } = this.props; if (link) { return {this.renderButton()}; } else { return this.renderButton(); } } } export default Button;