import { Button as ButtonRAC } from "react-aria-components" import { useIntl } from "react-intl" import DiscountIcon from "@scandic-hotels/design-system/Icons/DiscountIcon" import FilledDiscountIcon from "@scandic-hotels/design-system/Icons/FilledDiscountIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import IconChip from "../TempDesignSystem/IconChip" import styles from "./bookingCodeChip.module.css" type BaseBookingCodeChipProps = { alignCenter?: boolean bookingCode?: string | null isBreakfastIncluded?: boolean 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 default function BookingCodeChip({ alignCenter, bookingCode, isBreakfastIncluded, isCampaign, isUnavailable, withText = true, filledIcon = false, ...props }: BookingCodeChipProps) { const intl = useIntl() if (isCampaign) { return ( ) : ( ) } className={alignCenter ? styles.center : undefined} >

{intl.formatMessage({ defaultMessage: "Campaign" })} {isBreakfastIncluded ? // eslint-disable-next-line formatjs/no-literal-string-in-jsx `${bookingCode ?? ""} ${intl.formatMessage({ defaultMessage: "Breakfast included", })}` : // eslint-disable-next-line formatjs/no-literal-string-in-jsx `${bookingCode ?? ""} ${intl.formatMessage({ defaultMessage: "Breakfast excluded", })}`}

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

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

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