feat: filter route changes
This commit is contained in:
@@ -22,7 +22,7 @@ export default async function SelectHotelPage({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
<HotelFilter filter={hotelFilters} />
|
<HotelFilter filters={hotelFilters} />
|
||||||
<section className={styles.section}>
|
<section className={styles.section}>
|
||||||
{hotels.map((hotel) => (
|
{hotels.map((hotel) => (
|
||||||
<HotelCard key={hotel.name} hotel={hotel} />
|
<HotelCard key={hotel.name} hotel={hotel} />
|
||||||
|
|||||||
@@ -4,35 +4,35 @@ import styles from "./hotelFilter.module.css"
|
|||||||
|
|
||||||
import { HotelFilterProps } from "@/types/components/hotelReservation/selectHotel/hotelFilterProps"
|
import { HotelFilterProps } from "@/types/components/hotelReservation/selectHotel/hotelFilterProps"
|
||||||
|
|
||||||
export default async function HotelFilter({ filter }: HotelFilterProps) {
|
export default async function HotelFilter({ filters }: HotelFilterProps) {
|
||||||
const { formatMessage } = await getIntl()
|
const { formatMessage } = await getIntl()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className={styles.container}>
|
<aside className={styles.container}>
|
||||||
<div className={styles.facilities}>
|
<div className={styles.facilities}>
|
||||||
{formatMessage({ id: "Room facilities" })}
|
{formatMessage({ id: "Room facilities" })}
|
||||||
{filter[0].filter.roomFacilities.map((filter, index) => (
|
{filters.filterType.roomFacilities.map((roomFilter, index) => (
|
||||||
<div key={index} className={styles.filter}>
|
<div key={index} className={styles.filter}>
|
||||||
<input id={filter} name={filter} type="checkbox" />
|
<input id={roomFilter} name={roomFilter} type="checkbox" />
|
||||||
<label htmlFor={filter}>{filter}</label>
|
<label htmlFor={roomFilter}>{roomFilter}</label>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.facilities}>
|
<div className={styles.facilities}>
|
||||||
{formatMessage({ id: "Hotel facilities" })}
|
{formatMessage({ id: "Hotel facilities" })}
|
||||||
{filter[0].filter.hotelFacilities.map((filter, index) => (
|
{filters.filterType.hotelFacilities.map((hotelFilter, index) => (
|
||||||
<div key={index} className={styles.filter}>
|
<div key={index} className={styles.filter}>
|
||||||
<input id={filter} name={filter} type="checkbox" />
|
<input id={hotelFilter} name={hotelFilter} type="checkbox" />
|
||||||
<label htmlFor={filter}>{filter}</label>
|
<label htmlFor={hotelFilter}>{hotelFilter}</label>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.facilities}>
|
<div className={styles.facilities}>
|
||||||
{formatMessage({ id: "Hotel surroundings" })}
|
{formatMessage({ id: "Hotel surroundings" })}
|
||||||
{filter[0].filter.hotelSurroundings.map((filter, index) => (
|
{filters.filterType.hotelSurroundings.map((sorroundings, index) => (
|
||||||
<div key={index} className={styles.filter}>
|
<div key={index} className={styles.filter}>
|
||||||
<input id={filter} name={filter} type="checkbox" />
|
<input id={sorroundings} name={sorroundings} type="checkbox" />
|
||||||
<label htmlFor={filter}>{filter}</label>
|
<label htmlFor={sorroundings}>{sorroundings}</label>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -483,12 +483,12 @@ export const getRatesSchema = z.array(rate)
|
|||||||
export type Rate = z.infer<typeof rate>
|
export type Rate = z.infer<typeof rate>
|
||||||
|
|
||||||
const hotelFilter = z.object({
|
const hotelFilter = z.object({
|
||||||
filter: z.object({
|
filterType: z.object({
|
||||||
roomFacilities: z.array(z.string()),
|
roomFacilities: z.array(z.string()),
|
||||||
hotelFacilities: z.array(z.string()),
|
hotelFacilities: z.array(z.string()),
|
||||||
hotelSurroundings: z.array(z.string()),
|
hotelSurroundings: z.array(z.string()),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const getFiltersSchema = z.array(hotelFilter)
|
export const getFiltersSchema = hotelFilter
|
||||||
export type HotelFilter = z.infer<typeof hotelFilter>
|
export type HotelFilter = z.infer<typeof hotelFilter>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
[
|
|
||||||
{
|
{
|
||||||
"filter": {
|
"filterType": {
|
||||||
"roomFacilities": ["Balcony", "Bathub", "View", "Conntecting doors"],
|
"roomFacilities": ["Balcony", "Bathub", "View", "Conntecting doors"],
|
||||||
"hotelFacilities": [
|
"hotelFacilities": [
|
||||||
"Parking inside",
|
"Parking inside",
|
||||||
@@ -23,4 +22,3 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import { HotelFilter } from "@/server/routers/hotels/output"
|
import { HotelFilter } from "@/server/routers/hotels/output"
|
||||||
|
|
||||||
export type HotelFilterProps = { filter: HotelFilter[] }
|
export type HotelFilterProps = { filters: HotelFilter }
|
||||||
|
|||||||
Reference in New Issue
Block a user