diff --git a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoLoginButton.tsx b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoLoginButton.tsx new file mode 100644 index 000000000..19cbf85e8 --- /dev/null +++ b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoLoginButton.tsx @@ -0,0 +1,31 @@ +"use client" + +import { useIntl } from "react-intl" + +import { login } from "@scandic-hotels/common/constants/routes/handleAuth" +import { useLazyPathname } from "@scandic-hotels/common/hooks/useLazyPathname" +import ButtonLink from "@scandic-hotels/design-system/ButtonLink" + +import useLang from "@/hooks/useLang" + +export default function PromoLoginButton() { + const lang = useLang() + const intl = useIntl() + const pathname = useLazyPathname() + const loginHref = pathname + ? `${login[lang]}?redirectTo=${encodeURIComponent(pathname)}` + : login[lang] + + return ( + + {intl.formatMessage({ + defaultMessage: "Log in", + })} + + ) +} diff --git a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx index 74bb0f96b..4694af7e4 100644 --- a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx +++ b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx @@ -1,6 +1,5 @@ import { cx } from "class-variance-authority" -import { login } from "@scandic-hotels/common/constants/routes/handleAuth" import { signup } from "@scandic-hotels/common/constants/routes/signup" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Divider } from "@scandic-hotels/design-system/Divider" @@ -15,6 +14,7 @@ import { getLang } from "@/i18n/serverContext" import ActivateOfferButton from "./ActivateOfferButton" import IneligibleMessage from "./IneligibleMessage" +import PromoLoginButton from "./PromoLoginButton" import { isUserEligibleForPromo } from "./utils" import styles from "./hero.module.css" @@ -110,16 +110,7 @@ export default async function PromoCampaignHero({ })}

- - {intl.formatMessage({ - defaultMessage: "Log in", - })} - +