feat(SW-914): add amenities sidepeek
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
import type { AmenityProps } from "@/types/components/hotelPage/sidepeek/amenity"
|
||||||
|
|
||||||
|
export default function Amenity({ title }: AmenityProps) {
|
||||||
|
return <div>{title}</div>
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { amenities } from "@/constants/routes/hotelPageParams"
|
||||||
|
|
||||||
|
import Accordion from "@/components/TempDesignSystem/Accordion"
|
||||||
|
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||||
|
import SidePeek from "@/components/TempDesignSystem/SidePeek"
|
||||||
|
import { getIntl } from "@/i18n"
|
||||||
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
|
import { mapFacilityToIconName } from "../../data"
|
||||||
|
import Amenity from "./Amenity"
|
||||||
|
|
||||||
|
import type { AmenitiesSidepeekProps } from "@/types/components/hotelPage/sidepeek/amenities"
|
||||||
|
import { IconName } from "@/types/components/icon"
|
||||||
|
|
||||||
|
export default async function AmenitiesSidepeek({
|
||||||
|
amenitiesList,
|
||||||
|
}: AmenitiesSidepeekProps) {
|
||||||
|
const lang = getLang()
|
||||||
|
const intl = await getIntl()
|
||||||
|
return (
|
||||||
|
<SidePeek
|
||||||
|
contentKey={amenities[lang]}
|
||||||
|
title={intl.formatMessage({ id: "Amenities" })}
|
||||||
|
>
|
||||||
|
<>
|
||||||
|
<Accordion>
|
||||||
|
{amenitiesList.map((amenity) => {
|
||||||
|
const iconName = mapFacilityToIconName(amenity.id)
|
||||||
|
return (
|
||||||
|
<AccordionItem
|
||||||
|
key={amenity.name}
|
||||||
|
title={amenity.name}
|
||||||
|
icon={IconName[iconName]}
|
||||||
|
>
|
||||||
|
<Amenity title={amenity.name} />
|
||||||
|
</AccordionItem>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Accordion>
|
||||||
|
</>
|
||||||
|
</SidePeek>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -287,3 +287,7 @@ export function mapFacilityToIcon(id: FacilityEnum): FC<IconProps> | null {
|
|||||||
const iconName = facilityToIconMap[id]
|
const iconName = facilityToIconMap[id]
|
||||||
return getIconByIconName(iconName) || null
|
return getIconByIconName(iconName) || null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function mapFacilityToIconName(id: FacilityEnum): IconName {
|
||||||
|
return facilityToIconMap[id]
|
||||||
|
}
|
||||||
|
|||||||
5
types/components/hotelPage/sidepeek/amenities.ts
Normal file
5
types/components/hotelPage/sidepeek/amenities.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import type { Hotel } from "@/types/hotel"
|
||||||
|
|
||||||
|
export type AmenitiesSidepeekProps = {
|
||||||
|
amenitiesList: Hotel["detailedFacilities"]
|
||||||
|
}
|
||||||
3
types/components/hotelPage/sidepeek/amenity.ts
Normal file
3
types/components/hotelPage/sidepeek/amenity.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export type AmenityProps = {
|
||||||
|
title: string
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user