Merged in fix/book-149-datepicker-overflowing (pull request #3433)

Fix/optimizations and cleanup of booking widget

* fix(BOOK-149):fixed issue with datepicker overflowing on months spanning more weeks

* fix(BOOK-149): added smooth scroll to age selector to avoid clipping the selector

* cleanup in trigger and css

* update to new Button componenet to fix missing focus indicator

* included color token in triggerbutton class instead


Approved-by: Bianca Widstam
Approved-by: Erik Tiekstra
This commit is contained in:
Matilda Haneling
2026-01-15 11:00:31 +00:00
parent 16fbdb7ae0
commit 4b67ffa7fd
5 changed files with 33 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
"use client"
import { useRef } from "react"
import { useFormContext } from "react-hook-form"
import { useIntl } from "react-intl"
@@ -30,6 +31,7 @@ export default function ChildSelector({
defaultMessage: "Children (012 years)",
})
const { setValue } = useFormContext()
const agePickerRef = useRef<HTMLDivElement | null>(null)
function increaseChildrenCount(roomIndex: number) {
if (currentChildren.length < 5) {
@@ -67,12 +69,19 @@ export default function ChildSelector({
decreaseChildrenCount(roomIndex)
}}
handleOnIncrease={() => {
requestAnimationFrame(() => {
agePickerRef.current?.scrollIntoView({
behavior: "smooth",
block: "center",
})
})
increaseChildrenCount(roomIndex)
}}
disableDecrease={currentChildren.length == 0}
disableIncrease={currentChildren.length == 5}
/>
</section>
<span ref={agePickerRef} />
{currentChildren.map((child, index) => (
<ChildInfoSelector
roomIndex={roomIndex}