diff --git a/components/ContentType/HotelPage/CardContainer/cardContainer.module.css b/components/ContentType/HotelPage/CardContainer/cardContainer.module.css deleted file mode 100644 index 9636d90d5..000000000 --- a/components/ContentType/HotelPage/CardContainer/cardContainer.module.css +++ /dev/null @@ -1,15 +0,0 @@ -.cardContainer { - display: grid; - gap: var(--Spacing-x3); - grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); -} - -.cardContainer.twoColumns { - grid-template-columns: repeat(2, 1fr); -} -.cardContainer.threeColumns { - grid-template-columns: repeat(3, 1fr); -} -.cardContainer.fourColumns { - grid-template-columns: repeat(4, 1fr); -} diff --git a/components/ContentType/HotelPage/CardContainer/cardContainer.ts b/components/ContentType/HotelPage/CardContainer/cardContainer.ts deleted file mode 100644 index 51f0c7775..000000000 --- a/components/ContentType/HotelPage/CardContainer/cardContainer.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { VariantProps } from "class-variance-authority" - -import { cardContainerVariants } from "./variants" - -export interface CardContainerProps - extends React.PropsWithChildren>, - VariantProps {} diff --git a/components/ContentType/HotelPage/CardContainer/index.tsx b/components/ContentType/HotelPage/CardContainer/index.tsx deleted file mode 100644 index f65e5981d..000000000 --- a/components/ContentType/HotelPage/CardContainer/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { CardContainerProps } from "./cardContainer" -import { cardContainerVariants } from "./variants" - -export function CardContainer({ - children, - className, - columns, - ...props -}: CardContainerProps) { - return ( -
- {children} -
- ) -} diff --git a/components/ContentType/HotelPage/CardContainer/variants.ts b/components/ContentType/HotelPage/CardContainer/variants.ts deleted file mode 100644 index a7599adb0..000000000 --- a/components/ContentType/HotelPage/CardContainer/variants.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { cva } from "class-variance-authority" - -import styles from "./cardContainer.module.css" - -export const cardContainerVariants = cva(styles.cardContainer, { - variants: { - columns: { - 2: styles.twoColumns, - 3: styles.threeColumns, - 4: styles.fourColumns, - }, - }, - defaultVariants: { - columns: 3, - }, -}) diff --git a/components/ContentType/HotelPage/HotelPage.tsx b/components/ContentType/HotelPage/HotelPage.tsx index 3621be0c3..6268318a6 100644 --- a/components/ContentType/HotelPage/HotelPage.tsx +++ b/components/ContentType/HotelPage/HotelPage.tsx @@ -3,6 +3,9 @@ import { serverClient } from "@/lib/trpc/server" import AmenitiesList from "./AmenitiesList" import IntroSection from "./IntroSection" +import { Rooms } from "./Rooms" +import { MOCK_ROOMS } from "./tempHotelPageData" + import styles from "./hotelPage.module.css" import type { LangParams } from "@/types/params" @@ -19,6 +22,7 @@ export default async function HotelPage({ lang }: LangParams) { hotelId: hotelPageIdentifierData.hotel_page_id, language: lang, }) + const rooms = MOCK_ROOMS return (
@@ -32,6 +36,7 @@ export default async function HotelPage({ lang }: LangParams) { /> +
) } diff --git a/components/ContentType/HotelPage/RoomCard/index.tsx b/components/ContentType/HotelPage/Rooms/RoomCard/index.tsx similarity index 100% rename from components/ContentType/HotelPage/RoomCard/index.tsx rename to components/ContentType/HotelPage/Rooms/RoomCard/index.tsx diff --git a/components/ContentType/HotelPage/RoomCard/roomCard.module.css b/components/ContentType/HotelPage/Rooms/RoomCard/roomCard.module.css similarity index 100% rename from components/ContentType/HotelPage/RoomCard/roomCard.module.css rename to components/ContentType/HotelPage/Rooms/RoomCard/roomCard.module.css diff --git a/components/ContentType/HotelPage/RoomCard/roomCard.ts b/components/ContentType/HotelPage/Rooms/RoomCard/roomCard.ts similarity index 90% rename from components/ContentType/HotelPage/RoomCard/roomCard.ts rename to components/ContentType/HotelPage/Rooms/RoomCard/roomCard.ts index 0d174f46f..06226e7c8 100644 --- a/components/ContentType/HotelPage/RoomCard/roomCard.ts +++ b/components/ContentType/HotelPage/Rooms/RoomCard/roomCard.ts @@ -12,5 +12,5 @@ export interface RoomCardProps { title: string subtitle: string cta: RoomCardCtaProps - badgeText?: string + badgeText?: string | null } diff --git a/components/ContentType/HotelPage/Rooms/index.tsx b/components/ContentType/HotelPage/Rooms/index.tsx new file mode 100644 index 000000000..d98c514d7 --- /dev/null +++ b/components/ContentType/HotelPage/Rooms/index.tsx @@ -0,0 +1,56 @@ +"use client" + +import { useIntl } from "react-intl" + +import { RoomCard } from "./RoomCard" +import { RoomsProps } from "./rooms" + +import styles from "./rooms.module.css" + +export function Rooms({ rooms }: RoomsProps) { + const { formatMessage } = useIntl() + + // TODO: Typings should be adjusted to match the actual data structure + const mappedRooms = rooms.map((room) => ({ + id: room.id, + image: room.images[0], + imageCount: room.images.length, + title: room.title, + subtitle: room.subtitle, + popularChoice: room.popularChoice, + })) + + function handleImageClick(id: string) { + // TODO: Implement opening of a model with carousel + console.log("Image clicked: ", id) + } + + function handleRoomCtaClick(id: string) { + // TODO: Implement opening side-peek component with room details + console.log("Room CTA clicked: ", id) + } + + return ( +
+ {mappedRooms.map( + ({ id, image, imageCount, title, subtitle, popularChoice }) => ( + handleImageClick(id)} + cta={{ + text: formatMessage({ id: "See room details" }), + callback: () => handleRoomCtaClick(id), + }} + /> + ) + )} +
+ ) +} diff --git a/components/ContentType/HotelPage/Rooms/rooms.module.css b/components/ContentType/HotelPage/Rooms/rooms.module.css new file mode 100644 index 000000000..7a74c6009 --- /dev/null +++ b/components/ContentType/HotelPage/Rooms/rooms.module.css @@ -0,0 +1,10 @@ +.cardContainer { + display: grid; + gap: var(--Spacing-x3); +} + +@media screen and (min-width: 768px) { + .cardContainer { + grid-template-columns: repeat(3, 1fr); + } +} diff --git a/components/ContentType/HotelPage/Rooms/rooms.ts b/components/ContentType/HotelPage/Rooms/rooms.ts new file mode 100644 index 000000000..d7ccb5859 --- /dev/null +++ b/components/ContentType/HotelPage/Rooms/rooms.ts @@ -0,0 +1,12 @@ +import { ImageProps } from "next/image" + +// TODO: Typings should be adjusted to match the actual data structure +export interface RoomsProps { + rooms: { + id: string + title: string + subtitle: string + popularChoice: boolean + images: ImageProps[] + }[] +} diff --git a/components/ContentType/HotelPage/tempHotelPageData.ts b/components/ContentType/HotelPage/tempHotelPageData.ts new file mode 100644 index 000000000..783565208 --- /dev/null +++ b/components/ContentType/HotelPage/tempHotelPageData.ts @@ -0,0 +1,82 @@ +import { RoomsProps } from "./Rooms/rooms" + +export const MOCK_ROOMS: RoomsProps["rooms"] = [ + { + id: "1", + title: "Cabin", + subtitle: "15 - 20 m² (2 personer)", + images: [ + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + ], + popularChoice: false, + }, + { + id: "2", + title: "Standard", + subtitle: "15 - 20 m² (2 personer)", + images: [ + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + ], + popularChoice: true, + }, + { + id: "3", + title: "Superior", + subtitle: "15 m² (2 personer)", + images: [ + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + { + src: "https://placehold.co/300x200", + alt: "Placeholder image", + width: 300, + height: 200, + }, + ], + popularChoice: false, + }, +]