import React, { useState } from 'react'; import { Box } from '../../atoms/Box/Box'; import { Pressable, PressableProps } from '../../atoms/Pressable/Pressable'; import { Typography, TypographyProps } from '../../atoms/Typography/Typography'; import { ColorsWithHue } from '../../../theme/primitives/colors'; import { composeEvents } from '../../../utils/composeEvents'; type PressableButton = Omit; export interface ButtonProps extends PressableButton { text: string; textProps?: Omit; /** * Supported only on the Web platform */ bgActive?: ColorsWithHue; leadingIcon?: React.ReactNode; } export const Button = ({ text, disabled, opacity, textProps, leadingIcon, bg = 'indigo.500', bgActive = 'indigo.600', onPressIn, onPressOut, onHoverIn, onHoverOut, ...rest }: ButtonProps) => { const [isActive, setIsActive] = useState(false); const toggleState = () => setIsActive((state) => !state); return ( {Boolean(leadingIcon) && {leadingIcon}} {text} ); };