import { ComponentProps, useRef } from 'react'; import useIsWrappedContainer from './useIsWrappedContainer'; import Box from '../Box'; import Button from '../Button'; import ButtonLink from '../ButtonLink'; import Flex from '../Flex'; type ActionDataType = | { accessibilityLabel: string; disabled?: boolean; href: string; label: string; onClick?: ComponentProps['onClick']; rel?: 'none' | 'nofollow'; role: 'link'; target?: null | 'self' | 'blank'; } | { accessibilityLabel: string; disabled?: boolean; label: string; onClick?: ComponentProps['onClick']; role?: 'button'; }; function Action({ data, level, type, size = 'lg', }: { data: ActionDataType; level: string; size?: 'md' | 'lg'; type: 'default' | 'error' | 'info' | 'recommendation' | 'success' | 'warning'; }) { const primaryColor: ComponentProps['color'] = 'red'; let secondaryColor: 'white' | 'transparent' | 'gray' = 'white'; if (type === 'default') { secondaryColor = 'gray'; } const color: ComponentProps['color'] = level === 'primary' ? primaryColor : secondaryColor; const { accessibilityLabel, disabled, label } = data; return data.role === 'link' ? ( ) : (