Feat/BOOK-529 update GLA design mystay * feat(BOOK-529): update gla design on my stay * feat(BOOK-529): open gla modal if error * feat(BOOK-529): add inline accordion to storybook * feat(529): move errormessage below message * feat(529): update infomodal * feat(BOOK-529): update infomodal * feat(BOOK-529): hide guarantee info for adding ancillaries if prepaid * feat(BOOK-529): update width on info dialog * feat(BOOK-529): fix alignment * feat(BOOK-529): check if member price * feat(BOOK-529): refactor msg * feat(BOOK-529): refactor terms and conditions to own component * feat(BOOK-529): clean up confirmation step Approved-by: Christel Westerberg
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { cx } from 'class-variance-authority'
|
|
import { Label, Radio } from 'react-aria-components'
|
|
|
|
import styles from './paymentOption.module.css'
|
|
|
|
import type { PaymentMethodEnum } from '@scandic-hotels/common/constants/paymentMethod'
|
|
|
|
import { PaymentMethodIcon } from '../../Payment/PaymentMethodIcon'
|
|
import { Typography } from '../../Typography'
|
|
|
|
export type PaymentOptionProps = {
|
|
value: PaymentMethodEnum
|
|
label: string
|
|
cardNumber?: string
|
|
hideRadioButton?: boolean
|
|
}
|
|
export function PaymentOption({
|
|
value,
|
|
label,
|
|
cardNumber,
|
|
hideRadioButton = false,
|
|
}: PaymentOptionProps) {
|
|
return (
|
|
<Radio
|
|
value={value}
|
|
className={({ isFocusVisible }) =>
|
|
cx(styles.paymentOption, { [styles.focused]: isFocusVisible })
|
|
}
|
|
>
|
|
{({ isSelected }) => (
|
|
<>
|
|
<div className={styles.titleContainer}>
|
|
{!hideRadioButton && (
|
|
<span
|
|
className={cx(styles.radio, { [styles.selected]: isSelected })}
|
|
aria-hidden
|
|
/>
|
|
)}
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<Label>{label}</Label>
|
|
</Typography>
|
|
</div>
|
|
{cardNumber ? (
|
|
<>
|
|
<Typography variant={'Body/Supporting text (caption)/smRegular'}>
|
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
<span>•••• {cardNumber}</span>
|
|
</Typography>
|
|
</>
|
|
) : (
|
|
<PaymentMethodIcon paymentMethod={value} alt={label} />
|
|
)}
|
|
</>
|
|
)}
|
|
</Radio>
|
|
)
|
|
}
|