fix: mobile menu
This commit is contained in:
parent
81614e4449
commit
98348f2627
3 changed files with 18 additions and 5 deletions
|
|
@ -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',
|
||||||
|
|
|
||||||
|
|
@ -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}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,10 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logoLink {
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
.megaMenu {
|
.megaMenu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 62px;
|
top: 62px;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue