fix(sw-350): fixed ui-comments for calendar, search and widget

This commit is contained in:
Pontus Dreij
2024-10-14 12:04:05 +02:00
parent 89d65cec38
commit b3b26be83c
16 changed files with 80 additions and 47 deletions

View File

@@ -48,15 +48,6 @@ export default function Search({ locations }: SearchProps) {
dispatch({ type: ActionType.CLEAR_HISTORY_LOCATIONS })
}
function handleOnBlur() {
if (!value && state.searchData?.name) {
setValue(name, state.searchData.name)
// Always need to manually trigger
// revalidation when setting value r-h-f
trigger()
}
}
function handleOnChange(
evt: FormEvent<HTMLInputElement> | ChangeEvent<HTMLInputElement>
) {
@@ -67,6 +58,7 @@ export default function Search({ locations }: SearchProps) {
type: ActionType.SEARCH_LOCATIONS,
})
} else {
console.log("clear")
dispatch({ type: ActionType.CLEAR_SEARCH_LOCATIONS })
}
}
@@ -156,7 +148,6 @@ export default function Search({ locations }: SearchProps) {
}),
...register(name, {
onBlur: function () {
handleOnBlur()
closeMenu()
},
onChange: handleOnChange,

View File

@@ -24,8 +24,3 @@
p {
color: var(--UI-Text-Active);
}
.container:hover:has(input:not(:active, :focus, :focus-within))
input::-webkit-search-cancel-button {
display: none;
}

View File

@@ -1,7 +1,7 @@
"use client"
import { useIntl } from "react-intl"
import Body from "@/components/TempDesignSystem/Text/Body"
import Checkbox from "@/components/TempDesignSystem/Form/Checkbox"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import { Tooltip } from "@/components/TempDesignSystem/Tooltip"
@@ -50,17 +50,17 @@ export default function Voucher() {
>
<div className={styles.options}>
<label className={`${styles.option} ${styles.checkboxVoucher}`}>
<input type="checkbox" disabled className={styles.checkbox} />
<Checkbox name="useVouchers" registerOptions={{ disabled: true }} />
<Caption color="disabled">{useVouchers}</Caption>
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
</label>
<label className={styles.option}>
<input type="checkbox" disabled className={styles.checkbox} />
<Checkbox name="useBonus" registerOptions={{ disabled: true }} />
<Caption color="disabled">{bonus}</Caption>
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
</label>
<label className={styles.option}>
<input type="checkbox" disabled className={styles.checkbox} />
<Checkbox name="useReward" registerOptions={{ disabled: true }} />
<Caption color="disabled">{reward}</Caption>
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
</label>

View File

@@ -68,7 +68,7 @@
.options {
flex-direction: column;
max-width: 190px;
gap: 0;
gap: var(--Spacing-x-half);
}
.vouchers:hover,
.option:hover {
@@ -76,6 +76,7 @@
}
.optionsContainer {
flex-direction: row;
align-items: center;
}
.checkboxVoucher {
display: none;

View File

@@ -27,6 +27,7 @@
.rooms,
.vouchers,
.when,
.whenOpen,
.where {
background-color: var(--Base-Background-Primary-Normal);
border-radius: var(--Corner-radius-Medium);
@@ -34,7 +35,8 @@
.rooms,
.vouchers,
.when {
.when,
.whenOpen {
padding: var(--Spacing-x1) var(--Spacing-x-one-and-half);
}
@@ -61,6 +63,7 @@
.rooms,
.when,
.whenOpen,
.where {
width: 100%;
}
@@ -71,12 +74,14 @@
}
.rooms,
.when {
.when,
.whenOpen {
padding: var(--Spacing-x1) var(--Spacing-x-one-and-half);
border-radius: var(--Corner-radius-Small);
}
.when:hover,
.rooms:hover,
.whenOpen,
.rooms:has(.input:active, .input:focus, .input:focus-within) {
background-color: var(--Base-Surface-Primary-light-Hover-alt);
}

View File

@@ -1,4 +1,5 @@
"use client"
import { useState } from "react"
import { useWatch } from "react-hook-form"
import { useIntl } from "react-intl"
@@ -22,6 +23,7 @@ export default function FormContent({
formId,
}: BookingWidgetFormContentProps) {
const intl = useIntl()
const [isDatePickerOpen, setIsDatePickerOpen] = useState(false)
const selectedDate = useWatch({ name: "date" })
const rooms = intl.formatMessage({ id: "Guests & Rooms" })
@@ -35,14 +37,14 @@ export default function FormContent({
<div className={styles.where}>
<Search locations={locations} />
</div>
<div className={styles.when}>
<div className={isDatePickerOpen ? styles.whenOpen : styles.when}>
<Caption color="red" textTransform="bold">
{intl.formatMessage(
{ id: "booking.nights" },
{ totalNights: nights }
)}
</Caption>
<DatePicker />
<DatePicker onToggleOpen={setIsDatePickerOpen} />
</div>
<div className={styles.rooms}>
<label>