Files
web/apps/scandic-web/components/Blocks/HotelListing/index.tsx
Erik Tiekstra fa7214cb58 Feat/SW-2271 hotel list filtering
* feat(SW-2271): Changes to hotel data types in preperation for filtering
* feat(SW-2271): Added filter and sort functionality

Approved-by: Matilda Landström
2025-07-04 09:27:20 +00:00

43 lines
1013 B
TypeScript

import { Typography } from "@scandic-hotels/design-system/Typography"
import { getHotelsByCSFilter } from "@/lib/trpc/memoizedRequests"
import SectionContainer from "@/components/Section/Container"
import HotelListingItem from "./HotelListingItem"
import styles from "./hotelListing.module.css"
import type { HotelListingProps } from "@/types/components/blocks/hotelListing"
export default async function HotelListing({
heading,
locationFilter,
hotelsToInclude,
contentType,
}: HotelListingProps) {
const hotels = await getHotelsByCSFilter({
locationFilter,
hotelsToInclude,
})
if (!hotels.length) {
return null
}
return (
<SectionContainer>
<Typography variant="Title/sm">
<h3 className={styles.heading}>{heading}</h3>
</Typography>
{hotels.map((hotelData) => (
<HotelListingItem
key={hotelData.hotel.name}
hotelData={hotelData}
contentType={contentType}
/>
))}
</SectionContainer>
)
}