31 lines
758 B
TypeScript
31 lines
758 B
TypeScript
"use client"
|
|
|
|
import { usePathname } from "next/navigation"
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { login } from "@/constants/routes/handleAuth"
|
|
|
|
import Link from "@/components/TempDesignSystem/Link"
|
|
|
|
import type { TrackableLoginId } from "@/types/components/tracking"
|
|
import { LangParams } from "@/types/params"
|
|
|
|
export default function LoginButton({
|
|
className,
|
|
trackingId,
|
|
lang,
|
|
}: LangParams & { className: string; trackingId: TrackableLoginId }) {
|
|
const { formatMessage } = useIntl()
|
|
const pathName = usePathname()
|
|
|
|
return (
|
|
<Link
|
|
href={`${login[lang]}?redirectTo=${encodeURIComponent(`/${lang}${pathName}`)}`}
|
|
className={className}
|
|
id={trackingId}
|
|
>
|
|
{formatMessage({ id: "Log in" })}
|
|
</Link>
|
|
)
|
|
}
|