import { ReactNode } from 'react'; import { Box } from '../../Box'; import { Button, ButtonProps } from '../../Button'; import { ActionSheetDescription } from './ActionSheetDescription'; import { ActionSheetDivider } from './ActionSheetDivider'; import { ActionSheetLabel } from './ActionSheetLabel'; export type ActionSheetItemChildrenProps = { children: ReactNode; }; export type ActionSheetItemOptionsProps = { label: ReactNode; description?: ReactNode; }; export type ActionSheetItemProps = Pick & { /** * Renders `` below the menu item. */ hasDividerBottom?: boolean; /** * Renders `` above the menu item. */ hasDividerTop?: boolean; /** * Displays an element on the left of `children` or `label. */ leftAdornment?: ReactNode; /** * Displays an element on the right of `children` or `label. */ rightAdornment?: ReactNode; /** * `onSelect` event for when the user clicks on the button */ onSelect: ButtonProps['onClick']; } & (ActionSheetItemChildrenProps | ActionSheetItemOptionsProps); export const ActionSheetItem = ({ hasDividerBottom, hasDividerTop, leftAdornment, onSelect, rightAdornment, tx, ...restOfProps }: ActionSheetItemProps) => { const hasDescription = 'description' in restOfProps; return ( <> {hasDividerTop && } {hasDividerBottom && } ); };