@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
34 lines • 5.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
const react_1 = require("@neo4j-ndl/react");
const icons_1 = require("@neo4j-ndl/react/icons");
const react_2 = require("react");
const Component = () => {
const [active, setActive] = (0, react_2.useState)(null);
const [isExpanded, setIsExpanded] = (0, react_2.useState)(false);
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-bg-neutral-bg-default", children: [(0, jsx_runtime_1.jsxs)(react_1.SideNavigation, { isExpanded: isExpanded, shouldOverlayOnInteraction: true, onPinButtonClick: () => setIsExpanded(!isExpanded), ariaLabel: "Main side navigation", children: [(0, jsx_runtime_1.jsx)(react_1.SideNavigation.CategoryHeader, { children: "Example Category Header" }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.HomeIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-1', onClick: () => setActive('nav-item-1') }) }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.CodeBracketIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-2', onClick: () => setActive('nav-item-2') }) }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.Divider, {}), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.ServerIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-3', onClick: () => setActive('nav-item-3') }) }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsxs)(react_1.SideNavigation.CategoryItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.WrenchScrewdriverIconOutline, {}), label: "Category Item", isActive: ['nav-item-4', 'nav-item-5'].includes(active !== null && active !== void 0 ? active : ''), children: [(0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.MagnifyingGlassIconOutline, {}), label: "Nested Nav Item", isActive: active === 'nav-item-4', onClick: () => setActive('nav-item-4') }) }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.MagnifyingGlassIconOutline, {}), label: "Nested Nav Item", isActive: active === 'nav-item-5', onClick: () => setActive('nav-item-5') }) })] }) }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.ChartBarIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-6', onClick: () => setActive('nav-item-6') }) }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Cog6ToothIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-7', onClick: () => setActive('nav-item-7') }) }), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.Divider, {}), (0, jsx_runtime_1.jsx)(react_1.SideNavigation.ListItem, { children: (0, jsx_runtime_1.jsx)(react_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.AcademicCapIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-8', onClick: () => setActive('nav-item-8') }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "n-h-full n-w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "n-flex n-flex-col n-p-8 n-w-full n-max-w-[1024px] n-mx-auto", children: (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-8 n-bg-neutral-bg-weak n-p-token-32 n-rounded-lg n-items-center n-justify-center", children: [(0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: "Default Side Nav" }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", children: "This is the default behavior for a side nav. It expands on hover, and can be pinned to stay expanded." })] }) }) })] }));
};
exports.default = Component;
//# sourceMappingURL=side-nav-default.story.js.map