// External imports import * as React from "react" import { isArray } from "lodash" import { Link } from "react-router-dom" // Internal imports import * as ce from "../../helpers/componentEnhancer" import Icon from "./icon" export interface ParentProps { icon?: string | Array label?: string isActive?: boolean isSubmit?: boolean classNames?: Array onClick?: (e) => any href?: string } interface StateProps {} interface DispatchProps {} interface LocalState {} class Button extends React.Component< ParentProps & StateProps & DispatchProps & ce.EnhancedPropsPrivate, LocalState > { createButtonClasses() { const classes = ["button"] if (isArray(this.props.classNames)) classes.push(...this.props.classNames) if (this.props.isActive) classes.push("is-active") return classes.join(" ") } render() { const icon = this.props.icon ? ( ) : null const label = this.props.label ? {this.props.label} : null return this.props.href ? ( {icon} {label} ) : ( ) } } const stateMappings: ce.StateMappings = (s, props) => ({}) const dispatchMappings: ce.DispatchMappings = (d, props) => ({}) export default ((): React.ComponentType => ce.enhance(Button, { stateMappings, dispatchMappings }))()