import type { PropsWithChildren } from 'react'; import { useCallback } from 'react'; import classNames from 'classnames'; interface BaseProps extends Omit, 'children'> { block?: boolean; secondary?: 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, className, title, text, children, ...props }) => { const handleClick = useCallback>( (e) => { if (!disabled && onClick) { onClick(e); } }, [disabled, onClick], ); return ( ); };