UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

74 lines 6.71 kB
"use strict"; 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 next_1 = require("@neo4j-ndl/react/next"); const react_2 = require("react"); const Component = () => { const [selected, setSelected] = (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-palette-neutral-bg-default", children: [(0, jsx_runtime_1.jsxs)(next_1.SideNavigation, { isExpanded: isExpanded, shouldExpandOnHover: true, pinButtonCallback: () => setIsExpanded(!isExpanded), children: [(0, jsx_runtime_1.jsxs)(next_1.SideNavigation.List, { children: [(0, jsx_runtime_1.jsx)(next_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.HomeIconOutline, {}), label: "Info Badge", isSelected: selected === 'nav-item-1', htmlAttributes: { onClick: () => { setSelected('nav-item-1'); }, }, badge: { number: 1, type: 'info', } }), (0, jsx_runtime_1.jsx)(next_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.CodeBracketIconOutline, {}), label: "Warning Badge", isSelected: selected === 'nav-item-2', htmlAttributes: { onClick: () => setSelected('nav-item-2'), }, badge: { number: 1, type: 'warning', } }), (0, jsx_runtime_1.jsx)(next_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.ServerIconOutline, {}), label: "Critical Badge", isSelected: selected === 'nav-item-3', htmlAttributes: { onClick: () => { setSelected('nav-item-3'); }, }, badge: { number: 1, type: 'danger', } })] }), (0, jsx_runtime_1.jsx)(next_1.SideNavigation.Divider, {}), (0, jsx_runtime_1.jsx)(next_1.SideNavigation.List, { children: (0, jsx_runtime_1.jsxs)(next_1.SideNavigation.CategoryItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.WrenchScrewdriverIconOutline, {}), label: "Category Item", isSelected: ['nav-item-4', 'nav-item-5', 'nav-item-6'].includes(selected !== null && selected !== void 0 ? selected : ''), badge: { number: 3, type: 'danger', }, children: [(0, jsx_runtime_1.jsx)(next_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.MagnifyingGlassIconOutline, {}), label: "Info Badge", isSelected: selected === 'nav-item-4', htmlAttributes: { onClick: () => { setSelected('nav-item-4'); }, }, badge: { number: 1, type: 'info', } }), (0, jsx_runtime_1.jsx)(next_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.MagnifyingGlassIconOutline, {}), label: "Warning Badge", isSelected: selected === 'nav-item-5', htmlAttributes: { onClick: () => setSelected('nav-item-5'), }, badge: { number: 1, type: 'warning', } }), (0, jsx_runtime_1.jsx)(next_1.SideNavigation.NavItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.MagnifyingGlassIconOutline, {}), label: "Critical Badge", isSelected: selected === 'nav-item-6', htmlAttributes: { onClick: () => setSelected('nav-item-6'), }, badge: { number: 1, type: 'danger', } })] }) })] }), (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-4 n-bg-palette-neutral-bg-weak n-p-token-8 n-rounded-lg n-items-center n-justify-center", children: [(0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "h6", children: "Side Nav with Badges" }), (0, jsx_runtime_1.jsxs)(react_1.Typography, { variant: "body-medium", children: ["Badges can be used to indicate that there are actions that need attention from the user on the specific page. The badge can have three different types of severity:", (0, jsx_runtime_1.jsx)("b", { className: "n-text-palette-primary-text", children: " info" }), ",", (0, jsx_runtime_1.jsx)("b", { className: "n-text-palette-warning-text", children: " warning" }), " and", (0, jsx_runtime_1.jsx)("b", { className: "n-text-palette-danger-text", children: " danger" }), ".", (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), "The badge on a ", (0, jsx_runtime_1.jsx)("b", { children: "CategoryItem" }), " should be the type of the highest priority badge of the items in the category. The number should be the total number of badges in the category."] })] }) }) })] })); }; exports.default = Component; //# sourceMappingURL=side-nav-badges.story.js.map