Migrate to a monorepo setup - step 1 * Move web to subfolder /apps/scandic-web * Yarn + transitive deps - Move to yarn - design-system package removed for now since yarn doesn't support the parameter for token (ie project currently broken) - Add missing transitive dependencies as Yarn otherwise prevents these imports - VS Code doesn't pick up TS path aliases unless you open /apps/scandic-web instead of root (will be fixed with monorepo) * Pin framer-motion to temporarily fix typing issue https://github.com/adobe/react-spectrum/issues/7494 * Pin zod to avoid typ error There seems to have been a breaking change in the types returned by zod where error is now returned as undefined instead of missing in the type. We should just handle this but to avoid merge conflicts just pin the dependency for now. * Pin react-intl version Pin version of react-intl to avoid tiny type issue where formatMessage does not accept a generic any more. This will be fixed in a future commit, but to avoid merge conflicts just pin for now. * Pin typescript version Temporarily pin version as newer versions as stricter and results in a type error. Will be fixed in future commit after merge. * Setup workspaces * Add design-system as a monorepo package * Remove unused env var DESIGN_SYSTEM_ACCESS_TOKEN * Fix husky for monorepo setup * Update netlify.toml * Add lint script to root package.json * Add stub readme * Fix react-intl formatMessage types * Test netlify.toml in root * Remove root toml * Update netlify.toml publish path * Remove package-lock.json * Update build for branch/preview builds Approved-by: Linus Flood
82 lines
2.5 KiB
TypeScript
82 lines
2.5 KiB
TypeScript
import HotelLogo from "@/components/Icons/Logos"
|
|
import Image from "@/components/Image"
|
|
import Button from "@/components/TempDesignSystem/Button"
|
|
import Divider from "@/components/TempDesignSystem/Divider"
|
|
import Link from "@/components/TempDesignSystem/Link"
|
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|
import Title from "@/components/TempDesignSystem/Text/Title"
|
|
import { getIntl } from "@/i18n"
|
|
import { getSingleDecimal } from "@/utils/numberFormatting"
|
|
|
|
import { getTypeSpecificInformation } from "./utils"
|
|
|
|
import styles from "./hotelListingItem.module.css"
|
|
|
|
import type { HotelListingItemProps } from "@/types/components/contentPage/hotelListingItem"
|
|
|
|
export default async function HotelListingItem({
|
|
hotel,
|
|
contentType = "hotel",
|
|
url,
|
|
}: HotelListingItemProps) {
|
|
const intl = await getIntl()
|
|
const { description, imageSrc, altText } = getTypeSpecificInformation(
|
|
contentType,
|
|
hotel
|
|
)
|
|
|
|
return (
|
|
<article className={styles.container}>
|
|
<Image
|
|
src={imageSrc}
|
|
alt={altText}
|
|
width={300}
|
|
height={200}
|
|
className={styles.image}
|
|
/>
|
|
<section className={styles.content}>
|
|
<div className={styles.intro}>
|
|
<HotelLogo hotelId={hotel.operaId} hotelType={hotel.hotelType} />
|
|
<Subtitle asChild>
|
|
<Title as="h3">{hotel.name}</Title>
|
|
</Subtitle>
|
|
<div className={styles.captions}>
|
|
<Caption color="uiTextPlaceholder">
|
|
{hotel.address.streetAddress}
|
|
</Caption>
|
|
<div className={styles.dividerContainer}>
|
|
<Divider variant="vertical" color="beige" />
|
|
</div>
|
|
<Caption color="uiTextPlaceholder">
|
|
{intl.formatMessage(
|
|
{ id: "{number} km to city center" },
|
|
{
|
|
number: getSingleDecimal(
|
|
hotel.location.distanceToCentre / 1000
|
|
),
|
|
}
|
|
)}
|
|
</Caption>
|
|
</div>
|
|
</div>
|
|
<Body>{description}</Body>
|
|
{url && (
|
|
<Button
|
|
intent="primary"
|
|
theme="base"
|
|
size="small"
|
|
className={styles.button}
|
|
asChild
|
|
>
|
|
<Link href={url} color="white">
|
|
{intl.formatMessage({ id: "See hotel details" })}
|
|
</Link>
|
|
</Button>
|
|
)}
|
|
</section>
|
|
</article>
|
|
)
|
|
}
|