Skip to content

Instantly share code, notes, and snippets.

@samuelhorn
Last active December 6, 2023 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelhorn/be806e0983bf33b2a04a3ce1a123d7d0 to your computer and use it in GitHub Desktop.
Save samuelhorn/be806e0983bf33b2a04a3ce1a123d7d0 to your computer and use it in GitHub Desktop.
Menu items as Slices without SliceZone, as used in Prismic top level menu
<ul className="flex flex-col lg:items-center lg:flex-row lg:justify-center">
{layout.data.slices1.map((item, index) => {
if (item.variation === "default") {
return (
<MenuItem
key={index}
slice={item}
/>
);
} else {
return (
<MenuItemWithSubmenu
key={index}
slice={item}
onOpenSubMenu={() => toggleSubMenu(index)}
openSubMenu={openMenuItem === index}
onCloseSubMenu={() => setOpenMenuItem(null)}
/>
);
}
})}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment