@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
53 lines • 5.38 kB
JavaScript
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 { CodeBracketIconOutline, HomeIconOutline, MagnifyingGlassIconOutline, ServerIconOutline, WrenchScrewdriverIconOutline, } from '@neo4j-ndl/react/icons';
import { useState } from 'react';
const Component = () => {
const [active, setActive] = useState(null);
const [isExpanded, setIsExpanded] = useState(false);
return (_jsxs("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-bg-neutral-bg-default", children: [_jsxs(SideNavigation, { ariaLabel: "Main side navigation", isExpanded: isExpanded, shouldOverlayOnInteraction: true, onPinButtonClick: () => setIsExpanded(!isExpanded), children: [_jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(HomeIconOutline, {}), label: "Info Badge", isActive: active === 'nav-item-1', onClick: () => setActive('nav-item-1'), badge: {
number: 1,
type: 'info',
} }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(CodeBracketIconOutline, {}), label: "Warning Badge", isActive: active === 'nav-item-2', onClick: () => setActive('nav-item-2'), badge: {
number: 1,
type: 'warning',
} }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(ServerIconOutline, {}), label: "Critical Badge", isActive: active === 'nav-item-3', onClick: () => setActive('nav-item-3'), badge: {
number: 1,
type: 'danger',
} }) }), _jsx(SideNavigation.Divider, {}), _jsx(SideNavigation.ListItem, { children: _jsxs(SideNavigation.CategoryItem, { icon: _jsx(WrenchScrewdriverIconOutline, {}), label: "Category Item", isActive: ['nav-item-4', 'nav-item-5', 'nav-item-6'].includes(active !== null && active !== void 0 ? active : ''), badge: {
number: 3,
type: 'danger',
}, children: [_jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(MagnifyingGlassIconOutline, {}), label: "Info Badge", isActive: active === 'nav-item-4', onClick: () => setActive('nav-item-4'), badge: {
number: 1,
type: 'info',
} }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(MagnifyingGlassIconOutline, {}), label: "Warning Badge", isActive: active === 'nav-item-5', onClick: () => setActive('nav-item-5'), badge: {
number: 1,
type: 'warning',
} }) }), _jsx(SideNavigation.ListItem, { children: _jsx(SideNavigation.NavItem, { icon: _jsx(MagnifyingGlassIconOutline, {}), label: "Critical Badge", isActive: active === 'nav-item-6', onClick: () => setActive('nav-item-6'), badge: {
number: 1,
type: 'danger',
} }) })] }) })] }), _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: "Side Nav with Badges" }), _jsxs(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:", _jsx("b", { className: "n-text-primary-text", children: " info" }), ",", _jsx("b", { className: "n-text-warning-text", children: " warning" }), " and", _jsx("b", { className: "n-text-danger-text", children: " danger" }), ".", _jsx("br", {}), _jsx("br", {}), "The badge on a ", _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."] })] }) }) })] }));
};
export default Component;
//# sourceMappingURL=side-nav-badges.story.js.map