import { Button as ButtonRAC } from 'react-aria-components' import { useIntl } from 'react-intl' import IconChip from '../IconChip' import DiscountIcon from '../Icons/Nucleo/Benefits/discount-2-2' import FilledDiscountIcon from '../Icons/Nucleo/Benefits/FilledDiscount' import { MaterialIcon } from '../Icons/MaterialIcon' import { Typography } from '../Typography' import styles from './bookingCodeChip.module.css' type BaseBookingCodeChipProps = { alignCenter?: boolean bookingCode?: string | null isCampaign?: boolean isUnavailable?: boolean withText?: boolean filledIcon?: boolean } type BookingCodeChipWithoutCloseButtonProps = BaseBookingCodeChipProps & { withCloseButton?: false } type BookingCodeChipWithCloseButtonProps = BaseBookingCodeChipProps & { withCloseButton: true onClose: () => void } type BookingCodeChipProps = | BookingCodeChipWithoutCloseButtonProps | BookingCodeChipWithCloseButtonProps export function BookingCodeChip({ alignCenter, bookingCode, isCampaign, isUnavailable, withText = true, filledIcon = false, ...props }: BookingCodeChipProps) { const intl = useIntl() if (isCampaign) { return ( ) : ( ) } className={alignCenter ? styles.center : undefined} >

{intl.formatMessage({ defaultMessage: 'Campaign' })} {bookingCode && ( {bookingCode} )}

) } if (!bookingCode) { return null } return ( ) : ( ) } className={alignCenter ? styles.center : undefined} >

{withText && ( {intl.formatMessage({ defaultMessage: 'Booking code', })} )} {bookingCode}

{props.withCloseButton && ( <> )}
) }