feat(SW-914): refactor
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
export default function AccessibilityAmenity() {
|
||||
return <div>AccessibilityAmenity</div>
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import { IconName } from "@/types/components/icon"
|
||||
|
||||
export default async function AccessibilityAmenity() {
|
||||
const intl = await getIntl()
|
||||
return (
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Accessibility" })}
|
||||
icon={IconName.Accessibility}
|
||||
>
|
||||
Accessibility
|
||||
</AccordionItem>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
export default function BreakfastAmenity() {
|
||||
return <div>BreakfastAmenity</div>
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import { IconName } from "@/types/components/icon"
|
||||
|
||||
export default async function BreakfastAmenity() {
|
||||
const intl = await getIntl()
|
||||
return (
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Breakfast" })}
|
||||
icon={IconName.CoffeeAlt}
|
||||
>
|
||||
Breakfast
|
||||
</AccordionItem>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
import React from "react"
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
export default function CheckInCheckOutAmenity() {
|
||||
return <div>CheckInAmenity</div>
|
||||
import { IconName } from "@/types/components/icon"
|
||||
|
||||
export default async function CheckInCheckOutAmenity() {
|
||||
const intl = await getIntl()
|
||||
return (
|
||||
<AccordionItem
|
||||
title={`${intl.formatMessage({ id: "Check-in" })}/${intl.formatMessage({ id: "Check-out" })}`}
|
||||
icon={IconName.Business}
|
||||
>
|
||||
Check in / check out information
|
||||
</AccordionItem>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
export default function MeetingsAmenity() {
|
||||
return <div>MeetingsAmenity</div>
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import { IconName } from "@/types/components/icon"
|
||||
|
||||
export default async function MeetingsAmenity() {
|
||||
const intl = await getIntl()
|
||||
return (
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Meetings & Conferences" })}
|
||||
icon={IconName.Business}
|
||||
>
|
||||
Meeting and Conferences
|
||||
</AccordionItem>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
export default function ParkingAmenity() {
|
||||
return <div>ParkingAmenity</div>
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import { IconName } from "@/types/components/icon"
|
||||
|
||||
export default async function ParkingAmenity() {
|
||||
const intl = await getIntl()
|
||||
return (
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Parking" })}
|
||||
icon={IconName.Parking}
|
||||
>
|
||||
Parking
|
||||
</AccordionItem>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
.wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Spacing-x3);
|
||||
padding: var(--Spacing-x1);
|
||||
border-bottom: 1px solid var(--Base-Border-Subtle);
|
||||
}
|
||||
|
||||
.amenity {
|
||||
display: flex;
|
||||
gap: var(--Spacing-x1);
|
||||
padding: var(--Spacing-x-one-and-half) var(--Spacing-x2);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
import { HeartIcon } from "@/components/Icons"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
|
||||
import { mapFacilityToIcon } from "../../../data"
|
||||
|
||||
import styles from "./amenity.module.css"
|
||||
|
||||
import type { AmenityProps } from "@/types/components/hotelPage/sidepeek/amenity"
|
||||
|
||||
export default function Amenity({ name, buttonUrl }: AmenityProps) {
|
||||
export default function Amenity({ filteredAmenities }: AmenityProps) {
|
||||
return (
|
||||
<div className={styles.wrapper}>
|
||||
{buttonUrl && (
|
||||
<Button theme="base" intent="primary" fullWidth asChild>
|
||||
<Link href={buttonUrl} color="white">
|
||||
{name}
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<>
|
||||
{filteredAmenities.map((amenity) => {
|
||||
const Icon = mapFacilityToIcon(amenity.id)
|
||||
return (
|
||||
<div key={amenity.name} className={styles.wrapper}>
|
||||
<div className={styles.amenity}>
|
||||
{Icon ? (
|
||||
<Icon color="burgundy" width={24} height={24} />
|
||||
) : (
|
||||
<HeartIcon color="burgundy" width={24} height={24} />
|
||||
)}
|
||||
<Body color="burgundy">{amenity.name}</Body>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
.wrapper {
|
||||
padding: var(--Spacing-x1);
|
||||
border-bottom: 1px solid var(--Base-Border-Subtle);
|
||||
}
|
||||
|
||||
.amenity {
|
||||
display: flex;
|
||||
gap: var(--Spacing-x1);
|
||||
padding: var(--Spacing-x-one-and-half) var(--Spacing-x2);
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
import { amenities } from "@/constants/routes/hotelPageParams"
|
||||
|
||||
import { HeartIcon } from "@/components/Icons"
|
||||
import Accordion from "@/components/TempDesignSystem/Accordion"
|
||||
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||
import SidePeek from "@/components/TempDesignSystem/SidePeek"
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import { mapFacilityToIcon } from "../../data"
|
||||
import {
|
||||
AccessibilityAmenity,
|
||||
BreakfastAmenity,
|
||||
@@ -16,11 +12,9 @@ import {
|
||||
MeetingsAmenity,
|
||||
ParkingAmenity,
|
||||
} from "./AccordionAmenities"
|
||||
|
||||
import styles from "./amenities.module.css"
|
||||
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,
|
||||
@@ -28,7 +22,7 @@ export default async function AmenitiesSidePeek({
|
||||
const lang = getLang()
|
||||
const intl = await getIntl()
|
||||
|
||||
const filterdList = amenitiesList
|
||||
const filteredAmenities = amenitiesList
|
||||
.filter((filter) => !filter.name.startsWith("Parking"))
|
||||
.filter((filter) => !filter.name.startsWith("Meeting"))
|
||||
.filter((filter) => filter.name !== "Late check-out until 14:00 guaranteed")
|
||||
@@ -39,51 +33,12 @@ export default async function AmenitiesSidePeek({
|
||||
title={intl.formatMessage({ id: "Amenities" })}
|
||||
>
|
||||
<Accordion>
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Parking" })}
|
||||
icon={IconName.Parking}
|
||||
>
|
||||
<ParkingAmenity />
|
||||
</AccordionItem>
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Breakfast" })}
|
||||
icon={IconName.CoffeeAlt}
|
||||
>
|
||||
<BreakfastAmenity />
|
||||
</AccordionItem>
|
||||
<AccordionItem
|
||||
title={`${intl.formatMessage({ id: "Check-in" })}/${intl.formatMessage({ id: "Check-out" })}`}
|
||||
icon={IconName.Business}
|
||||
>
|
||||
<CheckInCheckOutAmenity />
|
||||
</AccordionItem>
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Accessibility" })}
|
||||
icon={IconName.Accessibility}
|
||||
>
|
||||
<AccessibilityAmenity />
|
||||
</AccordionItem>
|
||||
<AccordionItem
|
||||
title={intl.formatMessage({ id: "Meetings & Conferences" })}
|
||||
icon={IconName.Business}
|
||||
>
|
||||
<MeetingsAmenity />
|
||||
</AccordionItem>
|
||||
{filterdList.map((amenity) => {
|
||||
const Icon = mapFacilityToIcon(amenity.id)
|
||||
return (
|
||||
<div key={amenity.name} className={styles.wrapper}>
|
||||
<div className={styles.amenity}>
|
||||
{Icon ? (
|
||||
<Icon color="burgundy" width={24} height={24} />
|
||||
) : (
|
||||
<HeartIcon color="burgundy" width={24} height={24} />
|
||||
)}
|
||||
<Body color="burgundy">{amenity.name}</Body>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
<ParkingAmenity />
|
||||
<BreakfastAmenity />
|
||||
<CheckInCheckOutAmenity />
|
||||
<AccessibilityAmenity />
|
||||
<MeetingsAmenity />
|
||||
<Amenity filteredAmenities={filteredAmenities} />
|
||||
</Accordion>
|
||||
</SidePeek>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user