Files
web/packages/design-system/lib/components/LoginButton/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

32 lines
691 B
TypeScript

'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>
)
}