Files
web/packages/design-system/lib/components/InfoCard/InfoCard.tsx
Erik Tiekstra 8e08af718c feat(BOOK-743): Replaced deprecated Button component
Approved-by: Bianca Widstam
2026-01-21 09:38:38 +00:00

101 lines
2.8 KiB
TypeScript

import ButtonLink from "../ButtonLink"
import Image from "../Image"
import { Typography } from "../Typography"
import { getButtonProps } from "./utils"
import { infoCardVariants } from "./variants"
import styles from "./infoCard.module.css"
import ImageFallback from "../ImageFallback"
import type { InfoCardProps } from "./types"
export function InfoCard({
primaryButton,
secondaryButton,
topTitle,
heading,
bodyText,
className,
theme,
height,
backgroundImage,
topTitleAngled,
hotelTheme,
}: InfoCardProps) {
const classNames = infoCardVariants({
theme,
hotelTheme,
topTitleAngled,
height,
className,
})
const buttonProps = getButtonProps(theme, hotelTheme)
return (
<div className={classNames}>
{theme === "Image" ? (
<div className={styles.backgroundImageWrapper}>
{backgroundImage ? (
<Image
src={backgroundImage.src}
className={styles.backgroundImage}
alt={backgroundImage.alt ?? ""}
fill
sizes="(min-width: 1367px) 700px, 900px"
focalPoint={backgroundImage.focalPoint}
dimensions={backgroundImage.dimensions}
/>
) : (
<ImageFallback className={styles.backgroundImage} />
)}
</div>
) : null}
<div className={styles.content}>
<div className={styles.titleWrapper}>
{topTitle ? (
<Typography variant="Title/Decorative/md">
<span className={styles.topTitle}>{topTitle}</span>
</Typography>
) : null}
<Typography variant="Title/smLowCase">
<h3 className={styles.heading}>{heading}</h3>
</Typography>
</div>
{bodyText ? (
<Typography variant="Body/Paragraph/mdRegular">
<p className={styles.bodyText}>{bodyText}</p>
</Typography>
) : null}
<div className={styles.buttonContainer}>
{primaryButton ? (
<ButtonLink
size="sm"
href={primaryButton.href}
onClick={primaryButton.onClick}
scroll={primaryButton.scrollOnClick}
isExternal={primaryButton.isExternal}
{...buttonProps.primaryButton}
>
{primaryButton.text}
</ButtonLink>
) : null}
{secondaryButton ? (
<ButtonLink
size="sm"
href={secondaryButton.href}
onClick={secondaryButton.onClick}
scroll={secondaryButton.scrollOnClick}
isExternal={secondaryButton.isExternal}
{...buttonProps.secondaryButton}
>
{secondaryButton.text}
</ButtonLink>
) : null}
</div>
</div>
</div>
)
}