import { Children, ComponentProps, ReactElement, ReactNode } from 'react'; import classnames from 'classnames'; import { TOKEN_SPACE_500, TOKEN_SPACE_800, TOKEN_SPACE_1000, TOKEN_SPACE_1300, } from '@swipebox/morphe-design-tokens'; import styles from '../BannerUpsell.css'; import BannerUpsellForm from '../BannerUpsellForm'; import Box from '../Box'; import Button from '../Button'; import ButtonLink from '../ButtonLink'; import { useColorScheme } from '../contexts/ColorSchemeProvider'; import { useDefaultLabelContext } from '../contexts/DefaultLabelProvider'; import Flex from '../Flex'; import Heading from '../Heading'; import IconButton from '../IconButton'; import Image from '../Image'; import Mask from '../Mask'; import Text from '../Text'; import useResponsiveMinWidth from '../useResponsiveMinWidth'; export 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'; }; type UpsellActionProps = { data: ActionDataType; stacked?: boolean; type: string; size?: string; twoButtons?: boolean; }; function UpsellAction({ data, stacked, type, size, twoButtons }: UpsellActionProps) { const color = type === 'primary' ? 'red' : 'gray'; const { accessibilityLabel, disabled, label } = data; const marginEnd = type === 'primary' && size === 'sm' && twoButtons ? 1 : undefined; const marginStart = type === 'secondary' && size === 'sm' && twoButtons ? 1 : undefined; const width = twoButtons ? '50%' : '100%'; return ( {data.role === 'link' ? ( ) : (