import { useCallback } from 'react'; import classNames from 'classnames'; interface BaseProps extends React.ButtonHTMLAttributes { block?: boolean; secondary?: boolean; text?: JSX.Element; } interface PropsWithChildren extends BaseProps { text?: never; } interface PropsWithText extends BaseProps { text: JSX.Element; children: never; } type Props = PropsWithText | PropsWithChildren; export const Button: React.FC = ({ text, type = 'button', onClick, disabled, block, secondary, className, title, children, ...props }) => { const handleClick = useCallback>( (e) => { if (!disabled && onClick) { onClick(e); } }, [disabled, onClick], ); return ( ); };