Files
web/apps/scandic-web/components/Header/MainMenu/LogoLink/index.tsx
Erik Tiekstra af7c5853db Merged in fix/SW-1742-navigation-on-mobile (pull request #1436)
fix(SW-1742): fixed issue where mobile menu is not closed when clicking on a link

* fix(SW-1742): fixed issue where mobile menu is not closed when clicking on a link


Approved-by: Fredrik Thorsson
Approved-by: Matilda Landström
2025-02-27 14:20:47 +00:00

36 lines
901 B
TypeScript

"use client"
import NextLink from "next/link"
import { useIntl } from "react-intl"
import useDropdownStore from "@/stores/main-menu"
import { ScandicLogoIcon } from "@/components/Icons"
import useLang from "@/hooks/useLang"
import styles from "./logoLink.module.css"
import { DropdownTypeEnum } from "@/types/components/dropdown/dropdown"
export function LogoLink() {
const lang = useLang()
const intl = useIntl()
const { toggleDropdown, isHamburgerMenuOpen } = useDropdownStore()
function handleNavigate() {
if (isHamburgerMenuOpen) {
toggleDropdown(DropdownTypeEnum.HamburgerMenu)
}
}
return (
<NextLink
className={styles.logoLink}
href={`/${lang}`}
onClick={handleNavigate}
aria-label={intl.formatMessage({ id: "Back to scandichotels.com" })}
>
<ScandicLogoIcon width="103px" height="22px" color="red" />
</NextLink>
)
}