import React from 'react'; export type ButtonVariants = | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'light' | 'link' | 'outline-primary' | 'outline-secondary' | 'outline-info' | 'outline-success' | 'outline-warning' | 'outline-danger' | 'outline-light'; export type ButtonSize = 'xs' | 'sm' | 'lg' | any; export interface IButton extends React.HTMLProps { className?: string; disabled?: boolean; round?: boolean; id?: string; href?: string; size?: ButtonSize; style?: React.CSSProperties; tabIndex?: number; target?: string; type?: 'button' | 'submit' | 'reset'; variant?: ButtonVariants; onClick?(e: any): void; [x: string]: any; } export type RefElements = HTMLButtonElement & HTMLAnchorElement; export const Button = React.forwardRef((props, ref) => { const { className = '', disabled = false, href, id, size = '', style, target, tabIndex, type = 'button', round = false, variant = 'primary', onClick, ...otherProps } = props; const classNames = () => { let classList = `b-button`; if (size) classList += ` ${size}`; if (variant) classList += ` ${variant}`; if (round) classList += ` round`; if (className) classList += ` ${className}`; return classList; }; if (href) { return ( {props.children} ); } else { return ( ); } });