feat: SW-276 Implemented Guests and rooms picker

This commit is contained in:
Hrishikesh Vaipurkar
2024-09-12 11:30:56 +02:00
parent f4be831a78
commit 24f7bc290d
19 changed files with 605 additions and 4 deletions

View File

@@ -0,0 +1,47 @@
import { useIntl } from "react-intl"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import AdultSelector from "./AdultSelector"
import ChildSelector from "./ChildSelector"
import styles from "./guests-room-picker.module.css"
import {
Child,
GuestsRoom,
GuestsRoomPickerProps,
} from "@/types/components/bookingWidget/guestsRoomsPicker"
export default function GuestsRoomPicker({
handleOnSelect = (selected: GuestsRoom, index: number) => {},
room = { adults: 1, children: [] },
index = 1,
}: GuestsRoomPickerProps) {
const intl = useIntl()
const roomLabel = intl.formatMessage({ id: "Room" })
function updateAdults(count: number) {
room.adults = count
handleOnSelect(room, index)
}
function updateChildren(children: Child[]) {
room.children = children
handleOnSelect(room, index)
}
return (
<section className={styles.container}>
<Subtitle>
{roomLabel} {index + 1}
</Subtitle>
<AdultSelector adults={room.adults} updateAdults={updateAdults} />
<ChildSelector
roomChildren={room.children}
adultCount={room.adults}
updateChildren={updateChildren}
/>
</section>
)
}