sendou.ink/app/components/Layout/MobileMenu.tsx
Kalle 03da81a84c
New navigation (#821)
* Menu skeleton

* Menu with nav icons

* Menu opens and closes

* More menu icons + links work

* Menu closes on navigation

* Blurred menu

* Remove other nav

* Rounded nav

* Fix menu alignment for Safari

* Close on click outside

* Disable body scroll when menu open

* SubNav for tournament

* Use grid

* Make images same size again

* Remove comment

* Different style mobile nav

* Readd InfoBanner elements

* Move menu css to layout.css

* Move admin command input top left

* Page title from loader

* Fix error when getting pageTitle

* Fix CI
2022-04-30 11:10:09 +03:00

50 lines
1.5 KiB
TypeScript

import clsx from "clsx";
import { Fragment } from "react";
import { Link } from "@remix-run/react";
import { navItemsGrouped } from "~/constants";
export function MobileMenu({
expanded,
closeMenu,
}: {
expanded: boolean;
closeMenu: () => void;
}) {
return (
<div className={clsx("layout__mobile-nav", { expanded })}>
<div className="layout__mobile-nav__top-action">
{/* <SearchInput /> */}
</div>
<div className="layout__mobile-nav__links">
{navItemsGrouped.map((navGroup) => (
<Fragment key={navGroup.title}>
<div className="layout__mobile-nav__group-title">
{navGroup.title}
</div>
{navGroup.items.map((navItem, i) => (
<Link
key={navItem.name}
className={clsx("layout__mobile-nav__link", {
first: i === 0,
last: i + 1 === navGroup.items.length,
})}
to={navItem.disabled ? "/" : navItem.url ?? navItem.name}
onClick={closeMenu}
data-cy={`mobile-nav-link-${navItem.name}`}
>
<img
className={clsx("layout__mobile-nav__link__icon", {
disabled: navItem.disabled,
})}
src={`/img/layout/${navItem.name.replace(" ", "")}.webp`}
/>
<div>{navItem.displayName ?? navItem.name}</div>
</Link>
))}
</Fragment>
))}
</div>
</div>
);
}