feat(SW-3225): Move ParkingInformation to design-system * Inline ParkingInformation types to remove trpc dependency * Move ParkingInformation to design-system * Move numberFormatting to common package * Add deps to external * Fix imports and i18n script * Add common as dependency * Merge branch 'master' into feat/sw-3225-move-parking-information-to-booking-flow Approved-by: Linus Flood
75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import { useIntl } from "react-intl"
|
|
|
|
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
|
import Body from "@scandic-hotels/design-system/Body"
|
|
import Caption from "@scandic-hotels/design-system/Caption"
|
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
|
|
|
import Image from "@/components/Image"
|
|
|
|
import styles from "./ancillaryCard.module.css"
|
|
|
|
import type { AncillaryCardProps } from "@/types/components/ancillaryCard"
|
|
|
|
export function AncillaryCard({ ancillary }: AncillaryCardProps) {
|
|
const intl = useIntl()
|
|
|
|
const priceMsg = `${formatPrice(intl, ancillary.price.total, ancillary.price.currency)} ${ancillary.price.text ?? ""}`
|
|
|
|
return (
|
|
<article className={styles.ancillaryCard}>
|
|
<div className={styles.imageContainer}>
|
|
{ancillary.imageUrl ? (
|
|
<Image
|
|
className={styles.image}
|
|
src={ancillary.imageUrl}
|
|
alt={ancillary.title}
|
|
fill
|
|
style={{ opacity: ancillary.imageOpacity ?? 1 }}
|
|
/>
|
|
) : null}
|
|
</div>
|
|
<div className={styles.contentContainer}>
|
|
<div>
|
|
<Body textTransform="bold" color="uiTextHighContrast">
|
|
{ancillary.title}
|
|
</Body>
|
|
|
|
<div className={styles.price}>
|
|
<Body color="uiTextHighContrast">
|
|
{ancillary.price.included
|
|
? intl.formatMessage({
|
|
defaultMessage: "Included",
|
|
})
|
|
: priceMsg}
|
|
</Body>
|
|
|
|
{ancillary.points && (
|
|
<>
|
|
<div>
|
|
<Divider variant="vertical" />
|
|
</div>
|
|
<Body textAlign="right" color="uiTextHighContrast">
|
|
{intl.formatMessage(
|
|
{
|
|
defaultMessage: "{value} points",
|
|
},
|
|
{
|
|
value: ancillary.points,
|
|
}
|
|
)}
|
|
</Body>
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
{ancillary.description && (
|
|
<Caption asChild color="uiTextHighContrast">
|
|
<div dangerouslySetInnerHTML={{ __html: ancillary.description }} />
|
|
</Caption>
|
|
)}
|
|
</div>
|
|
</article>
|
|
)
|
|
}
|