import { memo } from "react"; import { useRouter } from "next/router"; import MenuItem from "../MenuItem/MenuItem"; import { styled } from "../../lib/styles/stitches.config"; import { menuItems } from "../../lib/config/menu"; import type { ComponentProps } from "react"; const Wrapper = styled("ul", { display: "inline-flex", padding: 0, margin: 0, "@mobile": { width: "100%", justifyContent: "space-between", marginLeft: "1em", }, "@superNarrow": { marginLeft: "1.4em", }, }); const Item = styled("li", { listStyle: "none", display: "inline-flex", marginLeft: "1em", "@mobile": { marginLeft: 0, }, "@superNarrow": { // the home icon is kinda redundant when space is SUPER tight "&:first-of-type": { display: "none", }, }, }); export type MenuProps = ComponentProps; const Menu = ({ ...rest }: MenuProps) => { const router = useRouter(); return ( {menuItems.map((item, index) => ( {/* kinda weird/hacky way to determine if the *first part* of the current path matches this href */} ))} ); }; export default memo(Menu);