Files
web/packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx
Erik Tiekstra b3c4761ae5 Merged in chore/BOOK-773-replace-old-typography-variables (pull request #3515)
Chore/BOOK-773 replace old typography variables

* chore(BOOK-773): Replaced body typography

* chore(BOOK-773): Replaced caption typography

* chore(BOOK-773): Replaced footnote typography

* chore(BOOK-773): Replaced subtitle typography


Approved-by: Bianca Widstam
2026-02-03 15:07:18 +00:00

110 lines
3.6 KiB
TypeScript

"use client"
import { useIntl } from "react-intl"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
import { TextLink } from "@scandic-hotels/design-system/TextLink"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useBookingFlowConfig } from "../../../../../bookingFlowConfig/bookingFlowConfigContext"
import { useRoomContext } from "../../../../../contexts/EnterDetails/RoomContext"
import useLang from "../../../../../hooks/useLang"
import styles from "./joinScandicFriendsCard.module.css"
type JoinScandicFriendsCardProps = {
name?: string
}
export default function JoinScandicFriendsCard({
name = "join",
}: JoinScandicFriendsCardProps) {
const lang = useLang()
const intl = useIntl()
const { routes } = useBookingFlowConfig()
const {
room,
roomNr,
actions: { updateJoin },
} = useRoomContext()
function onChange(event: { target: { value: boolean } }) {
updateJoin(event.target.value)
}
if (!("member" in room.roomRate) || !room.roomRate.member) {
return null
}
return (
<div className={styles.cardContainer}>
<Typography variant="Title/Subtitle/md">
<h2 className={styles.priceContainer}>
<span>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{`${intl.formatMessage({
id: "enterDetails.joinScandicFriendsCard.title",
defaultMessage: "Get the member room price",
})}: `}
</span>
<span className={styles.price}>
{intl.formatMessage(
{
id: "enterDetails.joinScandicFriendsCard.priceForRoom",
defaultMessage: "{amount} for room {roomNr}",
},
{
amount: formatPrice(
intl,
room.roomRate.member.localPrice.pricePerStay ?? 0,
room.roomRate.member.localPrice.currency ??
CurrencyEnum.Unknown
),
roomNr,
}
)}
</span>
</h2>
</Typography>
<Checkbox
name={name}
className={styles.checkBox}
registerOptions={{ onChange, value: room.guest.join }}
>
<Typography variant="Body/Paragraph/mdRegular">
<div>
{intl.formatMessage({
id: "enterDetails.joinScandicFriendsCard.joinBeforeCheckinCheckboxLabel",
defaultMessage: "Join Scandic Friends before check-in",
})}
</div>
</Typography>
</Checkbox>
<Typography variant="Body/Supporting text (caption)/smRegular">
<p className={styles.terms}>
{intl.formatMessage(
{
id: "enterDetails.joinScandicFriendsCard.terms",
defaultMessage:
"By joining you accept the <termsAndConditionsLink>Terms and Conditions</termsAndConditionsLink>. The Scandic Friends Membership is valid until further notice, but can at any time be terminated by contacting Scandic Customer Service.",
},
{
termsAndConditionsLink: (str) => (
<TextLink
typography="Link/sm"
target="_blank"
href={routes.membershipTermsAndConditions[lang]}
>
{str}
</TextLink>
),
}
)}
</p>
</Typography>
</div>
)
}