Feat/BOOK-61 refactor hotel page css variables * feat(BOOK-61): Breadcrumbs * feat(BOOK-61): intro section * feat(BOOK-61): show more button * feat(BOOK-61): rooms section * feat(BOOK-61): sidepeeks * feat(BOOK-61): deprecated old Link component * feat(BOOK-61): added new TextLink component to the design-system * feat(BOOK-61): replaced deprecated links with new TextLink component * feat(BOOK-61): miscellaneous changes Approved-by: Bianca Widstam Approved-by: Christel Westerberg
75 lines
1.7 KiB
TypeScript
75 lines
1.7 KiB
TypeScript
import NextLink from "next/link"
|
|
|
|
import Chip from "@scandic-hotels/design-system/Chip"
|
|
import Image from "@scandic-hotels/design-system/Image"
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import styles from "./contentCard.module.css"
|
|
|
|
import type { ImageVaultAsset } from "@scandic-hotels/common/utils/imageVault"
|
|
|
|
interface ContentCardProps {
|
|
link?: {
|
|
href: string
|
|
openInNewTab?: boolean
|
|
isExternal?: boolean
|
|
}
|
|
heading: string
|
|
image: ImageVaultAsset
|
|
bodyText: string
|
|
promoText?: string
|
|
className?: string
|
|
}
|
|
|
|
export default function ContentCard({
|
|
heading,
|
|
image,
|
|
bodyText,
|
|
promoText,
|
|
className = "",
|
|
link,
|
|
}: ContentCardProps) {
|
|
const card = (
|
|
<article className={`${styles.card} ${className}`}>
|
|
<div className={styles.imageContainer}>
|
|
<Image
|
|
src={image.url}
|
|
alt={image.meta.alt || image.meta.caption || ""}
|
|
className={styles.image}
|
|
fill
|
|
sizes="(min-width: 768px) 413px, 100vw"
|
|
focalPoint={image.focalPoint}
|
|
dimensions={image.dimensions}
|
|
/>
|
|
{promoText ? (
|
|
<Chip className={styles.promoTag}>{promoText}</Chip>
|
|
) : null}
|
|
</div>
|
|
<div className={styles.content}>
|
|
<Typography variant="Title/Subtitle/md">
|
|
<h4>{heading}</h4>
|
|
</Typography>
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p>{bodyText}</p>
|
|
</Typography>
|
|
</div>
|
|
</article>
|
|
)
|
|
|
|
if (!link) return card
|
|
|
|
const linkProps = {
|
|
className: styles.link,
|
|
...(link.openInNewTab && {
|
|
target: "_blank",
|
|
rel: "noopener noreferrer",
|
|
}),
|
|
}
|
|
|
|
return (
|
|
<NextLink href={link.href} {...linkProps}>
|
|
{card}
|
|
</NextLink>
|
|
)
|
|
}
|