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
This commit is contained in:
Hrishikesh Vaipurkar
2025-09-03 09:11:28 +00:00
parent ca408bbbb5
commit 260a544c99
23 changed files with 165 additions and 118 deletions

View File

@@ -1,13 +1,15 @@
import { logout } from "@scandic-hotels/common/constants/routes/handleAuth"
import { overview } from "@scandic-hotels/common/constants/routes/myPages"
import Link from "@scandic-hotels/design-system/Link"
import { LoginButton } from "@scandic-hotels/design-system/LoginButton"
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
import { logout } from "@/constants/routes/handleAuth"
import { getName } from "@/lib/trpc/memoizedRequests"
import LoginButton from "@/components/LoginButton"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { getPathname } from "@/utils/getPathname"
import { trackLoginClick } from "@/utils/tracking"
import styles from "./topMenu.module.css"
@@ -26,6 +28,7 @@ export default async function TopMenu({
const intl = await getIntl()
const user = await getName()
const lang = await getLang()
const pathname = await getPathname()
return (
<div className={styles.topMenu}>
@@ -71,10 +74,14 @@ export default async function TopMenu({
</>
) : (
<LoginButton
position="hamburger menu"
lang={lang}
pathName={pathname}
trackingId="loginStartTopMenu"
className={`${styles.sessionLink} ${styles.loginLink}`}
size="small"
onClick={() => {
trackLoginClick("hamburger menu")
}}
>
{intl.formatMessage({
defaultMessage: "Log in",
@@ -91,6 +98,8 @@ export default async function TopMenu({
export async function TopMenuSkeleton() {
const intl = await getIntl()
const links = new Array(5).fill("")
const lang = await getLang()
const pathname = await getPathname()
return (
<div className={styles.topMenu}>
<div className={styles.container}>
@@ -102,10 +111,14 @@ export async function TopMenuSkeleton() {
))}
<li className={styles.sessionContainer}>
<LoginButton
position="hamburger menu"
lang={lang}
pathName={pathname}
trackingId="loginStartTopMenu"
className={`${styles.sessionLink} ${styles.loginLink}`}
size="small"
onClick={() => {
trackLoginClick("hamburger menu")
}}
>
{intl.formatMessage({
defaultMessage: "Log in",