Merged in feat/BOOK-119-accessibility-replace-radiogroup (pull request #3081)
feat(BOOK-119): replace radio group on select rate with buttons and make them accessible * feat(BOOK-119): replace radio group on select rate with buttons and make them accessible * feat(BOOK-119): update roomNR * feat(BOOK-119): update onpress and buttonOverlay name change Approved-by: Erik Tiekstra
This commit is contained in:
@@ -96,7 +96,24 @@ export function MultiRoomWrapper({ children, isMultiRoom, roomIndex }: Props) {
|
|||||||
selected: !!selectedRate && !isActiveRoom,
|
selected: !!selectedRate && !isActiveRoom,
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<div className={styles.roomContainer} data-multiroom="true">
|
<div
|
||||||
|
className={styles.roomContainer}
|
||||||
|
data-multiroom="true"
|
||||||
|
aria-labelledby={`room-${roomNr}-heading`}
|
||||||
|
role="region"
|
||||||
|
>
|
||||||
|
<h2 id={`room-${roomNr}-heading`} className="sr-only">
|
||||||
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "booking.roomIndex",
|
||||||
|
defaultMessage: "Room {roomIndex}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
roomIndex: roomNr,
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
</h2>
|
||||||
|
|
||||||
<div className={styles.header}>
|
<div className={styles.header}>
|
||||||
{selectedRate && !isActiveRoom ? null : (
|
{selectedRate && !isActiveRoom ? null : (
|
||||||
<Subtitle color="uiTextHighContrast">{title}</Subtitle>
|
<Subtitle color="uiTextHighContrast">{title}</Subtitle>
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ function Inner({
|
|||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
name={`rateCode-${roomNr}-${product.public.rateCode}`}
|
id={`${roomNr}-${roomTypeCode}-${rateCode}`.replace(/\s+/g, "-")}
|
||||||
paymentTerm={rateTitles[product.rate].paymentTerm}
|
paymentTerm={rateTitles[product.rate].paymentTerm}
|
||||||
rate={{
|
rate={{
|
||||||
label: isMainRoomAndLoggedIn
|
label: isMainRoomAndLoggedIn
|
||||||
@@ -287,7 +287,6 @@ function Inner({
|
|||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
rateTermDetails={rateTermDetails}
|
rateTermDetails={rateTermDetails}
|
||||||
value={product.public.rateCode}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ function InnerCode({
|
|||||||
isRateSelected,
|
isRateSelected,
|
||||||
} = useSelectRateContext()
|
} = useSelectRateContext()
|
||||||
|
|
||||||
|
const roomNr = roomIndex + 1
|
||||||
|
|
||||||
function handleSelectRate(rateCode: string) {
|
function handleSelectRate(rateCode: string) {
|
||||||
selectRate({ roomIndex, rateCode, roomTypeCode, bookingCode })
|
selectRate({ roomIndex, rateCode, roomTypeCode, bookingCode })
|
||||||
}
|
}
|
||||||
@@ -86,7 +88,7 @@ function InnerCode({
|
|||||||
return (
|
return (
|
||||||
<CorporateChequeCode
|
<CorporateChequeCode
|
||||||
codeProduct={codeProduct}
|
codeProduct={codeProduct}
|
||||||
roomIndex={roomIndex}
|
roomNr={roomNr}
|
||||||
roomTypeCode={roomTypeCode}
|
roomTypeCode={roomTypeCode}
|
||||||
bannerText={bannerText}
|
bannerText={bannerText}
|
||||||
packagesSum={pkgsSum}
|
packagesSum={pkgsSum}
|
||||||
@@ -101,7 +103,7 @@ function InnerCode({
|
|||||||
return (
|
return (
|
||||||
<VoucherCode
|
<VoucherCode
|
||||||
codeProduct={codeProduct}
|
codeProduct={codeProduct}
|
||||||
roomIndex={roomIndex}
|
roomNr={roomNr}
|
||||||
roomTypeCode={roomTypeCode}
|
roomTypeCode={roomTypeCode}
|
||||||
bannerText={bannerText}
|
bannerText={bannerText}
|
||||||
packagesSum={pkgsSum}
|
packagesSum={pkgsSum}
|
||||||
@@ -115,7 +117,7 @@ function InnerCode({
|
|||||||
return (
|
return (
|
||||||
<PublicCode
|
<PublicCode
|
||||||
codeProduct={codeProduct}
|
codeProduct={codeProduct}
|
||||||
roomIndex={roomIndex}
|
roomNr={roomNr}
|
||||||
roomTypeCode={roomTypeCode}
|
roomTypeCode={roomTypeCode}
|
||||||
bannerText={bannerText}
|
bannerText={bannerText}
|
||||||
packagesSum={pkgsSum}
|
packagesSum={pkgsSum}
|
||||||
@@ -154,16 +156,17 @@ function useBannerText({
|
|||||||
|
|
||||||
function CorporateChequeCode({
|
function CorporateChequeCode({
|
||||||
codeProduct,
|
codeProduct,
|
||||||
roomIndex,
|
roomNr,
|
||||||
bannerText,
|
bannerText,
|
||||||
packagesSum,
|
packagesSum,
|
||||||
|
roomTypeCode,
|
||||||
requestedPackagesSum,
|
requestedPackagesSum,
|
||||||
handleSelectRate,
|
handleSelectRate,
|
||||||
isSelected,
|
isSelected,
|
||||||
}: {
|
}: {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
codeProduct: Extract<CodeProduct, { corporateCheque: any }>
|
codeProduct: Extract<CodeProduct, { corporateCheque: any }>
|
||||||
roomIndex: number
|
roomNr: number
|
||||||
roomTypeCode: string
|
roomTypeCode: string
|
||||||
bannerText: string
|
bannerText: string
|
||||||
packagesSum: ReturnType<typeof sumPackages>
|
packagesSum: ReturnType<typeof sumPackages>
|
||||||
@@ -171,7 +174,6 @@ function CorporateChequeCode({
|
|||||||
handleSelectRate: (rateCode: string) => void
|
handleSelectRate: (rateCode: string) => void
|
||||||
isSelected: boolean
|
isSelected: boolean
|
||||||
}) {
|
}) {
|
||||||
const roomNr = roomIndex + 1
|
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const rateTitles = useRateTitles()
|
const rateTitles = useRateTitles()
|
||||||
const { localPrice, rateCode, requestedPrice } = codeProduct.corporateCheque
|
const { localPrice, rateCode, requestedPrice } = codeProduct.corporateCheque
|
||||||
@@ -220,7 +222,7 @@ function CorporateChequeCode({
|
|||||||
handleSelectRate(codeProduct.corporateCheque.rateCode)
|
handleSelectRate(codeProduct.corporateCheque.rateCode)
|
||||||
}
|
}
|
||||||
isSelected={isSelected}
|
isSelected={isSelected}
|
||||||
name={`rateCode-${roomNr}-${rateCode}`}
|
id={`${roomNr}-${roomTypeCode}-${rateCode}`.replace(/\s+/g, "-")}
|
||||||
paymentTerm={rateTitles[codeProduct.rate].paymentTerm}
|
paymentTerm={rateTitles[codeProduct.rate].paymentTerm}
|
||||||
rate={{
|
rate={{
|
||||||
label: codeProduct.rateDefinition?.title,
|
label: codeProduct.rateDefinition?.title,
|
||||||
@@ -229,23 +231,23 @@ function CorporateChequeCode({
|
|||||||
}}
|
}}
|
||||||
rateTitle={rateTitles[codeProduct.rate].title}
|
rateTitle={rateTitles[codeProduct.rate].title}
|
||||||
rateTermDetails={rateTermDetails}
|
rateTermDetails={rateTermDetails}
|
||||||
value={rateCode}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function PublicCode({
|
function PublicCode({
|
||||||
codeProduct,
|
codeProduct,
|
||||||
roomIndex,
|
roomNr,
|
||||||
bannerText,
|
bannerText,
|
||||||
packagesSum,
|
packagesSum,
|
||||||
|
roomTypeCode,
|
||||||
packagesSumRequested,
|
packagesSumRequested,
|
||||||
nights,
|
nights,
|
||||||
handleSelectRate,
|
handleSelectRate,
|
||||||
isSelected,
|
isSelected,
|
||||||
}: {
|
}: {
|
||||||
codeProduct: Extract<CodeProduct, { public: unknown }>
|
codeProduct: Extract<CodeProduct, { public: unknown }>
|
||||||
roomIndex: number
|
roomNr: number
|
||||||
roomTypeCode: string
|
roomTypeCode: string
|
||||||
bannerText: string
|
bannerText: string
|
||||||
packagesSum: ReturnType<typeof sumPackages>
|
packagesSum: ReturnType<typeof sumPackages>
|
||||||
@@ -254,7 +256,6 @@ function PublicCode({
|
|||||||
handleSelectRate: (rateCode: string) => void
|
handleSelectRate: (rateCode: string) => void
|
||||||
isSelected: boolean
|
isSelected: boolean
|
||||||
}) {
|
}) {
|
||||||
const roomNr = roomIndex + 1
|
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const rateTitles = useRateTitles()
|
const rateTitles = useRateTitles()
|
||||||
if (!codeProduct.public) {
|
if (!codeProduct.public) {
|
||||||
@@ -315,7 +316,7 @@ function PublicCode({
|
|||||||
comparisonRate={comparisonRate}
|
comparisonRate={comparisonRate}
|
||||||
handleChange={() => handleSelectRate(codeProduct.public!.rateCode)}
|
handleChange={() => handleSelectRate(codeProduct.public!.rateCode)}
|
||||||
isSelected={isSelected}
|
isSelected={isSelected}
|
||||||
name={`rateCode-${roomNr}-${rateCode}`}
|
id={`${roomNr}-${roomTypeCode}-${rateCode}`.replace(/\s+/g, "-")}
|
||||||
paymentTerm={rateTitles[codeProduct.rate].paymentTerm}
|
paymentTerm={rateTitles[codeProduct.rate].paymentTerm}
|
||||||
rate={{
|
rate={{
|
||||||
label: codeProduct.rateDefinition?.title,
|
label: codeProduct.rateDefinition?.title,
|
||||||
@@ -324,7 +325,6 @@ function PublicCode({
|
|||||||
}}
|
}}
|
||||||
rateTitle={rateTitles[codeProduct.rate].title}
|
rateTitle={rateTitles[codeProduct.rate].title}
|
||||||
rateTermDetails={rateTermDetails}
|
rateTermDetails={rateTermDetails}
|
||||||
value={rateCode}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -333,20 +333,20 @@ function VoucherCode({
|
|||||||
codeProduct,
|
codeProduct,
|
||||||
bannerText,
|
bannerText,
|
||||||
packagesSum,
|
packagesSum,
|
||||||
roomIndex,
|
roomNr,
|
||||||
|
roomTypeCode,
|
||||||
handleSelectRate,
|
handleSelectRate,
|
||||||
isSelected,
|
isSelected,
|
||||||
}: {
|
}: {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
codeProduct: Extract<CodeProduct, { voucher: any }>
|
codeProduct: Extract<CodeProduct, { voucher: any }>
|
||||||
roomIndex: number
|
roomNr: number
|
||||||
roomTypeCode: string
|
roomTypeCode: string
|
||||||
bannerText: string
|
bannerText: string
|
||||||
packagesSum: ReturnType<typeof sumPackages>
|
packagesSum: ReturnType<typeof sumPackages>
|
||||||
handleSelectRate: (rateCode: string) => void
|
handleSelectRate: (rateCode: string) => void
|
||||||
isSelected: boolean
|
isSelected: boolean
|
||||||
}) {
|
}) {
|
||||||
const roomNr = roomIndex + 1
|
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const rateTitles = useRateTitles()
|
const rateTitles = useRateTitles()
|
||||||
const { numberOfVouchers, rateCode } = codeProduct.voucher
|
const { numberOfVouchers, rateCode } = codeProduct.voucher
|
||||||
@@ -379,7 +379,7 @@ function VoucherCode({
|
|||||||
bannerText={bannerText}
|
bannerText={bannerText}
|
||||||
handleChange={() => handleSelectRate(codeProduct.voucher.rateCode)}
|
handleChange={() => handleSelectRate(codeProduct.voucher.rateCode)}
|
||||||
isSelected={isSelected}
|
isSelected={isSelected}
|
||||||
name={`rateCode-${roomNr}-${rateCode}`}
|
id={`${roomNr}-${roomTypeCode}-${rateCode}`.replace(/\s+/g, "-")}
|
||||||
paymentTerm={rateTitles[codeProduct.rate].paymentTerm}
|
paymentTerm={rateTitles[codeProduct.rate].paymentTerm}
|
||||||
rate={{
|
rate={{
|
||||||
label: codeProduct.rateDefinition?.title,
|
label: codeProduct.rateDefinition?.title,
|
||||||
@@ -388,7 +388,6 @@ function VoucherCode({
|
|||||||
}}
|
}}
|
||||||
rateTitle={rateTitles[codeProduct.rate].title}
|
rateTitle={rateTitles[codeProduct.rate].title}
|
||||||
rateTermDetails={rateTermDetails}
|
rateTermDetails={rateTermDetails}
|
||||||
value={rateCode}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ function Inner({
|
|||||||
actions: { selectRate },
|
actions: { selectRate },
|
||||||
} = useSelectRateContext()
|
} = useSelectRateContext()
|
||||||
const config = useBookingFlowConfig()
|
const config = useBookingFlowConfig()
|
||||||
|
const roomNr = roomIndex + 1
|
||||||
|
|
||||||
const isMainRoom = roomIndex === 0
|
const isMainRoom = roomIndex === 0
|
||||||
|
|
||||||
@@ -249,10 +250,9 @@ function Inner({
|
|||||||
}}
|
}}
|
||||||
isMemberRateActive={isMemberRateActive}
|
isMemberRateActive={isMemberRateActive}
|
||||||
isSelected={isSelected}
|
isSelected={isSelected}
|
||||||
name={`rateCode-${roomIndex + 1}-${rateCode}`}
|
id={`${roomNr}-${roomTypeCode}-${rateCode}`.replace(/\s+/g, "-")}
|
||||||
paymentTerm={rateTitles[product.rate].paymentTerm}
|
paymentTerm={rateTitles[product.rate].paymentTerm}
|
||||||
rateTitle={rateTitles[product.rate].title}
|
rateTitle={rateTitles[product.rate].title}
|
||||||
value={rateCode}
|
|
||||||
rateTermDetails={rateTermDetails}
|
rateTermDetails={rateTermDetails}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import { MaterialIcon } from '../../Icons/MaterialIcon'
|
|||||||
import Modal from '../Modal'
|
import Modal from '../Modal'
|
||||||
import styles from '../rate-card.module.css'
|
import styles from '../rate-card.module.css'
|
||||||
import { variants } from '../variants'
|
import { variants } from '../variants'
|
||||||
|
import { Button as ButtonRAC } from 'react-aria-components'
|
||||||
|
import { useIntl } from 'react-intl'
|
||||||
|
|
||||||
interface CampaignRateCardProps {
|
interface CampaignRateCardProps {
|
||||||
name: string
|
id: string
|
||||||
value: string
|
|
||||||
isSelected: boolean
|
isSelected: boolean
|
||||||
rateTitle: string
|
rateTitle: string
|
||||||
paymentTerm: string
|
paymentTerm: string
|
||||||
@@ -29,8 +30,7 @@ interface CampaignRateCardProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function CampaignRateCard({
|
export default function CampaignRateCard({
|
||||||
name,
|
id,
|
||||||
value,
|
|
||||||
isSelected,
|
isSelected,
|
||||||
rateTitle,
|
rateTitle,
|
||||||
paymentTerm,
|
paymentTerm,
|
||||||
@@ -49,155 +49,167 @@ export default function CampaignRateCard({
|
|||||||
variant: 'Campaign',
|
variant: 'Campaign',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const intl = useIntl()
|
||||||
return (
|
return (
|
||||||
<label>
|
<div
|
||||||
<input
|
className={cx(classNames, {
|
||||||
className={styles.radio}
|
[styles.selected]: isSelected,
|
||||||
type="radio"
|
})}
|
||||||
name={name}
|
>
|
||||||
value={value}
|
<ButtonRAC
|
||||||
checked={isSelected}
|
onPress={handleChange}
|
||||||
onChange={handleChange}
|
className={styles.buttonOverlay}
|
||||||
|
aria-pressed={isSelected}
|
||||||
|
aria-labelledby={`${id}-title`}
|
||||||
|
aria-describedby={`${id}-details`}
|
||||||
/>
|
/>
|
||||||
<div className={classNames}>
|
<div className={styles.banner}>
|
||||||
<div className={styles.banner}>
|
<MaterialIcon size={16} icon="sell" color="CurrentColor" />
|
||||||
<MaterialIcon size={16} icon="sell" color="CurrentColor" />
|
<Typography variant="Label/xsBold">
|
||||||
<Typography variant="Label/xsBold">
|
<p>{bannerText}</p>
|
||||||
<p>{bannerText}</p>
|
</Typography>
|
||||||
</Typography>
|
</div>
|
||||||
</div>
|
<div className={styles.container}>
|
||||||
<div className={styles.container}>
|
<Typography variant="Tag/sm">
|
||||||
<header>
|
<h3 className={styles.title}>
|
||||||
<Typography variant="Tag/sm">
|
<Modal
|
||||||
<h3 className={styles.title}>
|
title={rateTitle}
|
||||||
<Modal
|
subtitle={paymentTerm}
|
||||||
title={rateTitle}
|
trigger={
|
||||||
subtitle={paymentTerm}
|
<IconButton
|
||||||
trigger={
|
theme="Black"
|
||||||
<IconButton theme="Black" style="Muted" wrapping>
|
style="Muted"
|
||||||
<MaterialIcon
|
wrapping
|
||||||
icon="info"
|
className={styles.triggerButton}
|
||||||
size={20}
|
aria-label={intl.formatMessage({
|
||||||
color="Icon/Default"
|
id: 'selectRate.rateCard.openReservationPolicy',
|
||||||
/>
|
defaultMessage: 'Open reservation policy',
|
||||||
</IconButton>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{rateTermDetails.map((termGroup) => (
|
|
||||||
<div key={termGroup.title} className={styles.terms}>
|
|
||||||
<Typography variant={'Body/Paragraph/mdBold'}>
|
|
||||||
<p>{termGroup.title}</p>
|
|
||||||
</Typography>
|
|
||||||
{termGroup.terms.map((term) => (
|
|
||||||
<Typography key={term}>
|
|
||||||
<p className={styles.term}>
|
|
||||||
<MaterialIcon
|
|
||||||
icon="check"
|
|
||||||
color="Icon/Feedback/Success"
|
|
||||||
size={20}
|
|
||||||
className={styles.termsIcon}
|
|
||||||
/>
|
|
||||||
{term}
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</Modal>
|
|
||||||
{rateTitle}
|
|
||||||
<span className={styles.textSecondary}>
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
{` / ${paymentTerm}`}
|
|
||||||
</span>
|
|
||||||
</h3>
|
|
||||||
</Typography>
|
|
||||||
<div className={styles.checkIcon}>
|
|
||||||
<MaterialIcon icon="check" size={22} color="Icon/Inverted" />
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div className={styles.content}>
|
|
||||||
<div
|
|
||||||
className={cx(styles.rateRow, {
|
|
||||||
[styles.highlightedRate]: isHighlightedRateLabel,
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
|
||||||
<p>{rate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Title/Subtitle/md">
|
|
||||||
<p
|
|
||||||
className={cx({
|
|
||||||
[styles.highlightedRate]: isHighlightedRate,
|
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
<MaterialIcon icon="info" size={20} color="Icon/Default" />
|
||||||
|
</IconButton>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{rateTermDetails.map((termGroup) => (
|
||||||
|
<div key={termGroup.title} className={styles.terms}>
|
||||||
|
<Typography variant={'Body/Paragraph/mdBold'}>
|
||||||
|
<p>{termGroup.title}</p>
|
||||||
|
</Typography>
|
||||||
|
{termGroup.terms.map((term) => (
|
||||||
|
<Typography key={term}>
|
||||||
|
<p className={styles.term}>
|
||||||
|
<MaterialIcon
|
||||||
|
icon="check"
|
||||||
|
color="Icon/Feedback/Success"
|
||||||
|
size={20}
|
||||||
|
className={styles.termsIcon}
|
||||||
|
/>
|
||||||
|
{term}
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</Modal>
|
||||||
|
<span id={`${id}-title`}>
|
||||||
|
{rateTitle}
|
||||||
|
<span className={styles.textSecondary}>
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{` / ${paymentTerm}`}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</Typography>
|
||||||
|
<div className={styles.content} id={`${id}-details`}>
|
||||||
|
<div
|
||||||
|
className={cx(styles.rateRow, {
|
||||||
|
[styles.highlightedRate]: isHighlightedRateLabel,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<p>{rate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Title/Subtitle/md">
|
||||||
|
<p
|
||||||
|
className={cx({
|
||||||
|
[styles.highlightedRate]: isHighlightedRate,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{`${rate.price} `}
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<span>{rate.unit}</span>
|
||||||
|
</Typography>
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
{memberRate ? (
|
||||||
|
<div className={`${styles.rateRow} ${styles.highlightedRate}`}>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<p>{memberRate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Title/Subtitle/md">
|
||||||
|
<p>
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
{`${rate.price} `}
|
{`${memberRate.price} `}
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
<span>{rate.unit}</span>
|
<span>{memberRate.unit}</span>
|
||||||
</Typography>
|
</Typography>
|
||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
{memberRate ? (
|
) : null}
|
||||||
<div className={`${styles.rateRow} ${styles.highlightedRate}`}>
|
{comparisonRate ? (
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
<div className={`${styles.rateRow} ${styles.comparisonRate}`}>
|
||||||
<p>{memberRate.label}</p>
|
<Typography variant="Title/Subtitle/md">
|
||||||
</Typography>
|
|
||||||
<Typography variant="Title/Subtitle/md">
|
|
||||||
<p>
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
{`${memberRate.price} `}
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
|
||||||
<span>{memberRate.unit}</span>
|
|
||||||
</Typography>
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{comparisonRate ? (
|
|
||||||
<div className={`${styles.rateRow} ${styles.comparisonRate}`}>
|
|
||||||
<Typography variant="Title/Subtitle/md">
|
|
||||||
<p>
|
|
||||||
<span className={styles.strikethrough}>
|
|
||||||
{comparisonRate.price}
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
</span>{' '}
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
|
||||||
<span className={styles.strikethrough}>
|
|
||||||
{comparisonRate.unit}
|
|
||||||
</span>
|
|
||||||
</Typography>
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{approximateRate ? (
|
|
||||||
<div className={`${styles.rateRow} ${styles.approximateRate}`}>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
||||||
<p>{approximateRate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
||||||
<p>
|
|
||||||
{approximateRate.price} {approximateRate.unit}
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
{omnibusRate ? (
|
|
||||||
<footer className={styles.footer}>
|
|
||||||
<Typography variant="Tag/sm">
|
|
||||||
<p>{omnibusRate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Tag/sm">
|
|
||||||
<p>
|
<p>
|
||||||
{omnibusRate.price} {omnibusRate.unit}
|
<span className={styles.strikethrough}>
|
||||||
|
{comparisonRate.price}
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
</span>{' '}
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<span className={styles.strikethrough}>
|
||||||
|
{comparisonRate.unit}
|
||||||
|
</span>
|
||||||
|
</Typography>
|
||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</footer>
|
</div>
|
||||||
|
) : null}
|
||||||
|
{approximateRate ? (
|
||||||
|
<div className={`${styles.rateRow} ${styles.approximateRate}`}>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||||
|
<p>{approximateRate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||||
|
<p>
|
||||||
|
{approximateRate.price} {approximateRate.unit}
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
{omnibusRate ? (
|
||||||
|
<footer className={styles.footer}>
|
||||||
|
<Typography variant="Tag/sm">
|
||||||
|
<p>{omnibusRate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Tag/sm">
|
||||||
|
<p>
|
||||||
|
{omnibusRate.price} {omnibusRate.unit}
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
</footer>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</label>
|
{isSelected && (
|
||||||
|
<MaterialIcon
|
||||||
|
icon="check"
|
||||||
|
size={22}
|
||||||
|
color="Icon/Inverted"
|
||||||
|
className={styles.checkIcon}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import { Typography } from '../../Typography'
|
|||||||
import Modal from '../Modal'
|
import Modal from '../Modal'
|
||||||
import styles from '../rate-card.module.css'
|
import styles from '../rate-card.module.css'
|
||||||
import { variants } from '../variants'
|
import { variants } from '../variants'
|
||||||
|
import { Button as ButtonRAC } from 'react-aria-components'
|
||||||
|
import { cx } from 'class-variance-authority'
|
||||||
|
import { useIntl } from 'react-intl'
|
||||||
|
|
||||||
interface CodeRateCardProps {
|
interface CodeRateCardProps {
|
||||||
name: string
|
id: string
|
||||||
value: string
|
|
||||||
isSelected: boolean
|
isSelected: boolean
|
||||||
rateTitle: string
|
rateTitle: string
|
||||||
paymentTerm: string
|
paymentTerm: string
|
||||||
@@ -24,8 +26,7 @@ interface CodeRateCardProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function CodeRateCard({
|
export default function CodeRateCard({
|
||||||
name,
|
id,
|
||||||
value,
|
|
||||||
isSelected,
|
isSelected,
|
||||||
rateTitle,
|
rateTitle,
|
||||||
paymentTerm,
|
paymentTerm,
|
||||||
@@ -40,119 +41,131 @@ export default function CodeRateCard({
|
|||||||
const classNames = variants({
|
const classNames = variants({
|
||||||
variant: 'Code',
|
variant: 'Code',
|
||||||
})
|
})
|
||||||
|
const intl = useIntl()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label>
|
<div
|
||||||
<input
|
className={cx(classNames, {
|
||||||
className={styles.radio}
|
[styles.selected]: isSelected,
|
||||||
type="radio"
|
})}
|
||||||
name={name}
|
>
|
||||||
value={value}
|
<ButtonRAC
|
||||||
checked={isSelected}
|
onPress={handleChange}
|
||||||
onChange={handleChange}
|
className={styles.buttonOverlay}
|
||||||
|
aria-pressed={isSelected}
|
||||||
|
aria-labelledby={`${id}-title`}
|
||||||
|
aria-describedby={`${id}-details`}
|
||||||
/>
|
/>
|
||||||
<div className={classNames}>
|
<Typography variant="Label/xsBold">
|
||||||
<Typography variant="Label/xsBold">
|
<p className={styles.banner}>{bannerText}</p>
|
||||||
<p className={styles.banner}>{bannerText}</p>
|
</Typography>
|
||||||
</Typography>
|
<div className={styles.container}>
|
||||||
<div className={styles.container}>
|
<Typography variant="Tag/sm">
|
||||||
<header>
|
<h3 className={styles.title}>
|
||||||
<Typography variant="Tag/sm">
|
<Modal
|
||||||
<h3 className={styles.title}>
|
title={rateTitle}
|
||||||
<Modal
|
subtitle={paymentTerm}
|
||||||
title={rateTitle}
|
trigger={
|
||||||
subtitle={paymentTerm}
|
<IconButton
|
||||||
trigger={
|
theme="Black"
|
||||||
<IconButton theme="Black" style="Muted" wrapping>
|
style="Muted"
|
||||||
<MaterialIcon
|
wrapping
|
||||||
icon="info"
|
className={styles.triggerButton}
|
||||||
size={20}
|
aria-label={intl.formatMessage({
|
||||||
color="Icon/Default"
|
id: 'selectRate.rateCard.openReservationPolicy',
|
||||||
/>
|
defaultMessage: 'Open reservation policy',
|
||||||
</IconButton>
|
})}
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{rateTermDetails.map((termGroup) => (
|
<MaterialIcon icon="info" size={20} color="Icon/Default" />
|
||||||
<div key={termGroup.title} className={styles.terms}>
|
</IconButton>
|
||||||
<Typography variant={'Body/Paragraph/mdBold'}>
|
}
|
||||||
<p>{termGroup.title}</p>
|
|
||||||
</Typography>
|
|
||||||
{termGroup.terms.map((term) => (
|
|
||||||
<Typography key={term}>
|
|
||||||
<p className={styles.term}>
|
|
||||||
<MaterialIcon
|
|
||||||
icon="check"
|
|
||||||
color="Icon/Feedback/Success"
|
|
||||||
size={20}
|
|
||||||
className={styles.termsIcon}
|
|
||||||
/>
|
|
||||||
{term}
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</Modal>
|
|
||||||
{rateTitle}
|
|
||||||
<span className={styles.textSecondary}>
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
{` / ${paymentTerm}`}
|
|
||||||
</span>
|
|
||||||
</h3>
|
|
||||||
</Typography>
|
|
||||||
<div className={styles.checkIcon}>
|
|
||||||
<MaterialIcon icon="check" size={22} color="Icon/Inverted" />
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div className={styles.content}>
|
|
||||||
<div
|
|
||||||
className={`${styles.rateRow} ${isHighlightedRate ? styles.highlightedRate : ''}`}
|
|
||||||
>
|
>
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
{rateTermDetails.map((termGroup) => (
|
||||||
<p>{rate.label}</p>
|
<div key={termGroup.title} className={styles.terms}>
|
||||||
</Typography>
|
<Typography variant={'Body/Paragraph/mdBold'}>
|
||||||
|
<p>{termGroup.title}</p>
|
||||||
|
</Typography>
|
||||||
|
{termGroup.terms.map((term) => (
|
||||||
|
<Typography key={term}>
|
||||||
|
<p className={styles.term}>
|
||||||
|
<MaterialIcon
|
||||||
|
icon="check"
|
||||||
|
color="Icon/Feedback/Success"
|
||||||
|
size={20}
|
||||||
|
className={styles.termsIcon}
|
||||||
|
/>
|
||||||
|
{term}
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</Modal>
|
||||||
|
<span id={`${id}-title`}>
|
||||||
|
{rateTitle}
|
||||||
|
<span className={styles.textSecondary}>
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{` / ${paymentTerm}`}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</Typography>
|
||||||
|
<div className={styles.content} id={`${id}-details`}>
|
||||||
|
<div
|
||||||
|
className={`${styles.rateRow} ${isHighlightedRate ? styles.highlightedRate : ''}`}
|
||||||
|
>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<p>{rate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Title/Subtitle/md">
|
||||||
|
<p>
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{`${rate.price} `}
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<span>{rate.unit}</span>
|
||||||
|
</Typography>
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
{comparisonRate ? (
|
||||||
|
<div className={`${styles.rateRow} ${styles.comparisonRate}`}>
|
||||||
<Typography variant="Title/Subtitle/md">
|
<Typography variant="Title/Subtitle/md">
|
||||||
<p>
|
<p>
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
<span className={styles.strikethrough}>
|
||||||
{`${rate.price} `}
|
{comparisonRate.price}
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
</span>{' '}
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
<span>{rate.unit}</span>
|
<span className={styles.strikethrough}>
|
||||||
|
{comparisonRate.unit}
|
||||||
|
</span>
|
||||||
</Typography>
|
</Typography>
|
||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
{comparisonRate ? (
|
) : null}
|
||||||
<div className={`${styles.rateRow} ${styles.comparisonRate}`}>
|
{approximateRate ? (
|
||||||
<Typography variant="Title/Subtitle/md">
|
<div className={`${styles.rateRow} ${styles.approximateRate}`}>
|
||||||
<p>
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||||
<span className={styles.strikethrough}>
|
<p>{approximateRate.label}</p>
|
||||||
{comparisonRate.price}
|
</Typography>
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||||
</span>{' '}
|
<p>
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
{approximateRate.price} {approximateRate.unit}
|
||||||
<span className={styles.strikethrough}>
|
</p>
|
||||||
{comparisonRate.unit}
|
</Typography>
|
||||||
</span>
|
</div>
|
||||||
</Typography>
|
) : null}
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{approximateRate ? (
|
|
||||||
<div className={`${styles.rateRow} ${styles.approximateRate}`}>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
||||||
<p>{approximateRate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
||||||
<p>
|
|
||||||
{approximateRate.price} {approximateRate.unit}
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
{isSelected && (
|
||||||
|
<MaterialIcon
|
||||||
|
icon="check"
|
||||||
|
size={22}
|
||||||
|
color="Icon/Inverted"
|
||||||
|
className={styles.checkIcon}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import { fade, slideInOut } from './motionVariants'
|
|||||||
import styles from './modal.module.css'
|
import styles from './modal.module.css'
|
||||||
import { Typography } from '../../Typography'
|
import { Typography } from '../../Typography'
|
||||||
import { MaterialIcon } from '../../Icons/MaterialIcon'
|
import { MaterialIcon } from '../../Icons/MaterialIcon'
|
||||||
|
import { IconButton } from '../../IconButton'
|
||||||
|
import { useIntl } from 'react-intl'
|
||||||
|
|
||||||
const MotionOverlay = motion.create(ModalOverlay)
|
const MotionOverlay = motion.create(ModalOverlay)
|
||||||
const MotionModal = motion.create(AriaModal)
|
const MotionModal = motion.create(AriaModal)
|
||||||
@@ -35,6 +37,8 @@ function InnerModal({
|
|||||||
subtitle,
|
subtitle,
|
||||||
hideHeader,
|
hideHeader,
|
||||||
}: PropsWithChildren<InnerModalProps>) {
|
}: PropsWithChildren<InnerModalProps>) {
|
||||||
|
const intl = useIntl()
|
||||||
|
|
||||||
function modalStateHandler(newAnimationState: AnimationState) {
|
function modalStateHandler(newAnimationState: AnimationState) {
|
||||||
setAnimation((currentAnimationState) =>
|
setAnimation((currentAnimationState) =>
|
||||||
newAnimationState === AnimationStateEnum.hidden &&
|
newAnimationState === AnimationStateEnum.hidden &&
|
||||||
@@ -86,14 +90,17 @@ function InnerModal({
|
|||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<IconButton
|
||||||
<button
|
theme="Black"
|
||||||
onClick={close}
|
style="Muted"
|
||||||
type="button"
|
onPress={close}
|
||||||
className={styles.close}
|
aria-label={intl.formatMessage({
|
||||||
|
id: 'common.close',
|
||||||
|
defaultMessage: 'Close',
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<MaterialIcon icon="close" color="Icon/Feedback/Neutral" />
|
<MaterialIcon icon="close" size={24} color="CurrentColor" />
|
||||||
</button>
|
</IconButton>
|
||||||
</header>
|
</header>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -53,13 +53,6 @@
|
|||||||
padding: var(--Space-x3);
|
padding: var(--Space-x3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.close {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
.overlay {
|
.overlay {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ type Story = StoryObj<typeof RegularRateCard>
|
|||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {
|
args: {
|
||||||
name: 'regular',
|
|
||||||
value: 'regular',
|
|
||||||
rateTitle: 'FREE CANCELLATION',
|
rateTitle: 'FREE CANCELLATION',
|
||||||
paymentTerm: 'PAY NOW',
|
paymentTerm: 'PAY NOW',
|
||||||
rate: {
|
rate: {
|
||||||
@@ -63,8 +61,6 @@ export const Default: Story = {
|
|||||||
|
|
||||||
export const Selected: Story = {
|
export const Selected: Story = {
|
||||||
args: {
|
args: {
|
||||||
name: 'regular',
|
|
||||||
value: 'regular',
|
|
||||||
isSelected: true,
|
isSelected: true,
|
||||||
rateTitle: 'FREE CANCELLATION',
|
rateTitle: 'FREE CANCELLATION',
|
||||||
paymentTerm: 'PAY NOW',
|
paymentTerm: 'PAY NOW',
|
||||||
@@ -94,8 +90,6 @@ export const Selected: Story = {
|
|||||||
|
|
||||||
export const MemberRateActive: Story = {
|
export const MemberRateActive: Story = {
|
||||||
args: {
|
args: {
|
||||||
name: 'regular',
|
|
||||||
value: 'regular',
|
|
||||||
rateTitle: 'FREE CANCELLATION',
|
rateTitle: 'FREE CANCELLATION',
|
||||||
paymentTerm: 'PAY NOW',
|
paymentTerm: 'PAY NOW',
|
||||||
rate: {
|
rate: {
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import { Typography } from '../../Typography'
|
|||||||
import Modal from '../Modal'
|
import Modal from '../Modal'
|
||||||
import styles from '../rate-card.module.css'
|
import styles from '../rate-card.module.css'
|
||||||
import { variants } from '../variants'
|
import { variants } from '../variants'
|
||||||
|
import { Button as ButtonRAC } from 'react-aria-components'
|
||||||
|
import { cx } from 'class-variance-authority'
|
||||||
|
import { useIntl } from 'react-intl'
|
||||||
|
|
||||||
interface RegularRateCardProps {
|
interface RegularRateCardProps {
|
||||||
name: string
|
id: string
|
||||||
value: string
|
|
||||||
isSelected: boolean
|
isSelected: boolean
|
||||||
rateTitle: string
|
rateTitle: string
|
||||||
paymentTerm: string
|
paymentTerm: string
|
||||||
@@ -23,8 +25,7 @@ interface RegularRateCardProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function RegularRateCard({
|
export default function RegularRateCard({
|
||||||
name,
|
id,
|
||||||
value,
|
|
||||||
isSelected,
|
isSelected,
|
||||||
rateTitle,
|
rateTitle,
|
||||||
paymentTerm,
|
paymentTerm,
|
||||||
@@ -37,141 +38,153 @@ export default function RegularRateCard({
|
|||||||
rateTermDetails,
|
rateTermDetails,
|
||||||
}: RegularRateCardProps) {
|
}: RegularRateCardProps) {
|
||||||
const classNames = variants({ variant: 'Regular' })
|
const classNames = variants({ variant: 'Regular' })
|
||||||
|
|
||||||
|
const intl = useIntl()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label>
|
<div
|
||||||
<input
|
className={cx(classNames, {
|
||||||
className={styles.radio}
|
[styles.selected]: isSelected,
|
||||||
type="radio"
|
})}
|
||||||
name={name}
|
>
|
||||||
value={value}
|
<ButtonRAC
|
||||||
checked={isSelected}
|
onPress={handleChange}
|
||||||
onChange={handleChange}
|
className={styles.buttonOverlay}
|
||||||
|
aria-pressed={isSelected}
|
||||||
|
aria-labelledby={`${id}-title`}
|
||||||
|
aria-describedby={`${id}-details`}
|
||||||
/>
|
/>
|
||||||
<div className={classNames}>
|
<div className={styles.container}>
|
||||||
<div className={styles.container}>
|
<Typography variant="Tag/sm">
|
||||||
<header>
|
<h3 className={styles.title}>
|
||||||
<Typography variant="Tag/sm">
|
<Modal
|
||||||
<h3 className={styles.title}>
|
title={rateTitle}
|
||||||
<Modal
|
subtitle={paymentTerm}
|
||||||
title={rateTitle}
|
trigger={
|
||||||
subtitle={paymentTerm}
|
<IconButton
|
||||||
trigger={
|
theme="Black"
|
||||||
<IconButton theme="Black" style="Muted" wrapping>
|
style="Muted"
|
||||||
<MaterialIcon
|
wrapping
|
||||||
icon="info"
|
className={styles.triggerButton}
|
||||||
size={20}
|
aria-label={intl.formatMessage({
|
||||||
color="Icon/Default"
|
id: 'selectRate.rateCard.openReservationPolicy',
|
||||||
/>
|
defaultMessage: 'Open reservation policy',
|
||||||
</IconButton>
|
})}
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{rateTermDetails.map((termGroup) => (
|
<MaterialIcon icon="info" size={20} color="Icon/Default" />
|
||||||
<div key={termGroup.title} className={styles.terms}>
|
</IconButton>
|
||||||
<Typography variant={'Body/Paragraph/mdBold'}>
|
}
|
||||||
<p>{termGroup.title}</p>
|
>
|
||||||
</Typography>
|
{rateTermDetails.map((termGroup) => (
|
||||||
{termGroup.terms.map((term) => (
|
<div key={termGroup.title} className={styles.terms}>
|
||||||
<Typography key={term}>
|
<Typography variant={'Body/Paragraph/mdBold'}>
|
||||||
<p className={styles.term}>
|
<p>{termGroup.title}</p>
|
||||||
<MaterialIcon
|
</Typography>
|
||||||
icon="check"
|
{termGroup.terms.map((term) => (
|
||||||
color="Icon/Feedback/Success"
|
<Typography key={term}>
|
||||||
size={20}
|
<p className={styles.term}>
|
||||||
className={styles.termsIcon}
|
<MaterialIcon
|
||||||
/>
|
icon="check"
|
||||||
{term}
|
color="Icon/Feedback/Success"
|
||||||
</p>
|
size={20}
|
||||||
</Typography>
|
className={styles.termsIcon}
|
||||||
))}
|
/>
|
||||||
</div>
|
{term}
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
))}
|
))}
|
||||||
</Modal>
|
|
||||||
{rateTitle}
|
|
||||||
<span className={styles.textSecondary}>
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
{` / ${paymentTerm}`}
|
|
||||||
</span>
|
|
||||||
</h3>
|
|
||||||
</Typography>
|
|
||||||
<div className={styles.checkIcon}>
|
|
||||||
<MaterialIcon icon="check" size={22} color="Icon/Inverted" />
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div>
|
|
||||||
{!isMemberRateActive && rate ? (
|
|
||||||
<div className={styles.rateRow}>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
|
||||||
<p>{rate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Title/Subtitle/md">
|
|
||||||
<p>
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
{`${rate.price} `}
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
|
||||||
<span>{rate.unit}</span>
|
|
||||||
</Typography>
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{memberRate ? (
|
|
||||||
<div className={`${styles.rateRow} ${styles.highlightedRate}`}>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
|
||||||
<p>{memberRate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Title/Subtitle/md">
|
|
||||||
<span>
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
{`${memberRate.price} `}
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smBold">
|
|
||||||
<span>{memberRate.unit}</span>
|
|
||||||
</Typography>
|
|
||||||
</span>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{isMemberRateActive && rate ? (
|
|
||||||
<Typography variant="Body/Paragraph/mdRegular">
|
|
||||||
<div
|
|
||||||
className={`${styles.rateRow} ${styles.strikeThroughRate}`}
|
|
||||||
>
|
|
||||||
<s>
|
|
||||||
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
||||||
{`${rate.price} `}
|
|
||||||
<Typography variant="Tag/sm">
|
|
||||||
<span>{rate.unit}</span>
|
|
||||||
</Typography>
|
|
||||||
</s>
|
|
||||||
</div>
|
</div>
|
||||||
|
))}
|
||||||
|
</Modal>
|
||||||
|
<span id={`${id}-title`}>
|
||||||
|
{rateTitle}
|
||||||
|
<span className={styles.textSecondary}>
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{` / ${paymentTerm}`}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</Typography>
|
||||||
|
<div id={`${id}-details`}>
|
||||||
|
{!isMemberRateActive && rate ? (
|
||||||
|
<div className={styles.rateRow}>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<p>{rate.label}</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
) : null}
|
<Typography variant="Title/Subtitle/md">
|
||||||
{approximateRate ? (
|
|
||||||
<div className={`${styles.rateRow} ${styles.approximateRate}`}>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
||||||
<p>{approximateRate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
||||||
<p>
|
|
||||||
{approximateRate.price} {approximateRate.unit}
|
|
||||||
</p>
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
{omnibusRate ? (
|
|
||||||
<footer className={styles.footer}>
|
|
||||||
<Typography variant="Tag/sm">
|
|
||||||
<p>{omnibusRate.label}</p>
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="Tag/sm">
|
|
||||||
<p>
|
<p>
|
||||||
{omnibusRate.price} {omnibusRate.unit}
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{`${rate.price} `}
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<span>{rate.unit}</span>
|
||||||
|
</Typography>
|
||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</footer>
|
</div>
|
||||||
|
) : null}
|
||||||
|
{memberRate ? (
|
||||||
|
<div className={`${styles.rateRow} ${styles.highlightedRate}`}>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<p>{memberRate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Title/Subtitle/md">
|
||||||
|
<span>
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{`${memberRate.price} `}
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smBold">
|
||||||
|
<span>{memberRate.unit}</span>
|
||||||
|
</Typography>
|
||||||
|
</span>
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
{isMemberRateActive && rate ? (
|
||||||
|
<Typography variant="Body/Paragraph/mdRegular">
|
||||||
|
<div className={`${styles.rateRow} ${styles.strikeThroughRate}`}>
|
||||||
|
<s>
|
||||||
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
|
{`${rate.price} `}
|
||||||
|
<Typography variant="Tag/sm">
|
||||||
|
<span>{rate.unit}</span>
|
||||||
|
</Typography>
|
||||||
|
</s>
|
||||||
|
</div>
|
||||||
|
</Typography>
|
||||||
|
) : null}
|
||||||
|
{approximateRate ? (
|
||||||
|
<div className={`${styles.rateRow} ${styles.approximateRate}`}>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||||
|
<p>{approximateRate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||||
|
<p>
|
||||||
|
{approximateRate.price} {approximateRate.unit}
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
{omnibusRate ? (
|
||||||
|
<footer className={styles.footer}>
|
||||||
|
<Typography variant="Tag/sm">
|
||||||
|
<p>{omnibusRate.label}</p>
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="Tag/sm">
|
||||||
|
<p>
|
||||||
|
{omnibusRate.price} {omnibusRate.unit}
|
||||||
|
</p>
|
||||||
|
</Typography>
|
||||||
|
</footer>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</label>
|
{isSelected && (
|
||||||
|
<MaterialIcon
|
||||||
|
icon="check"
|
||||||
|
size={22}
|
||||||
|
color="Icon/Inverted"
|
||||||
|
className={styles.checkIcon}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,3 @@
|
|||||||
.radio {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px;
|
|
||||||
height: 1px;
|
|
||||||
padding: 0;
|
|
||||||
margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkIcon {
|
.checkIcon {
|
||||||
--size: 32px;
|
--size: 32px;
|
||||||
width: var(--size);
|
width: var(--size);
|
||||||
@@ -33,23 +21,30 @@
|
|||||||
background-color: var(--Scandic-Grey-00);
|
background-color: var(--Scandic-Grey-00);
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: var(--Corner-radius-md);
|
border-radius: var(--Corner-radius-md);
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rateCard:hover {
|
.buttonOverlay {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: var(--Corner-radius-md);
|
||||||
|
z-index: 1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
outline: 2px solid var(--Border-Interactive-Focus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.rateCard:hover {
|
||||||
background-color: var(--Scandic-Grey-10);
|
background-color: var(--Scandic-Grey-10);
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio:checked ~ .rateCard {
|
.rateCard.selected {
|
||||||
border: 1px solid var(--Scandic-Peach-80, 'black');
|
border-color: var(--Border-Interactive-Active);
|
||||||
}
|
|
||||||
|
|
||||||
.radio:focus-visible ~ .rateCard {
|
|
||||||
outline: 2px solid var(--Border-Interactive-Focus);
|
|
||||||
}
|
|
||||||
|
|
||||||
label:not(:has(.radio:checked)) .checkIcon {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
@@ -67,8 +62,13 @@ label:not(:has(.radio:checked)) .checkIcon {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: var(--Space-x1);
|
gap: var(--Space-x1);
|
||||||
padding: var(--Space-x1) var(--Space-x15) var(--Space-x15);
|
padding: var(--Space-x1) var(--Space-x15) var(--Space-x15);
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.triggerButton {
|
||||||
|
cursor: pointer;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
.container > * {
|
.container > * {
|
||||||
padding-bottom: var(--Space-x1);
|
padding-bottom: var(--Space-x1);
|
||||||
border-bottom: 2px solid var(--Neutral-Opacity-Black-5);
|
border-bottom: 2px solid var(--Neutral-Opacity-Black-5);
|
||||||
|
|||||||
Reference in New Issue
Block a user