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:
31
packages/design-system/lib/components/LoginButton/index.tsx
Normal file
31
packages/design-system/lib/components/LoginButton/index.tsx
Normal 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>
|
||||
)
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user