"use client" import { cx } from "class-variance-authority" import NextLink from "next/link" import { useIntl } from "react-intl" import styles from "./contentCard.module.css" import type { ImageVaultAsset } from "@scandic-hotels/common/utils/imageVault" import { ChipStatic } from "../ChipStatic" import Image from "../Image" import { Typography } from "../Typography" interface ContentCardProps { link?: { href: string openInNewTab?: boolean isExternal?: boolean } heading: string image: ImageVaultAsset bodyText: string promoText?: string className?: string } export function ContentCard({ heading, image, bodyText, promoText, className, link, }: ContentCardProps) { const intl = useIntl() const card = ( {promoText ? ( {promoText} ) : null} {heading} {bodyText} ) if (!link) return card const linkProps = { className: styles.link, ...(link.openInNewTab && { target: "_blank", rel: "noopener noreferrer", title: intl.formatMessage({ id: "common.linkOpenInNewTab", defaultMessage: "Opens in a new tab/window", }), }), } return ( {card} ) }
{bodyText}