UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

31 lines 4.33 kB
import { jsx as _jsx, jsxs as _jsxs } from "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/>. */ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css'; import { SideNavigation, Typography } from '@neo4j-ndl/react'; import { AcademicCapIconOutline, ChartBarIconOutline, CodeBracketIconOutline, Cog6ToothIconOutline, HomeIconOutline, MagnifyingGlassIconOutline, ServerIconOutline, WrenchScrewdriverIconOutline, } from '@neo4j-ndl/react/icons'; import { useState } from 'react'; const Component = () => { const [active, setActive] = useState(null); return (_jsxs("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-bg-neutral-bg-default", children: [_jsxs(SideNavigation, { isExpanded: false, shouldOverlayOnInteraction: false, ariaLabel: "Main side navigation", children: [_jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(HomeIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-1', onClick: () => setActive('nav-item-1') }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(CodeBracketIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-2', onClick: () => setActive('nav-item-2') }) }), _jsx(SideNavigation.Divider, {}), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(ServerIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-3', onClick: () => setActive('nav-item-3') }) }), _jsx(SideNavigation.ListItem, { children: _jsxs(SideNavigation.CategoryItem, { icon: _jsx(WrenchScrewdriverIconOutline, {}), label: "Category Item", isActive: ['nav-item-4', 'nav-item-5'].includes(active !== null && active !== void 0 ? active : ''), children: [_jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(MagnifyingGlassIconOutline, {}), label: "Nested Nav Item", isActive: active === 'nav-item-4', onClick: () => setActive('nav-item-4') }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(MagnifyingGlassIconOutline, {}), label: "Nested Nav Item", isActive: active === 'nav-item-5', onClick: () => setActive('nav-item-5') }) })] }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(ChartBarIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-6', onClick: () => setActive('nav-item-6') }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(Cog6ToothIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-7', onClick: () => setActive('nav-item-7') }) }), _jsx(SideNavigation.Divider, {}), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(AcademicCapIconOutline, {}), label: "Nav Item", isActive: active === 'nav-item-8', onClick: () => setActive('nav-item-8') }) })] }), _jsx("div", { className: "n-h-full n-w-full", children: _jsx("div", { className: "n-flex n-flex-col n-p-8 n-w-full n-max-w-[1024px] n-mx-auto", children: _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: [_jsx(Typography, { variant: "title-4", children: "Compact Side Nav" }), _jsxs(Typography, { variant: "body-medium", children: ["When using a compact side nav you must make sure to set a", _jsx("b", { children: " label" }), " on the NavItems, as the label will be used for the built in tooltip. It is also needed for screen readers to behave as correctly."] })] }) }) })] })); }; export default Component; //# sourceMappingURL=side-nav-compact.story.js.map