@yeonpm/react
Version:
A library that collects frequently used components and custom hooks in react projects
3 lines (2 loc) • 2.78 kB
JavaScript
import{jsxs as n,jsx as e,Fragment as o}from"react/jsx-runtime";import{useState as t}from"react";import r from"../../common/Wrapper/index.js";import i from"../../common/Txt/index.js";import{capitalize as a}from"../../../node_modules/yeonpm-modules/dist/esm/formatters/index.js";import"../../../node_modules/yeonpm-modules/dist/esm/node_modules/tslib/tslib.es6.js";var c=function(o){var t=o.navigationConfigs,a=o.logo,c=o.onClickSignOut,s=o.signOutLabel,d=o.router,u=o.pathname,f=o.disableSignOutButton,m=void 0!==f&&f,h=o.width;return n(r,{className:"main-layout-navigation-bar-wrapper",h:"100%",bg:"#ffffff",column:!0,borderRight:"1px solid #f2f2f2",w:h,children:[a&&e(r,{w:"100%",ac:!0,h:100,jc:!0,children:a}),e(r,{flex1:!0,overflowY:"auto",children:t.configs.map(function(n,o){return e(l,{router:d,pathname:u,config:n,depth:0,routePrefix:t.routePrefix},o)})}),!m&&e(r,{h:100,ac:!0,jc:!0,onClick:function(){return c?c():window.location.href="/signOut"},children:e(r,{white:!0,mouseCss:!0,children:e(i,{fv:{fontSize:14},color:"#afafaf",textDecoration:"underline",children:s||"sign out"})})})]})},l=function(o){var c,d=o.config,u=o.depth,f=o.routePrefix,m=o.parentPath,h=o.router,p=o.pathname,g=t(!1),x=g[0],v=g[1],b=d.children&&d.children.length>0,w=d.value.replace(/^\//,""),j=m?"".concat(m,"/").concat(w):"/".concat(w),C="".concat(f).concat(j)===p;return n(r,{column:!0,children:[n(r,{className:"navigation-item",h:50,onClick:function(){b?v(!x):h.push("".concat(f).concat(j))},mouseCss:!0,white:!0,flex:!0,w:"100%",children:[d.icon&&e(r,{className:"navigation-item-icon",pl:24,h:"100%",ac:!0,jc:!0,children:d.icon}),n(r,{pl:20*u+16,pr:16,ac:!0,h:"100%",children:[e(i,{fv:{fontSize:0===u?16:1===u?14:2===u?12:16},textDecoration:C?"underline":"none",children:a(d.label||d.value)}),e(s,{isOpen:x,enable:b})]})]}),e(r,{column:!0,css:"\n height: ".concat(x?"auto":"0",";\n opacity: ").concat(x?"1":"0",";\n overflow: hidden;\n transition: all 0.2s ease-in-out;\n "),children:b&&e(r,{column:!0,children:null===(c=d.children)||void 0===c?void 0:c.map(function(n,o){return e(l,{config:n,depth:u+1,routePrefix:f,parentPath:j,router:h,pathname:p},o)})})})]})},s=function(n){var t=n.isOpen,i=n.enable;return e(o,{children:i&&e(r,{className:"arrow-icon",w:24,h:24,ac:!0,jc:!0,ml:"auto",css:"\n transform: ".concat(t?"rotate(180deg)":"none",';\n transition: transform 0.3s ease;\n &::before {\n content: "";\n width: 0;\n height: 0;\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-top: 6px solid #dadadaed;\n }\n ')})})};export{c as default};
//# sourceMappingURL=index.js.map