Files
web/apps/scandic-web/components/Sidebar/JoinLoyalty/index.tsx
Hrishikesh Vaipurkar 260a544c99 Merged in chore/SW-3381-move-loginbutton-to-ds- (pull request #2752)
chore(SW-3381) Moved LoginButton to design system

* chore(SW-3381) Moved LoginButton to design system


Approved-by: Anton Gunnarsson
2025-09-03 09:11:28 +00:00

68 lines
2.1 KiB
TypeScript

import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { ScandicFriends } from "@/components/Levels"
import { getIntl } from "@/i18n"
import { isLoggedInUser } from "@/utils/isLoggedInUser"
import Contact from "./Contact"
import { LoyaltyLoginButton } from "./LoyaltyLoginButton"
import ReadMore from "./ReadMore"
import styles from "./joinLoyalty.module.css"
import type { JoinLoyaltyContactProps } from "@/types/components/sidebar/joinLoyaltyContact"
export default async function JoinLoyaltyContact({
block,
}: JoinLoyaltyContactProps) {
const [intl, isLoggedIn] = await Promise.all([getIntl(), isLoggedInUser()])
if (isLoggedIn) {
return null
}
return (
<section className={styles.joinLoyaltyContainer}>
<article className={styles.wrapper}>
{block.title ? (
<Typography variant={"Title/Subtitle/md"}>
<h4 className={styles.title}>{block.title}</h4>
</Typography>
) : null}
<ScandicFriends color="red" />
{block.preamble ? (
<Typography variant={"Body/Paragraph/mdRegular"}>
<p className={styles.preamble}>{block.preamble}</p>
</Typography>
) : null}
{block.button ? (
<Typography variant={"Body/Paragraph/mdBold"}>
<ButtonLink
className={styles.button}
size={"Small"}
wrapping
href={block.button.href}
target={block.button.openInNewTab ? "_blank" : "_self"}
>
{block.button.title}
</ButtonLink>
</Typography>
) : null}
<section className={styles.loginContainer}>
<Typography variant={"Body/Paragraph/mdRegular"}>
<p>
{intl.formatMessage({
defaultMessage: "Already a friend?",
})}
</p>
</Typography>
<LoyaltyLoginButton />
</section>
</article>
{block.contact ? <Contact contactBlock={block.contact} /> : null}
<ReadMore />
</section>
)
}