import React, { useCallback } from 'react'; import { useSpring, animated } from 'react-spring'; import { Testable } from '../../modules/testing'; import { Size, StyledButton, Shadow, Variant, Shape } from './styles'; type Props = Omit, 'size'> & Testable & { size: Size; variant: Variant; shape?: Shape }; export const Button = ({ onClick, shape = 'fill', ...props }: Props) => { const [{ shadow, opacity }, set] = useSpring(() => ({ from: { shadow: 0, opacity: 0.3 }, shadow: 0, opacity: 0, reset: true, })); const click = useCallback>( (evt) => { set({ shadow: 1, opacity: 0 }); onClick?.(evt); }, [onClick, set], ); return ( `0 0 0 ${x}px currentColor`), }} /> {props.children} ); };