fix: mobile menu

This commit is contained in:
Benno Tielen 2025-02-11 10:17:37 +01:00
parent 81614e4449
commit 98348f2627
3 changed files with 18 additions and 5 deletions

View file

@ -14,7 +14,7 @@ export const Default: Story = {
leftItems: [ leftItems: [
{ {
text: 'Home', text: 'Home',
href: '/' href: 'https://disney.com'
}, },
{ {
text: 'Gemeinschaft finden', text: 'Gemeinschaft finden',

View file

@ -9,6 +9,7 @@ import { Logo } from '@/components/Logo/Logo'
import { useCallback, useState } from 'react' import { useCallback, useState } from 'react'
import { MegaMenu } from '@/components/MegaMenu/MegaMenu' import { MegaMenu } from '@/components/MegaMenu/MegaMenu'
import { CollapsibleArrow } from '@/components/CollapsibleArrow/CollapsibleArrow' import { CollapsibleArrow } from '@/components/CollapsibleArrow/CollapsibleArrow'
import Link from 'next/link'
type MenuItemProps = MenuItemType & { type MenuItemProps = MenuItemType & {
onItemClick?: () => void onItemClick?: () => void
@ -30,13 +31,16 @@ const MenuItem = ({text, href, display = "normal", megaMenu, onItemClick}: MenuI
return ( return (
<span <span
className={styles.menuItem}
onMouseEnter={() => setIsActive(true)} onMouseEnter={() => setIsActive(true)}
onMouseLeave={() => setIsActive(false)} onMouseLeave={() => setIsActive(false)}
> >
<a className={className} href={href}> <Link
className={className}
href={href || ""}
onClick={() => href ? itemClicked() : setIsActive(!isActive)}
>
{text} {megaMenu && <CollapsibleArrow direction={isActive ? "UP" : "DOWN"} stroke={1.5} /> } {text} {megaMenu && <CollapsibleArrow direction={isActive ? "UP" : "DOWN"} stroke={1.5} /> }
</a> </Link>
{megaMenu && {megaMenu &&
<div <div
@ -92,7 +96,12 @@ export const Menu = ({menu}: MenuProps) => {
<> <>
<nav className={classNames(styles.nav, {[styles.full]: displayMenuMobile})}> <nav className={classNames(styles.nav, {[styles.full]: displayMenuMobile})}>
<div className={styles.navMobile}> <div className={styles.navMobile}>
<Logo withText={false} height={30} color={"#426156"}/> <Link
href={"/"} onClick={() => setDisplayMenuMobile(false)}
className={styles.logoLink}
>
<Logo withText={false} height={30} color={"#426156"}/>
</Link>
<Image <Image
src={MenuIcon} src={MenuIcon}
width={25} width={25}

View file

@ -60,6 +60,10 @@
cursor: pointer; cursor: pointer;
} }
.logoLink {
height: 30px;
}
.megaMenu { .megaMenu {
position: fixed; position: fixed;
top: 62px; top: 62px;