import React from 'react' import { Button as AriakitButton, ButtonProps as AriakitButtonProps, } from '@ariakit/react' import { Props as TextProps, Text } from '../Text/Text' import * as styles from './styles.css' import { Box } from '../Box/Box' import { IconProps } from '../icons' import clsx, { ClassValue } from 'clsx' export type ButtonProps = React.PropsWithChildren & AriakitButtonProps & styles.Variants & { iconLeft?: React.ReactElement iconRight?: React.ReactElement onPress?: () => void cssClass?: ClassValue | ClassValue[] } const buttonToTextSize = { xSmall: 'xSmall', small: 'small', medium: 'small', large: 'small', xLarge: 'large', } as const export const Button = React.forwardRef( ( { children, iconLeft, iconRight, size = styles.defaultSize, kind, emphasis, className, cssClass, disabled, ...buttonProps }, ref, ) => { return ( {children} ) }, ) type ButtonContentProps = Pick< ButtonProps, | 'children' | 'disabled' | 'emphasis' | 'iconLeft' | 'iconRight' | 'kind' | 'size' > export const ButtonContent: React.FC = ({ children, disabled, emphasis, iconLeft, iconRight, kind, size = styles.defaultSize, }) => { const textSize: TextProps['size'] = buttonToTextSize[size] return ( <> {iconLeft && ( {iconLeft} )} {children && ( {children} )} {iconRight && ( {iconRight} )} ) }