Files
web/apps/scandic-web/components/Blocks/HotelListing/index.tsx
2025-03-18 07:01:56 +00:00

42 lines
1001 B
TypeScript

import { getHotelsByCSFilter } from "@/lib/trpc/memoizedRequests"
import SectionContainer from "@/components/Section/Container"
import Title from "@/components/TempDesignSystem/Text/Title"
import HotelListingItem from "./HotelListingItem"
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>
<Title level="h4" as="h3" textTransform="capitalize">
{heading}
</Title>
{hotels.map(({ url, hotel, additionalData }) => (
<HotelListingItem
key={hotel.name}
hotel={hotel}
additionalData={additionalData}
contentType={contentType}
url={url}
/>
))}
</SectionContainer>
)
}