Files
web/packages/design-system/lib/components/InfoCard/InfoCard.tsx
Erik Tiekstra 3f632e6031 Merged in fix/BOOK-293-button-variants (pull request #3371)
fix(BOOK-293): changed variants and props on IconButton component

* fix(BOOK-293): changed variants and props on IconButton component

* fix(BOOK-293): inherit color for icon


Approved-by: Bianca Widstam
Approved-by: Christel Westerberg
2025-12-19 12:32:52 +00:00

99 lines
2.7 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 ?? false}
{...buttonProps.primaryButton}
>
{primaryButton.text}
</ButtonLink>
) : null}
{secondaryButton ? (
<ButtonLink
size="sm"
href={secondaryButton.href}
onClick={secondaryButton.onClick}
scroll={secondaryButton.scrollOnClick ?? false}
{...buttonProps.secondaryButton}
>
{secondaryButton.text}
</ButtonLink>
) : null}
</div>
</div>
</div>
)
}