From f6c7d6db446c2efc1ecc769203dfdfbbd7247159 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 25 Nov 2022 19:57:23 +0200 Subject: [PATCH] sidebar --- src/components/Sidebar.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index e377039..0f4514f 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -17,16 +17,18 @@ const SidebarMenu = ({menuItems = [], children}) => { const elements = []; for (const menuItem of menuItems) { const { label, items: subItems = [], ...rest } = menuItem; + let subElements = null; - if (subItems.length) subElements = subItems.map(({ label, to, relative }) => { + if (subItems.length) subElements = subItems.map(({ label, to, relative = true }) => { if(relative) to = `${menuItem.to}${to}`; return {label}; }); - elements.push(
+ + elements.push(
{label} -
+ {subElements &&
{subElements} -
+
}
); }