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