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

@@ -0,0 +1,31 @@
'use client'
import Link, { type LinkProps } from '../Link'
import { login } from '@scandic-hotels/common/constants/routes/handleAuth'
import type { PropsWithChildren } from 'react'
import type { Lang } from '@scandic-hotels/common/constants/language'
export function LoginButton({
lang,
pathName,
trackingId,
children,
...props
}: PropsWithChildren<
{
lang: Lang
pathName: string | null
trackingId: string
} & Omit<LinkProps, 'href'>
>) {
const href = pathName
? `${login[lang]}?redirectTo=${encodeURIComponent(pathName)}`
: login[lang]
return (
<Link id={trackingId} href={href} prefetch={false} {...props}>
{children}
</Link>
)
}

View File

@@ -133,6 +133,7 @@
"./Lightbox": "./lib/components/Lightbox/index.tsx",
"./Link": "./lib/components/Link/index.tsx",
"./LoadingSpinner": "./lib/components/LoadingSpinner/index.tsx",
"./LoginButton": "./lib/components/LoginButton/index.tsx",
"./Map/InteractiveMap": "./lib/components/Map/InteractiveMap/index.tsx",
"./Map/mapConstants": "./lib/components/Map/mapConstants.ts",
"./Map/Markers/HotelMarkerByType": "./lib/components/Map/Markers/HotelMarkerByType.tsx",