Skip to content

Commit 3412c90

Browse files
huwshimiedlerd
authored andcommitted
feat: add application layout side navigation components
1 parent 18537ba commit 3412c90

20 files changed

+1057
-0
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import React from "react";
2+
import type { Meta, StoryObj } from "@storybook/react";
3+
4+
import Badge from "components/Badge";
5+
6+
import SideNavigation from "./SideNavigation";
7+
8+
const meta: Meta<typeof SideNavigation> = {
9+
component: SideNavigation,
10+
tags: ["autodocs"],
11+
};
12+
13+
export default meta;
14+
15+
type Story = StoryObj<typeof SideNavigation>;
16+
17+
/**
18+
* Menu items can be provided as links, text or custom components.
19+
*/
20+
export const Default: Story = {
21+
args: {
22+
items: [
23+
{
24+
icon: "drag",
25+
label: "Models",
26+
status: <Badge value={9} isNegative />,
27+
},
28+
{
29+
icon: "menu",
30+
label: "Controllers",
31+
nonInteractive: true,
32+
},
33+
<div>Custom item</div>,
34+
],
35+
},
36+
};
37+
38+
/**
39+
* To display multiple menus a nested array of items can be used.
40+
*/
41+
export const MultipleMenus: Story = {
42+
args: {
43+
items: [
44+
[
45+
{
46+
icon: "drag",
47+
label: "Models",
48+
href: "/models",
49+
},
50+
{
51+
icon: "menu",
52+
label: "Controllers",
53+
href: "/controllers",
54+
},
55+
{
56+
icon: "user",
57+
label: "Permissions",
58+
href: "/users",
59+
},
60+
],
61+
[
62+
{
63+
icon: "information",
64+
label: "Docs",
65+
href: "/docs",
66+
},
67+
{
68+
label: "Logout",
69+
href: "/logout",
70+
},
71+
],
72+
],
73+
},
74+
};
75+
76+
/**
77+
* To provide attributes to individual menus then each menu can be provided as a
78+
* object containing an items array: `{ className: "menu-one", items: [...] }`.
79+
*/
80+
export const ListAttributes: Story = {
81+
args: {
82+
items: [
83+
{
84+
className: "menu-one",
85+
items: [
86+
{
87+
icon: "drag",
88+
label: "Models",
89+
href: "/models",
90+
},
91+
{
92+
icon: "menu",
93+
label: "Controllers",
94+
href: "/controllers",
95+
},
96+
{
97+
icon: "user",
98+
label: "Permissions",
99+
href: "/users",
100+
},
101+
],
102+
},
103+
{
104+
className: "menu-two",
105+
items: [
106+
{
107+
icon: "information",
108+
label: "Docs",
109+
href: "/docs",
110+
},
111+
{
112+
label: "Logout",
113+
href: "/logout",
114+
},
115+
],
116+
},
117+
],
118+
},
119+
};
120+
121+
/**
122+
* `children` can be provided instead of `items` in cases where custom content
123+
* is required.
124+
*/
125+
export const CustomContent: Story = {
126+
args: {
127+
children: <div>Custom menu content.</div>,
128+
},
129+
};

0 commit comments

Comments
 (0)