Files
web/packages/design-system/lib/components/LoginButton/index.tsx
Joakim Jäderberg 7dee6d5083 Merged in chore/move-enter-details (pull request #2778)
Chore/move enter details

Approved-by: Anton Gunnarsson
2025-09-11 07:16:24 +00:00

32 lines
699 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,
redirectTo,
trackingId,
children,
...props
}: PropsWithChildren<
{
lang: Lang
redirectTo: string | null
trackingId: string
} & Omit<LinkProps, 'href'>
>) {
const href = redirectTo
? `${login[lang]}?redirectTo=${encodeURIComponent(redirectTo)}`
: login[lang]
return (
<Link id={trackingId} href={href} prefetch={false} {...props}>
{children}
</Link>
)
}