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:
Erik Tiekstra
2025-02-27 14:20:47 +00:00
parent 6e9123aca9
commit af7c5853db
6 changed files with 52 additions and 42 deletions

View File

@@ -1,11 +1,7 @@
import NextLink from "next/link"
import { Suspense } from "react"
import Image from "@/components/Image"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { NavigationMenuListSkeleton } from "./NavigationMenu/NavigationMenuList"
import { LogoLink } from "./LogoLink"
import { MobileMenuSkeleton } from "./MobileMenu"
import MobileMenuWrapper from "./MobileMenuWrapper"
import MyPagesMenuWrapper, {
@@ -19,9 +15,7 @@ export default function MainMenu() {
return (
<div className={styles.mainMenu}>
<nav className={styles.nav}>
<Suspense fallback={<Logo alt="..." />}>
<MainMenuLogo />
</Suspense>
<LogoLink />
<div className={styles.menus}>
<Suspense fallback={<NavigationMenuListSkeleton />}>
<NavigationMenu isMobile={false} />
@@ -39,26 +33,3 @@ export default function MainMenu() {
</div>
)
}
async function MainMenuLogo() {
const intl = await getIntl()
return <Logo alt={intl.formatMessage({ id: "Back to scandichotels.com" })} />
}
function Logo({ alt }: { alt: string }) {
const lang = getLang()
return (
<NextLink className={styles.logoLink} href={`/${lang}`}>
<Image
alt={alt}
className={styles.logo}
height={22}
src="/_static/img/scandic-logotype.svg"
priority
width={103}
/>
</NextLink>
)
}