Files
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

119 lines
2.8 KiB
TypeScript

"use client"
import { useIntl } from "react-intl"
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useBookingFlowConfig } from "../../bookingFlowConfig/bookingFlowConfigContext"
import styles from "./signupPromo.module.css"
type SignupPromoProps = {
memberPrice: {
amount: number
currency: string
}
badgeContent?: string
isEnterDetailsPage?: boolean
}
export default function SignupPromoDesktop({
memberPrice,
badgeContent,
isEnterDetailsPage = false,
}: SignupPromoProps) {
const intl = useIntl()
if (!memberPrice) {
return null
}
const { amount, currency } = memberPrice
const price = formatPrice(intl, amount, currency)
return memberPrice ? (
<div
className={styles.memberDiscountBannerDesktop}
data-testid="signup-promo-desktop"
>
{badgeContent && <span className={styles.badge}>{badgeContent}</span>}
<Typography variant="Body/Supporting text (caption)/smRegular">
<p>
<Message price={price} isEnterDetailsPage={isEnterDetailsPage} />
</p>
</Typography>
</div>
) : null
}
function Message({
price,
isEnterDetailsPage,
}: {
price: string
isEnterDetailsPage: boolean
}) {
const intl = useIntl()
const config = useBookingFlowConfig()
if (config.variant === "partner-sas") {
return intl.formatMessage(
{
id: "signup.toGetTheScandicMemberPriceWithValue",
defaultMessage:
"To get the Scandic member price <span>{price}</span>, enter your ID or join while booking.",
},
{
span: (str) => (
<Typography
variant="Body/Supporting text (caption)/smBold"
className={styles.red}
>
<span>{str}</span>
</Typography>
),
price,
}
)
}
if (isEnterDetailsPage) {
return intl.formatMessage(
{
id: "signup.toGetTheMemberRoomPrice",
defaultMessage:
"To get the member room price <span>{price}</span>, log in or join when completing the booking.",
},
{
span: (str) => (
<Typography
variant="Body/Supporting text (caption)/smBold"
className={styles.red}
>
<span>{str}</span>
</Typography>
),
price,
}
)
}
return intl.formatMessage(
{
id: "signup.toGetTheMemberPrice",
defaultMessage:
"To get the member price <span>{price}</span>, log in or join when completing the booking.",
},
{
span: (str) => (
<Typography
variant="Body/Supporting text (caption)/smBold"
className={styles.red}
>
<span>{str}</span>
</Typography>
),
price,
}
)
}