Fix/book 149 ui fixes * fixed text-overflow issue in datepicker trigger * fixed X missing in booking code text field * fixed toDate not setting properly * fixed spacing issues and placeholder text not fitting * added error message to child age if none is added * spacing fixes * Revert "map link alignment fix" This reverts commit d38cc5b007bc05a1d48ce6661b1052fe714961c3. * fixed EB points padding issue on SAS tablet * maxWidth on BookingCode/voucher * spacing fixes * fixed icons in error message * spacing fixes * scroll to child age picker updates * feat(SW-3706): fix heatmap issue for langswitcher and booking widget * fixed tablet lineup issue Approved-by: Linus Flood
76 lines
2.0 KiB
TypeScript
76 lines
2.0 KiB
TypeScript
import { useIntl } from "react-intl"
|
|
|
|
import { Button } from "@scandic-hotels/design-system/Button"
|
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
|
|
|
import AdultSelector from "../AdultSelector"
|
|
import ChildSelector from "../ChildSelector"
|
|
|
|
import styles from "../guests-rooms-picker.module.css"
|
|
|
|
import type { GuestsRoom } from "../.."
|
|
|
|
export function GuestsRoom({
|
|
room,
|
|
index,
|
|
onRemove,
|
|
containerRef,
|
|
}: {
|
|
room: GuestsRoom
|
|
index: number
|
|
onRemove: (index: number) => void
|
|
containerRef?: React.RefObject<HTMLDivElement | null>
|
|
}) {
|
|
const intl = useIntl()
|
|
|
|
const roomLabel = intl.formatMessage(
|
|
{
|
|
id: "booking.roomIndex",
|
|
defaultMessage: "Room {roomIndex}",
|
|
},
|
|
{
|
|
roomIndex: index + 1,
|
|
}
|
|
)
|
|
|
|
const childrenInAdultsBed = room.childrenInRoom.filter(
|
|
(child) => child.bed === ChildBedMapEnum.IN_ADULTS_BED
|
|
).length
|
|
|
|
return (
|
|
<div className={styles.roomContainer}>
|
|
<section className={styles.roomDetailsContainer}>
|
|
<Typography variant="Title/Subtitle/md" className={styles.roomHeading}>
|
|
<p>{roomLabel}</p>
|
|
</Typography>
|
|
<AdultSelector roomIndex={index} currentAdults={room.adults} />
|
|
<ChildSelector
|
|
roomIndex={index}
|
|
currentAdults={room.adults}
|
|
currentChildren={room.childrenInRoom}
|
|
childrenInAdultsBed={childrenInAdultsBed}
|
|
containerRef={containerRef}
|
|
/>
|
|
{index !== 0 && (
|
|
<Button
|
|
variant="Text"
|
|
onPress={() => onRemove(index)}
|
|
size="sm"
|
|
className={styles.roomActionsButton}
|
|
leadingIconName="delete"
|
|
>
|
|
{intl.formatMessage({
|
|
id: "bookingWidget.roomsPicker.removeRoom",
|
|
defaultMessage: "Remove room",
|
|
})}
|
|
</Button>
|
|
)}
|
|
</section>
|
|
|
|
<Divider color="Border/Divider/Subtle" />
|
|
</div>
|
|
)
|
|
}
|