Skip to content

Commit 5e85037

Browse files
committed
feat(VerticalNavigation): update to latest PD specs
1 parent 65c4f43 commit 5e85037

14 files changed

Lines changed: 964 additions & 110 deletions

File tree

apps/docs/src/content/components/vertical-navigation.mdx

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,234 @@ const data = [
434434
{ id: "03", label: "Cloud", icon: <Cloud /> },
435435
];
436436
```
437+
438+
### Test
439+
440+
```tsx live
441+
import { useState } from "react";
442+
import { css } from "@emotion/css";
443+
444+
export default function Demo() {
445+
const [selected, setSelected] = useState("home");
446+
const [collapsed, setCollapsed] = useState(false);
447+
448+
return (
449+
<div style={{ height: "90vh" }}>
450+
<HvVerticalNavigation
451+
open={!collapsed}
452+
onOpenChange={(isOpen) => setCollapsed(!isOpen)}
453+
selected={selected}
454+
onSelectedChange={setSelected}
455+
useIcons
456+
className="h-full"
457+
>
458+
<HvVerticalNavigationSection collapsible data={headerData} />
459+
<HvVerticalNavigationTree
460+
search
461+
collapsible
462+
aria-label="Example 1 navigation"
463+
data={navigationData}
464+
/>
465+
<HvVerticalNavigationActions>
466+
<div className="relative">
467+
{!collapsed && (
468+
<Backwards className="absolute pointer-events-none top-0 right-0" />
469+
)}
470+
<HvVerticalNavigationAction
471+
label={collapsed ? "Expand menu" : "Collapse menu"}
472+
icon={collapsed ? <Forwards /> : undefined}
473+
onClick={() => setCollapsed((prev) => !prev)}
474+
/>
475+
</div>
476+
</HvVerticalNavigationActions>
477+
</HvVerticalNavigation>
478+
</div>
479+
);
480+
}
481+
482+
const headerData = [
483+
{
484+
id: "home",
485+
label: "Home",
486+
icon: <div className="i-ph-house" />,
487+
},
488+
{
489+
id: "marketplace",
490+
label: "Data Marketplace",
491+
icon: <div className="i-ph-storefront" />,
492+
},
493+
{
494+
id: "fav",
495+
label: "Favorites",
496+
icon: <div className="i-ph-star" />,
497+
data: [
498+
{
499+
id: "fav-1",
500+
label: "Customers",
501+
icon: <div className="i-ph-table" />,
502+
},
503+
{
504+
id: "fav-2",
505+
label: "Transformations",
506+
icon: <div className="i-ph-folder" />,
507+
},
508+
{
509+
id: "fav-3",
510+
label: "sales_report.rep",
511+
icon: <div className="i-ph-file" />,
512+
},
513+
{
514+
id: "fav-4",
515+
label: "Sales Analysis",
516+
icon: <div className="i-ph-package" />,
517+
},
518+
{
519+
id: "fav-5",
520+
label: "clean_gdpr",
521+
icon: <div className="i-ph-file-csv" />,
522+
},
523+
{
524+
id: "fav-6",
525+
label: "Report",
526+
icon: <div className="i-ph-file-pdf" />,
527+
},
528+
{
529+
id: "fav-7",
530+
label: "User List",
531+
icon: <div className="i-ph-user-list" />,
532+
},
533+
],
534+
},
535+
];
536+
537+
const navigationData = [
538+
{
539+
id: "menu1",
540+
label: "Explore",
541+
path: "",
542+
icon: <div className="i-ph-map-trifold" />,
543+
data: [
544+
{
545+
id: "menu1-1",
546+
label: "Browse Files",
547+
path: "",
548+
icon: <div className="i-ph-folders" />,
549+
parent: null,
550+
data: [
551+
{
552+
id: "menu1-1-1",
553+
label: "File 1",
554+
path: "",
555+
icon: <div className="i-ph-file" />,
556+
},
557+
{
558+
id: "menu1-1-2",
559+
label: "File 2",
560+
path: "",
561+
icon: <div className="i-ph-file" />,
562+
},
563+
{
564+
id: "menu1-1-3",
565+
label: "File 3",
566+
path: "",
567+
icon: <div className="i-ph-file" />,
568+
},
569+
],
570+
},
571+
{
572+
id: "menu1-2",
573+
label: "Galaxy",
574+
path: "",
575+
icon: <div className="i-ph-graph" />,
576+
parent: null,
577+
},
578+
{
579+
id: "menu1-3",
580+
label: "Lineage",
581+
path: "",
582+
icon: <div className="i-ph-tree-structure" />,
583+
parent: null,
584+
},
585+
{
586+
id: "menu1-5",
587+
label: "Data Canvas",
588+
path: "",
589+
icon: <div className="i-ph-tree-view" />,
590+
parent: null,
591+
},
592+
{
593+
id: "menu1-6",
594+
label: "API Catalog",
595+
path: "",
596+
icon: <div className="i-ph-webhooks-logo" />,
597+
parent: null,
598+
},
599+
{
600+
id: "menu1-7",
601+
label: "Projects",
602+
path: "",
603+
icon: <div className="i-ph-suitcase-simple" />,
604+
parent: null,
605+
},
606+
],
607+
parent: null,
608+
},
609+
{
610+
id: "menu2",
611+
label: "Transform",
612+
path: "",
613+
icon: <div className="i-ph-intersect-three" />,
614+
parent: null,
615+
},
616+
{
617+
id: "menu3",
618+
label: "Management",
619+
path: "",
620+
icon: <div className="i-ph-gear" />,
621+
parent: null,
622+
data: [
623+
{
624+
id: "menu3-1",
625+
label: "Connections",
626+
icon: <div className="i-ph-plugs" />,
627+
},
628+
{
629+
id: "menu3-2",
630+
label: "Users",
631+
icon: <div className="i-ph-users" />,
632+
},
633+
{
634+
id: "menu3-3",
635+
label: "Roles & Permissions",
636+
icon: <div className="i-ph-user-circle-gear" />,
637+
},
638+
{
639+
id: "menu3-4",
640+
label: "Plugins",
641+
icon: <div className="i-ph-puzzle-piece" />,
642+
},
643+
],
644+
},
645+
{
646+
id: "menu4",
647+
label: "Schedules",
648+
path: "",
649+
icon: <div className="i-ph-calendar" />,
650+
parent: null,
651+
},
652+
{
653+
id: "menu5",
654+
label: "Monitoring",
655+
path: "",
656+
icon: <div className="i-ph-pulse" />,
657+
parent: null,
658+
data: [
659+
{
660+
id: "menu5-1",
661+
label: "Processes",
662+
icon: <div className="i-ph-gear-fine" />,
663+
},
664+
],
665+
},
666+
];
667+
```

packages/core/src/VerticalNavigation/Navigation/Navigation.styles.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { createClasses } from "@hitachivantara/uikit-react-utils";
2+
import { theme } from "@hitachivantara/uikit-styles";
23

34
export const { staticClasses, useClasses } = createClasses(
45
"HvVerticalNavigationTree",
56
{
67
root: {
78
display: "block",
89
overflowY: "auto",
10+
minHeight: 0,
911
},
1012
list: {},
1113
listItem: {},
@@ -18,5 +20,24 @@ export const { staticClasses, useClasses } = createClasses(
1820
navigationPopup: {
1921
boxShadow: "inset 5px 0 5px -3px rgb(65 65 65 / 12%)",
2022
},
23+
searchContainer: {
24+
paddingBottom: theme.space.sm,
25+
},
26+
searchIcon: {
27+
display: "flex",
28+
padding: 0,
29+
color: "currentColor",
30+
justifyContent: "center",
31+
marginBottom: theme.space.xs,
32+
":hover": {
33+
backgroundColor: theme.colors.text,
34+
borderRadius: theme.radii.round,
35+
cursor: "pointer",
36+
},
37+
},
38+
noResults: {
39+
padding: theme.spacing("xs", "sm"),
40+
color: theme.colors.textSubtle,
41+
},
2142
},
2243
);

0 commit comments

Comments
 (0)