blixify-ui-web-mcp 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/chart/ganttChart/README.md +96 -110
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +132 -116
- package/lib/components/chart/heatmapChart/README.md +93 -82
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +118 -74
- package/lib/components/chat/chatAnchor/README.md +61 -79
- package/lib/components/chat/chatBase/README.md +166 -199
- package/lib/components/chat/chatBase/chatBase.stories.tsx +243 -265
- package/lib/components/chat/chatDashboard/README.md +87 -129
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +84 -107
- package/lib/components/data/dataGraph/README.md +135 -1
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +86 -67
- package/lib/components/data/dataReference/README.md +141 -43
- package/lib/components/data/dataReference/dataReference.stories.tsx +107 -35
- package/lib/components/data/dataWrapper/README.md +2 -1
- package/lib/components/display/table/README.md +1 -1
- package/lib/components/navigation/bars/README.md +90 -17
- package/lib/components/navigation/bars/bars.stories.tsx +125 -51
- package/lib/components/navigation/breadcrumb/README.md +40 -20
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +30 -4
- package/lib/components/navigation/header/README.md +67 -108
- package/lib/components/navigation/header/header.stories.tsx +143 -39
- package/lib/components/navigation/leftNav/README.md +121 -66
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +176 -83
- package/lib/components/navigation/tabs/tabs.stories.tsx +53 -29
- package/package.json +1 -1
|
@@ -4,88 +4,143 @@
|
|
|
4
4
|
|
|
5
5
|
<hr>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A full-page dashboard layout with a collapsible left sidebar, top header bar, and main content area. The sidebar renders navigation items via the `Bars` component and supports drag-to-reorder, grouped items, a footer slot, dark mode, and a mobile overlay menu.
|
|
8
8
|
|
|
9
9
|
##### Import
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
+
import { LeftNav } from "blixify-ui-web/components/navigation/leftNav";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
Basic setup:
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
12
20
|
const [mobile, setMobile] = useState(false);
|
|
21
|
+
const [selectedId, setSelectedId] = useState("dashboard");
|
|
22
|
+
|
|
13
23
|
const navigation = [
|
|
24
|
+
{ id: "dashboard", name: "Dashboard", href: "/dashboard", icon: HomeIcon },
|
|
14
25
|
{
|
|
15
|
-
id: "
|
|
16
|
-
name: "
|
|
17
|
-
href: "/dashboard",
|
|
18
|
-
icon:
|
|
26
|
+
id: "reports",
|
|
27
|
+
name: "Reports",
|
|
28
|
+
href: "/dashboard/reports",
|
|
29
|
+
icon: FolderIcon,
|
|
19
30
|
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
<LeftNav
|
|
34
|
+
selectedId={selectedId}
|
|
35
|
+
navigation={navigation}
|
|
36
|
+
leftNavMobileMenu={mobile}
|
|
37
|
+
handleBarsOnClick={(id) => setSelectedId(id)}
|
|
38
|
+
handleToggleLeftNavMobileMenu={() => setMobile(!mobile)}
|
|
39
|
+
renderDashboardLogo={() => (
|
|
40
|
+
<img className="h-10 w-auto" src={Logo} alt="Logo" />
|
|
41
|
+
)}
|
|
42
|
+
renderDashboardContent={() => <div className="p-6">Content</div>}
|
|
43
|
+
renderDashboardHeaderContent={() => <span>Page Title</span>}
|
|
44
|
+
/>;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Collapsible sidebar:
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
const [collapse, setCollapse] = useState(false);
|
|
51
|
+
|
|
52
|
+
<LeftNav
|
|
53
|
+
selectedId={selectedId}
|
|
54
|
+
navigation={navigation}
|
|
55
|
+
leftNavMobileMenu={mobile}
|
|
56
|
+
transition={{ headerVisible: true, collapse }}
|
|
57
|
+
handleToggleCollapse={() => setCollapse(!collapse)}
|
|
58
|
+
handleToggleLeftNavMobileMenu={() => setMobile(!mobile)}
|
|
59
|
+
renderDashboardLogo={() => <img className="h-10 w-auto" src={Logo} />}
|
|
60
|
+
renderDashboardContent={() => <div className="p-6">Content</div>}
|
|
61
|
+
renderDashboardHeaderContent={() => <span>Page Title</span>}
|
|
62
|
+
/>;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Draggable with grouped items:
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
const navigation = [
|
|
69
|
+
{ id: "dashboard", name: "Dashboard", href: "/dashboard", icon: HomeIcon },
|
|
20
70
|
{
|
|
21
|
-
id: "
|
|
22
|
-
name: "
|
|
23
|
-
href: "/
|
|
24
|
-
icon:
|
|
71
|
+
id: "engineering",
|
|
72
|
+
name: "Engineering",
|
|
73
|
+
href: "/teams/eng",
|
|
74
|
+
icon: UsersIcon,
|
|
75
|
+
groupId: "People",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "hr",
|
|
79
|
+
name: "HR",
|
|
80
|
+
href: "/teams/hr",
|
|
81
|
+
icon: UsersIcon,
|
|
82
|
+
groupId: "People",
|
|
25
83
|
},
|
|
26
84
|
];
|
|
27
85
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
renderDashboardLogo={() => (
|
|
41
|
-
<div className="flex items-center flex-shrink-0 px-6 cursor-pointer">
|
|
42
|
-
<img className="h-10 w-auto" src={Logo} alt="Favicon" />
|
|
43
|
-
</div>
|
|
44
|
-
)}
|
|
45
|
-
renderDashboardContent={() => {}}
|
|
46
|
-
renderDashboardHeaderContent={() => {}}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
86
|
+
<LeftNav
|
|
87
|
+
selectedId={selectedId}
|
|
88
|
+
navigation={navigation}
|
|
89
|
+
leftNavMobileMenu={false}
|
|
90
|
+
draggable={true}
|
|
91
|
+
handleChangeNavigation={(value) => setNavigation(value)}
|
|
92
|
+
handleDropEnd={() => {}}
|
|
93
|
+
handleToggleLeftNavMobileMenu={() => {}}
|
|
94
|
+
renderDashboardLogo={() => <img className="h-10 w-auto" src={Logo} />}
|
|
95
|
+
renderDashboardContent={() => <div className="p-6">Content</div>}
|
|
96
|
+
renderDashboardHeaderContent={() => <span>Page Title</span>}
|
|
97
|
+
/>;
|
|
49
98
|
```
|
|
50
99
|
|
|
51
100
|
##### Required props
|
|
52
101
|
|
|
53
|
-
| Name | Type | Description
|
|
54
|
-
| ------------------------------- | ----------------- |
|
|
55
|
-
| `selectedId` | `string` |
|
|
56
|
-
| `navigation` | `Navigation
|
|
57
|
-
| `leftNavMobileMenu` | `boolean` |
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `renderDashboardHeaderContent` | `function` | Render Header Content |
|
|
102
|
+
| Name | Type | Description |
|
|
103
|
+
| ------------------------------- | ----------------- | -------------------------------------------------- |
|
|
104
|
+
| `selectedId` | `string` | The `id` of the currently active navigation item |
|
|
105
|
+
| `navigation` | `Navigation[]` | Ordered list of nav items — see Navigation below |
|
|
106
|
+
| `leftNavMobileMenu` | `boolean` | Controls whether the mobile overlay menu is open |
|
|
107
|
+
| `handleToggleLeftNavMobileMenu` | `() => void` | Called when the mobile hamburger button is clicked |
|
|
108
|
+
| `renderDashboardLogo` | `() => ReactNode` | Renders the logo at the top of the sidebar |
|
|
109
|
+
| `renderDashboardContent` | `() => ReactNode` | Renders the main page content area |
|
|
110
|
+
| `renderDashboardHeaderContent` | `() => ReactNode` | Renders content inside the top header bar |
|
|
63
111
|
|
|
64
112
|
##### Optional props
|
|
65
113
|
|
|
66
|
-
| Name | Type
|
|
67
|
-
| ------------------------------ |
|
|
68
|
-
| `draggable` | `boolean`
|
|
69
|
-
| `handleChangeNavigation` | `
|
|
70
|
-
| `handleDropEnd` | `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `transition` | `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
| `
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
114
|
+
| Name | Type | Default | Description |
|
|
115
|
+
| ------------------------------ | ---------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `draggable` | `boolean` | `false` | Enables drag-to-reorder on nav items. Requires `handleChangeNavigation`. |
|
|
117
|
+
| `handleChangeNavigation` | `(value: Navigation[]) => void` | — | Called with the updated nav array after each drag move. Required when `draggable` is `true`. |
|
|
118
|
+
| `handleDropEnd` | `() => void` | — | Called when a drag interaction ends. Required when `draggable` is `true`. |
|
|
119
|
+
| `handleBarsOnClick` | `(id: string) => void` | — | Called with the nav item `id` when clicked. Use instead of href navigation for single-page apps. |
|
|
120
|
+
| `handleToggleCollapse` | `() => void` | — | Called when the collapse arrow is clicked. Required when `transition` is set. |
|
|
121
|
+
| `transition` | `{ headerVisible?: boolean; collapse?: boolean }` | — | Controls sidebar collapse and header visibility — see Transition below. |
|
|
122
|
+
| `darkMode` | `boolean` | `false` | Switches the sidebar and header to a dark theme |
|
|
123
|
+
| `bgColor` | `string` | — | Tailwind bg class for the outer page background. Defaults to `bg-gray-100` (light) or `bg-gray-900` (dark). |
|
|
124
|
+
| `navbarBgColor` | `string` | — | Tailwind bg class for the sidebar and header bar. Defaults to `bg-white` (light) or `bg-gray-800` (dark). |
|
|
125
|
+
| `renderDashboardFooterContent` | `() => ReactNode` | — | Renders a slot at the bottom of the sidebar, above a border separator |
|
|
126
|
+
| `dashboardFooterClassName` | `string` | — | Tailwind classes applied to the footer slot container |
|
|
127
|
+
| `dashboardContentClassName` | `string` | — | Tailwind classes applied to the main content `<main>` element |
|
|
128
|
+
| `linkType` | `"react" \| "gatsby" \| "next" \| "external" \| "default"` | — | Router adapter passed through to nav links |
|
|
129
|
+
| `custom` | `any` | — | Custom link component used when `linkType` is `"react"`, `"gatsby"`, or `"next"` |
|
|
130
|
+
|
|
131
|
+
##### Navigation
|
|
132
|
+
|
|
133
|
+
| Name | Type | Description |
|
|
134
|
+
| --------- | -------- | ---------------------------------------------------------------------------------------------------------- |
|
|
135
|
+
| `id` | `string` | Unique identifier — matched against `selectedId` to highlight the active item |
|
|
136
|
+
| `name` | `string` | Display label |
|
|
137
|
+
| `href` | `string` | URL used when `handleBarsOnClick` is not provided |
|
|
138
|
+
| `icon` | `any` | Heroicon or SVG component rendered beside the label |
|
|
139
|
+
| `groupId` | `string` | Optional — items sharing the same `groupId` are nested under a collapsible group labelled with that string |
|
|
140
|
+
|
|
141
|
+
##### Transition
|
|
142
|
+
|
|
143
|
+
| Name | Type | Description |
|
|
144
|
+
| --------------- | --------- | ---------------------------------------------------------------------------------------------------- |
|
|
145
|
+
| `collapse` | `boolean` | When `true`, the sidebar collapses to icon-only width. Requires `handleToggleCollapse`. |
|
|
146
|
+
| `headerVisible` | `boolean` | When `false`, the top header bar is hidden on desktop (still shown on mobile for the hamburger menu) |
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { FolderIcon, HomeIcon } from "@heroicons/react/24/outline";
|
|
1
|
+
import { FolderIcon, HomeIcon, UsersIcon } from "@heroicons/react/24/outline";
|
|
2
2
|
import { storiesOf } from "@storybook/react";
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useState } from "react";
|
|
4
4
|
import { LeftNav } from ".";
|
|
5
|
+
import { StorySection } from "../../storyUtils";
|
|
5
6
|
import Logo from "../../../assets/logo.png";
|
|
6
7
|
import README from "./README.md";
|
|
7
8
|
|
|
@@ -13,94 +14,186 @@ stories.addParameters({
|
|
|
13
14
|
},
|
|
14
15
|
});
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const baseNavigation = [
|
|
18
|
+
{ id: "dashboard", name: "Dashboard", href: "/dashboard", icon: HomeIcon },
|
|
19
|
+
{
|
|
20
|
+
id: "defects",
|
|
21
|
+
name: "Defects",
|
|
22
|
+
href: "/dashboard/defects",
|
|
23
|
+
icon: FolderIcon,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "reports",
|
|
27
|
+
name: "Reports",
|
|
28
|
+
href: "/dashboard/reports",
|
|
29
|
+
icon: FolderIcon,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const groupedNavigation = [
|
|
34
|
+
{ id: "dashboard", name: "Dashboard", href: "/dashboard", icon: HomeIcon },
|
|
35
|
+
{
|
|
36
|
+
id: "teams",
|
|
37
|
+
name: "Teams",
|
|
38
|
+
href: "/teams",
|
|
39
|
+
icon: UsersIcon,
|
|
40
|
+
groupId: "People",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "engineering",
|
|
44
|
+
name: "Engineering",
|
|
45
|
+
href: "/teams/engineering",
|
|
46
|
+
icon: UsersIcon,
|
|
47
|
+
groupId: "People",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "hr",
|
|
51
|
+
name: "Human Resources",
|
|
52
|
+
href: "/teams/hr",
|
|
53
|
+
icon: UsersIcon,
|
|
54
|
+
groupId: "People",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "defects",
|
|
58
|
+
name: "Defects",
|
|
59
|
+
href: "/dashboard/defects",
|
|
60
|
+
icon: FolderIcon,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
19
63
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
64
|
+
const renderLogo = (collapse?: boolean) => (
|
|
65
|
+
<div className="flex items-center flex-shrink-0 px-6 cursor-pointer">
|
|
66
|
+
<img
|
|
67
|
+
className={`h-10 ${
|
|
68
|
+
collapse ? "w-1/4 object-contain lg:hidden" : "w-auto"
|
|
69
|
+
}`}
|
|
70
|
+
src={Logo}
|
|
71
|
+
alt="Logo"
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
24
75
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
id: "inspection",
|
|
29
|
-
name: "Inspection",
|
|
30
|
-
href: "/dashboard",
|
|
31
|
-
icon: HomeIcon,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: "teams",
|
|
35
|
-
name: "Teams",
|
|
36
|
-
href: "/team",
|
|
37
|
-
icon: HomeIcon,
|
|
38
|
-
groupId: "team",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "engineering",
|
|
42
|
-
name: "Engineering",
|
|
43
|
-
href: "/teams/engineering",
|
|
44
|
-
icon: HomeIcon,
|
|
45
|
-
groupId: "team",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: "human_resources",
|
|
49
|
-
name: "Human Resources",
|
|
50
|
-
href: "/teams/hr",
|
|
51
|
-
icon: HomeIcon,
|
|
52
|
-
groupId: "team",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "defects",
|
|
56
|
-
name: "Defects",
|
|
57
|
-
href: "/dashboard/defects",
|
|
58
|
-
icon: FolderIcon,
|
|
59
|
-
},
|
|
60
|
-
]);
|
|
76
|
+
const renderContent = () => (
|
|
77
|
+
<div className="p-6 text-gray-500 text-sm">Dashboard content goes here.</div>
|
|
78
|
+
);
|
|
61
79
|
|
|
62
|
-
|
|
80
|
+
const renderHeader = () => (
|
|
81
|
+
<div className="px-4 text-sm font-medium text-gray-700">Page Title</div>
|
|
82
|
+
);
|
|
63
83
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
stories.add("LeftNav", () => {
|
|
85
|
+
const [mobile, setMobile] = useState(false);
|
|
86
|
+
const [selectedId, setSelectedId] = useState("dashboard");
|
|
87
|
+
const [navigation] = useState(baseNavigation);
|
|
88
|
+
const [collapse, setCollapse] = useState(false);
|
|
89
|
+
const [groupedNav, setGroupedNav] = useState(groupedNavigation);
|
|
90
|
+
const [darkMobile, setDarkMobile] = useState(false);
|
|
70
91
|
|
|
71
92
|
return (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
handleToggleLeftNavMobileMenu={() => {
|
|
88
|
-
setMobile(!mobile);
|
|
89
|
-
}}
|
|
90
|
-
renderDashboardLogo={() => (
|
|
91
|
-
<div className="flex items-center flex-shrink-0 px-6 cursor-pointer flex-col">
|
|
92
|
-
<img
|
|
93
|
-
className={`h-10 ${
|
|
94
|
-
collapse ? "w-1/4 object-contain lg:hidden" : "w-auto"
|
|
95
|
-
} `}
|
|
96
|
-
w-auto
|
|
97
|
-
src={Logo}
|
|
98
|
-
alt="Favicon"
|
|
93
|
+
<>
|
|
94
|
+
<StorySection
|
|
95
|
+
title="Default"
|
|
96
|
+
description="Basic left nav with logo, nav items, and dashboard content. handleBarsOnClick handles selection for single-page apps. Resize to mobile width to see the hamburger menu."
|
|
97
|
+
>
|
|
98
|
+
<div className="w-full h-96 relative overflow-hidden border rounded-lg">
|
|
99
|
+
<LeftNav
|
|
100
|
+
selectedId={selectedId}
|
|
101
|
+
navigation={navigation}
|
|
102
|
+
leftNavMobileMenu={mobile}
|
|
103
|
+
handleBarsOnClick={(id) => setSelectedId(id)}
|
|
104
|
+
handleToggleLeftNavMobileMenu={() => setMobile(!mobile)}
|
|
105
|
+
renderDashboardLogo={() => renderLogo()}
|
|
106
|
+
renderDashboardContent={renderContent}
|
|
107
|
+
renderDashboardHeaderContent={renderHeader}
|
|
99
108
|
/>
|
|
100
109
|
</div>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
</StorySection>
|
|
111
|
+
|
|
112
|
+
<StorySection
|
|
113
|
+
title="Draggable + Grouped Items"
|
|
114
|
+
description="draggable=true lets users reorder nav items via drag-and-drop. Items sharing a groupId are nested under a collapsible group. handleChangeNavigation persists the new order."
|
|
115
|
+
>
|
|
116
|
+
<div className="w-full h-96 relative overflow-hidden border rounded-lg">
|
|
117
|
+
<LeftNav
|
|
118
|
+
selectedId={selectedId}
|
|
119
|
+
navigation={groupedNav}
|
|
120
|
+
leftNavMobileMenu={false}
|
|
121
|
+
draggable={true}
|
|
122
|
+
handleBarsOnClick={(id) => setSelectedId(id)}
|
|
123
|
+
handleChangeNavigation={(value) => setGroupedNav(value)}
|
|
124
|
+
handleDropEnd={() => {}}
|
|
125
|
+
handleToggleLeftNavMobileMenu={() => {}}
|
|
126
|
+
renderDashboardLogo={() => renderLogo()}
|
|
127
|
+
renderDashboardContent={renderContent}
|
|
128
|
+
renderDashboardHeaderContent={renderHeader}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
</StorySection>
|
|
132
|
+
|
|
133
|
+
<StorySection
|
|
134
|
+
title="Collapsible Sidebar"
|
|
135
|
+
description="Pass transition.collapse to toggle the sidebar between full and icon-only width. handleToggleCollapse fires when the collapse arrow is clicked. transition.headerVisible=false hides the top header bar on desktop."
|
|
136
|
+
>
|
|
137
|
+
<div className="w-full h-96 relative overflow-hidden border rounded-lg">
|
|
138
|
+
<LeftNav
|
|
139
|
+
selectedId={selectedId}
|
|
140
|
+
navigation={navigation}
|
|
141
|
+
leftNavMobileMenu={false}
|
|
142
|
+
transition={{ headerVisible: true, collapse }}
|
|
143
|
+
handleBarsOnClick={(id) => setSelectedId(id)}
|
|
144
|
+
handleToggleCollapse={() => setCollapse(!collapse)}
|
|
145
|
+
handleToggleLeftNavMobileMenu={() => {}}
|
|
146
|
+
renderDashboardLogo={() => renderLogo(collapse)}
|
|
147
|
+
renderDashboardContent={renderContent}
|
|
148
|
+
renderDashboardHeaderContent={renderHeader}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
</StorySection>
|
|
152
|
+
|
|
153
|
+
<StorySection
|
|
154
|
+
title="Footer Content"
|
|
155
|
+
description="renderDashboardFooterContent renders a slot at the bottom of the sidebar, above the border. Useful for user profile info or a sign-out button."
|
|
156
|
+
>
|
|
157
|
+
<div className="w-full h-96 relative overflow-hidden border rounded-lg">
|
|
158
|
+
<LeftNav
|
|
159
|
+
selectedId={selectedId}
|
|
160
|
+
navigation={navigation}
|
|
161
|
+
leftNavMobileMenu={false}
|
|
162
|
+
handleBarsOnClick={(id) => setSelectedId(id)}
|
|
163
|
+
handleToggleLeftNavMobileMenu={() => {}}
|
|
164
|
+
renderDashboardLogo={() => renderLogo()}
|
|
165
|
+
renderDashboardContent={renderContent}
|
|
166
|
+
renderDashboardHeaderContent={renderHeader}
|
|
167
|
+
renderDashboardFooterContent={() => (
|
|
168
|
+
<div className="text-sm text-gray-500">v1.0.0</div>
|
|
169
|
+
)}
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
</StorySection>
|
|
173
|
+
|
|
174
|
+
<StorySection
|
|
175
|
+
title="Dark Mode"
|
|
176
|
+
description="darkMode=true switches the sidebar and header to a dark theme. bgColor and navbarBgColor override the default background colours."
|
|
177
|
+
dark
|
|
178
|
+
>
|
|
179
|
+
<div className="w-full h-96 relative overflow-hidden border border-gray-700 rounded-lg">
|
|
180
|
+
<LeftNav
|
|
181
|
+
selectedId={selectedId}
|
|
182
|
+
navigation={navigation}
|
|
183
|
+
leftNavMobileMenu={darkMobile}
|
|
184
|
+
darkMode={true}
|
|
185
|
+
handleBarsOnClick={(id) => setSelectedId(id)}
|
|
186
|
+
handleToggleLeftNavMobileMenu={() => setDarkMobile(!darkMobile)}
|
|
187
|
+
renderDashboardLogo={() => renderLogo()}
|
|
188
|
+
renderDashboardContent={() => (
|
|
189
|
+
<div className="p-6 text-gray-400 text-sm">
|
|
190
|
+
Dashboard content.
|
|
191
|
+
</div>
|
|
192
|
+
)}
|
|
193
|
+
renderDashboardHeaderContent={renderHeader}
|
|
194
|
+
/>
|
|
195
|
+
</div>
|
|
196
|
+
</StorySection>
|
|
197
|
+
</>
|
|
105
198
|
);
|
|
106
199
|
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { storiesOf } from "@storybook/react";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { Tabs } from ".";
|
|
4
|
+
import { StorySection } from "../../storyUtils";
|
|
4
5
|
import README from "./README.md";
|
|
6
|
+
|
|
5
7
|
const stories = storiesOf("Navigation", module);
|
|
6
8
|
|
|
7
9
|
stories.addParameters({
|
|
@@ -21,40 +23,62 @@ stories.add("Tabs", () => {
|
|
|
21
23
|
|
|
22
24
|
return (
|
|
23
25
|
<>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
<StorySection
|
|
27
|
+
title="Default"
|
|
28
|
+
description="Basic tab bar. Pass onClick to handle selection and selectedId to highlight the active tab."
|
|
29
|
+
>
|
|
30
|
+
<Tabs
|
|
31
|
+
tabs={tabs}
|
|
32
|
+
selectedId={selectedId}
|
|
33
|
+
onClick={(id) => setSelectedId(id)}
|
|
34
|
+
/>
|
|
35
|
+
</StorySection>
|
|
36
|
+
|
|
37
|
+
<StorySection
|
|
38
|
+
title="Draggable"
|
|
39
|
+
description="Set draggable=true and provide handleChangeTabs to persist the new order. handleDropEnd fires when the drag interaction ends."
|
|
40
|
+
>
|
|
41
|
+
<Tabs
|
|
42
|
+
tabs={tabs}
|
|
43
|
+
selectedId={selectedId}
|
|
44
|
+
onClick={(id) => setSelectedId(id)}
|
|
45
|
+
handleChangeTabs={(value) => setTabs(value)}
|
|
46
|
+
handleDropEnd={() => {}}
|
|
47
|
+
draggable={true}
|
|
48
|
+
/>
|
|
49
|
+
</StorySection>
|
|
50
|
+
|
|
51
|
+
<StorySection
|
|
52
|
+
title="Overflow Wrap"
|
|
53
|
+
description="overflowWrap causes tabs to wrap onto a new row when they exceed the container width, instead of scrolling horizontally."
|
|
54
|
+
>
|
|
55
|
+
<Tabs
|
|
56
|
+
tabs={tabs}
|
|
57
|
+
selectedId={selectedId}
|
|
58
|
+
onClick={(id) => setSelectedId(id)}
|
|
59
|
+
overflowWrap
|
|
60
|
+
/>
|
|
61
|
+
</StorySection>
|
|
62
|
+
|
|
63
|
+
<StorySection
|
|
64
|
+
title="Link-based Navigation"
|
|
65
|
+
description="Omit onClick to render each tab as a Link using its href value. Useful for multi-page navigation."
|
|
66
|
+
>
|
|
67
|
+
<Tabs tabs={tabs} selectedId={selectedId} />
|
|
68
|
+
</StorySection>
|
|
69
|
+
|
|
70
|
+
<StorySection
|
|
71
|
+
title="Dark Mode"
|
|
72
|
+
description="Pass darkMode=true for use on dark backgrounds."
|
|
73
|
+
dark
|
|
74
|
+
>
|
|
49
75
|
<Tabs
|
|
50
76
|
tabs={tabs}
|
|
51
77
|
selectedId={selectedId}
|
|
52
|
-
onClick={(id) =>
|
|
53
|
-
setSelectedId(id);
|
|
54
|
-
}}
|
|
78
|
+
onClick={(id) => setSelectedId(id)}
|
|
55
79
|
darkMode={true}
|
|
56
80
|
/>
|
|
57
|
-
</
|
|
81
|
+
</StorySection>
|
|
58
82
|
</>
|
|
59
83
|
);
|
|
60
84
|
});
|