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
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"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>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
.logoLink {
|
||||
display: inline-flex;
|
||||
width: auto;
|
||||
}
|
||||
Reference in New Issue
Block a user