blixify-ui-web-mcp 0.1.2 → 0.1.18

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.
Files changed (135) hide show
  1. package/lib/components/action/button/README.md +12 -11
  2. package/lib/components/action/button/button.stories.tsx +4 -10
  3. package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +4 -10
  4. package/lib/components/action/iconButton/iconButton.stories.tsx +4 -10
  5. package/lib/components/action/radioList/radioList.stories.tsx +4 -10
  6. package/lib/components/action/slider/slider.stories.tsx +4 -10
  7. package/lib/components/action/textButton/textButton.stories.tsx +4 -10
  8. package/lib/components/action/toggle/toggle.stories.tsx +4 -10
  9. package/lib/components/advanced/collapse/collapse.stories.tsx +4 -10
  10. package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +4 -10
  11. package/lib/components/advanced/popUp/README.md +21 -7
  12. package/lib/components/advanced/popUp/popUp.stories.tsx +4 -10
  13. package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +30 -10
  14. package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +4 -10
  15. package/lib/components/auth/signIn/signIn.stories.tsx +4 -10
  16. package/lib/components/auth/signUp/signUp.stories.tsx +4 -10
  17. package/lib/components/chart/areaChart/areaChart.stories.tsx +7 -13
  18. package/lib/components/chart/barChart/barChart.stories.tsx +7 -13
  19. package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +8 -14
  20. package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +8 -14
  21. package/lib/components/chart/card/card.stories.tsx +4 -10
  22. package/lib/components/chart/ganttChart/README.md +96 -110
  23. package/lib/components/chart/ganttChart/ganttChart.stories.tsx +135 -125
  24. package/lib/components/chart/heatmapChart/README.md +93 -82
  25. package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +122 -84
  26. package/lib/components/chart/lineChart/lineChart.stories.tsx +4 -10
  27. package/lib/components/chart/pieChart/pieChart.stories.tsx +4 -10
  28. package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +8 -14
  29. package/lib/components/chart/radarChart/radarChart.stories.tsx +4 -10
  30. package/lib/components/chart/radialBar/radialChart.stories.tsx +4 -10
  31. package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +4 -10
  32. package/lib/components/chart/statsCard/statsCard.stories.tsx +4 -10
  33. package/lib/components/chart/treemapChart/treemapChart.stories.tsx +8 -14
  34. package/lib/components/chat/chatAnchor/README.md +61 -79
  35. package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +13 -19
  36. package/lib/components/chat/chatBase/README.md +244 -196
  37. package/lib/components/chat/chatBase/chatBase.stories.tsx +828 -250
  38. package/lib/components/chat/chatDashboard/README.md +89 -129
  39. package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +406 -117
  40. package/lib/components/data/dataGraph/README.md +135 -1
  41. package/lib/components/data/dataGraph/dataGraph.stories.tsx +90 -77
  42. package/lib/components/data/dataReference/README.md +141 -43
  43. package/lib/components/data/dataReference/dataReference.stories.tsx +111 -45
  44. package/lib/components/data/dataTemplate/README.md +88 -61
  45. package/lib/components/data/dataTemplate/dataModule.stories.tsx +4 -10
  46. package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +4 -10
  47. package/lib/components/data/dataWrapper/README.md +48 -46
  48. package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +258 -489
  49. package/lib/components/data/queryForm/queryForm.stories.tsx +4 -10
  50. package/lib/components/data/readQuery/readQuery.stories.tsx +4 -9
  51. package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +4 -10
  52. package/lib/components/data/writeQuery/writeQuery.stories.tsx +4 -8
  53. package/lib/components/design/actionSection/actionSection.stories.tsx +6 -10
  54. package/lib/components/design/banner/banner.stories.tsx +4 -10
  55. package/lib/components/design/bannerAction/bannerAction.stories.tsx +4 -10
  56. package/lib/components/design/blogSection/blogSection.stories.tsx +4 -10
  57. package/lib/components/design/carouselSection/carouselSection.stories.tsx +4 -10
  58. package/lib/components/design/designList/designList.stories.tsx +4 -10
  59. package/lib/components/design/faq/faq.stories.tsx +4 -10
  60. package/lib/components/design/fileGrid/fileGrid.stories.tsx +4 -10
  61. package/lib/components/design/fileViewer/fileViewer.stories.tsx +4 -10
  62. package/lib/components/design/footerSection/footerSection.stories.tsx +4 -10
  63. package/lib/components/design/googleReview/googleReview.stories.tsx +4 -10
  64. package/lib/components/design/heroSection/heroSection.stories.tsx +4 -10
  65. package/lib/components/design/iconList/iconList.stories.tsx +4 -10
  66. package/lib/components/design/imageGallery/imageGallery.stories.tsx +4 -10
  67. package/lib/components/design/imageZoom/imageZoom.stories.tsx +4 -10
  68. package/lib/components/design/leftContent/leftContent.stories.tsx +4 -10
  69. package/lib/components/design/logoCloud/logoCloud.stories.tsx +4 -10
  70. package/lib/components/design/onboarding/onboarding.stories.tsx +4 -10
  71. package/lib/components/design/pricing/pricing.stories.tsx +4 -10
  72. package/lib/components/design/rightContent/rightContent.stories.tsx +4 -10
  73. package/lib/components/design/sectionList/sectionList.stories.tsx +4 -10
  74. package/lib/components/design/teams/teams.stories.tsx +4 -10
  75. package/lib/components/display/alert/alert.stories.tsx +4 -10
  76. package/lib/components/display/calendar/README.md +49 -0
  77. package/lib/components/display/calendar/calendar.stories.tsx +71 -28
  78. package/lib/components/display/clipboard/clipboard.stories.tsx +4 -10
  79. package/lib/components/display/detailList/detailList.stories.tsx +5 -10
  80. package/lib/components/display/drawer/drawer.stories.tsx +5 -10
  81. package/lib/components/display/emptyState/emptyState.stories.tsx +4 -10
  82. package/lib/components/display/feeds/feeds.stories.tsx +4 -10
  83. package/lib/components/display/flexTable/README.md +11 -7
  84. package/lib/components/display/flexTable/flexTable.stories.tsx +114 -11
  85. package/lib/components/display/grid/README.md +28 -27
  86. package/lib/components/display/grid/grid.stories.tsx +4 -10
  87. package/lib/components/display/kanban/kanban.stories.tsx +14 -20
  88. package/lib/components/display/list/README.md +30 -29
  89. package/lib/components/display/list/list.stories.tsx +4 -10
  90. package/lib/components/display/loading/loading.stories.tsx +5 -10
  91. package/lib/components/display/mapView/mapView.stories.tsx +4 -10
  92. package/lib/components/display/modal/modal.stories.tsx +4 -11
  93. package/lib/components/display/notification/notification.stories.tsx +4 -10
  94. package/lib/components/display/progress/progress.stories.tsx +5 -10
  95. package/lib/components/display/stepper/stepper.stories.tsx +5 -10
  96. package/lib/components/display/table/README.md +38 -37
  97. package/lib/components/display/table/table.stories.tsx +8 -14
  98. package/lib/components/display/tag/tag.stories.tsx +4 -10
  99. package/lib/components/input/address/address.stories.tsx +4 -10
  100. package/lib/components/input/canvas/canvas.stories.tsx +4 -10
  101. package/lib/components/input/checkbox/checkbox.stories.tsx +4 -10
  102. package/lib/components/input/datePicker/datePicker.stories.tsx +4 -10
  103. package/lib/components/input/form/form.stories.tsx +4 -10
  104. package/lib/components/input/markdown/markdown.stories.tsx +5 -10
  105. package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +4 -10
  106. package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +4 -10
  107. package/lib/components/input/rating/rating.stories.tsx +4 -10
  108. package/lib/components/input/select/README.md +30 -29
  109. package/lib/components/input/select/select.stories.tsx +4 -10
  110. package/lib/components/input/signature/signature.stories.tsx +4 -10
  111. package/lib/components/input/textArea/textArea.stories.tsx +4 -10
  112. package/lib/components/input/textInput/textinput.stories.tsx +4 -10
  113. package/lib/components/input/uploadInput/uploadInput.stories.tsx +135 -11
  114. package/lib/components/navigation/bars/README.md +90 -17
  115. package/lib/components/navigation/bars/bars.stories.tsx +128 -60
  116. package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +5 -10
  117. package/lib/components/navigation/breadcrumb/README.md +40 -20
  118. package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +34 -14
  119. package/lib/components/navigation/header/README.md +67 -108
  120. package/lib/components/navigation/header/header.stories.tsx +165 -49
  121. package/lib/components/navigation/leftNav/README.md +121 -66
  122. package/lib/components/navigation/leftNav/leftNav.stories.tsx +178 -91
  123. package/lib/components/navigation/tabs/tabs.stories.tsx +57 -39
  124. package/lib/components/structure/column/column.stories.tsx +5 -10
  125. package/lib/components/structure/container/container.stories.tsx +5 -10
  126. package/lib/components/structure/link/link.stories.tsx +4 -10
  127. package/lib/components/structure/text/text.stories.tsx +5 -10
  128. package/lib/components/template/authPage/authPage.stories.tsx +6 -5
  129. package/lib/components/template/landingPage/landingPage.stories.tsx +8 -6
  130. package/lib/components/template/productListing/productListing.stories.tsx +7 -13
  131. package/lib/components/template/productOverview/productOverview.stories.tsx +5 -11
  132. package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +6 -12
  133. package/lib/components/template/userHomePage/userHomePage.stories.tsx +7 -6
  134. package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +5 -11
  135. package/package.json +1 -1
@@ -4,88 +4,143 @@
4
4
 
5
5
  <hr>
6
6
 
7
- Left Nav for Dashboard Template
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: "inspection",
16
- name: "Inspection",
17
- href: "/dashboard",
18
- icon: HomeIcon,
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: "defects",
22
- name: "Defects",
23
- href: "/dashboard/defects",
24
- icon: FolderIcon,
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
- return (
29
- <LeftNav
30
- selectedId="inspection"
31
- draggable={true}
32
- navigation={navigation}
33
- leftNavMobileMenu={mobile}
34
- handleChangeNavigation={(value) => {
35
- setNavigation(value);
36
- }}
37
- handleToggleLeftNavMobileMenu={() => {
38
- setMobile(!mobile);
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` | Selected ID of navigation |
56
- | `navigation` | `Navigation List` | Navigation list to render bars |
57
- | `leftNavMobileMenu` | `boolean` | Mobile menu activation |
58
- | `bgColor` | `string` | Content background color |
59
- | `handleToggleLeftNavMobileMenu` | `function` | Toggle mobile menu activation |
60
- | `renderDashboardLogo` | `function` | Render Logo |
61
- | `renderDashboardContent` | `function` | Render Content |
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 | Default | Description |
67
- | ------------------------------ | ------------------ | ------------------------------------------------ | --------------------------------------------------------------- |
68
- | `draggable` | `boolean` | `false` | `Make component items draggable` |
69
- | `handleChangeNavigation` | `function` | `(value) => {setNavigation(value)}` | `Required when draggable is true` |
70
- | `handleDropEnd` | `function` | `(value) => {}` | `Required when draggable is true` |
71
- | `renderDashboardFooterContent` | `function` | `null` | `Render Left Nav Footer` |
72
- | `linkProps` | `Link Props Class` | `Refer to Link Component for more documentation` | |
73
- | `transition` | `Transition Class` | `null` | |
74
- | `handleToggleCollapse` | `function` | `() => {}` | `Required when transition exist` |
75
- | `handleBarsOnClick` | `function` | `(id:string) => {}` | `Used for single page rendering setState instead of navigation` |
76
-
77
- ##### Navigation Class
78
-
79
- | Name | Type | Default | Description |
80
- | ------ | --------------- | ------- | ------------------ |
81
- | `id` | `string` | "" | ID of Menu |
82
- | `name` | `string` | "" | Name of Menu |
83
- | `href` | `string` | "" | Page Href |
84
- | `icon` | `React Element` | `` | Hero Icons Element |
85
-
86
- ##### Transition Class
87
-
88
- | Name | Type | Default | Description |
89
- | --------------- | --------- | ------- | ----------------------------------------- |
90
- | `headerVisible` | `boolean` | "true" | Render Header if it is true |
91
- | `collapse` | `boolean` | "false" | Left nav will be collapse when it is true |
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,106 +1,193 @@
1
- import { FolderIcon, HomeIcon } from "@heroicons/react/24/outline";
2
- import { storiesOf } from "@storybook/react";
3
- import React, { useEffect, useState } from "react";
1
+ import { FolderIcon, HomeIcon, UsersIcon } from "@heroicons/react/24/outline";
2
+ import React, { useState } from "react";
4
3
  import { LeftNav } from ".";
4
+ import { StorySection } from "../../storyUtils";
5
5
  import Logo from "../../../assets/logo.png";
6
- import README from "./README.md";
7
6
 
8
- const stories = storiesOf("Navigation", module);
7
+ const meta = { title: "Navigation/LeftNav" };
8
+ export default meta;
9
9
 
10
- stories.addParameters({
11
- readme: {
12
- content: README,
10
+
11
+ const baseNavigation = [
12
+ { id: "dashboard", name: "Dashboard", href: "/dashboard", icon: HomeIcon },
13
+ {
14
+ id: "defects",
15
+ name: "Defects",
16
+ href: "/dashboard/defects",
17
+ icon: FolderIcon,
18
+ },
19
+ {
20
+ id: "reports",
21
+ name: "Reports",
22
+ href: "/dashboard/reports",
23
+ icon: FolderIcon,
24
+ },
25
+ ];
26
+
27
+ const groupedNavigation = [
28
+ { id: "dashboard", name: "Dashboard", href: "/dashboard", icon: HomeIcon },
29
+ {
30
+ id: "teams",
31
+ name: "Teams",
32
+ href: "/teams",
33
+ icon: UsersIcon,
34
+ groupId: "People",
35
+ },
36
+ {
37
+ id: "engineering",
38
+ name: "Engineering",
39
+ href: "/teams/engineering",
40
+ icon: UsersIcon,
41
+ groupId: "People",
42
+ },
43
+ {
44
+ id: "hr",
45
+ name: "Human Resources",
46
+ href: "/teams/hr",
47
+ icon: UsersIcon,
48
+ groupId: "People",
13
49
  },
14
- });
50
+ {
51
+ id: "defects",
52
+ name: "Defects",
53
+ href: "/dashboard/defects",
54
+ icon: FolderIcon,
55
+ },
56
+ ];
15
57
 
16
- stories.add("LeftNav", () => {
17
- useEffect(() => {
18
- window.addEventListener("resize", checkViewportWidth);
58
+ const renderLogo = (collapse?: boolean) => (
59
+ <div className="flex items-center flex-shrink-0 px-6 cursor-pointer">
60
+ <img
61
+ className={`h-10 ${
62
+ collapse ? "w-1/4 object-contain lg:hidden" : "w-auto"
63
+ }`}
64
+ src={Logo}
65
+ alt="Logo"
66
+ />
67
+ </div>
68
+ );
19
69
 
20
- return () => {
21
- window.removeEventListener("resize", checkViewportWidth);
22
- };
23
- });
70
+ const renderContent = () => (
71
+ <div className="p-6 text-gray-500 text-sm">Dashboard content goes here.</div>
72
+ );
24
73
 
25
- const [mobile, setMobile] = useState(false);
26
- const [navigation, setNavigation] = useState([
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
- ]);
74
+ const renderHeader = () => (
75
+ <div className="px-4 text-sm font-medium text-gray-700">Page Title</div>
76
+ );
61
77
 
78
+ export const LeftNavStory = () => {
79
+ const [mobile, setMobile] = useState(false);
80
+ const [selectedId, setSelectedId] = useState("dashboard");
81
+ const [navigation] = useState(baseNavigation);
62
82
  const [collapse, setCollapse] = useState(false);
63
-
64
- const checkViewportWidth = () => {
65
- const laptop = 1024;
66
- if (window.innerWidth <= laptop) {
67
- setCollapse(false);
68
- }
69
- };
83
+ const [groupedNav, setGroupedNav] = useState(groupedNavigation);
84
+ const [darkMobile, setDarkMobile] = useState(false);
70
85
 
71
86
  return (
72
- <LeftNav
73
- selectedId="inspection"
74
- navigation={navigation}
75
- leftNavMobileMenu={mobile}
76
- draggable={true}
77
- transition={{
78
- headerVisible: undefined,
79
- collapse,
80
- }}
81
- handleToggleCollapse={() => {
82
- setCollapse(!collapse);
83
- }}
84
- handleChangeNavigation={(value) => {
85
- setNavigation(value);
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"
87
+ <>
88
+ <StorySection
89
+ title="Default"
90
+ 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."
91
+ >
92
+ <div className="w-full h-96 relative overflow-hidden border rounded-lg">
93
+ <LeftNav
94
+ selectedId={selectedId}
95
+ navigation={navigation}
96
+ leftNavMobileMenu={mobile}
97
+ handleBarsOnClick={(id) => setSelectedId(id)}
98
+ handleToggleLeftNavMobileMenu={() => setMobile(!mobile)}
99
+ renderDashboardLogo={() => renderLogo()}
100
+ renderDashboardContent={renderContent}
101
+ renderDashboardHeaderContent={renderHeader}
99
102
  />
100
103
  </div>
101
- )}
102
- renderDashboardContent={() => {}}
103
- renderDashboardHeaderContent={() => {}}
104
- />
104
+ </StorySection>
105
+
106
+ <StorySection
107
+ title="Draggable + Grouped Items"
108
+ 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."
109
+ >
110
+ <div className="w-full h-96 relative overflow-hidden border rounded-lg">
111
+ <LeftNav
112
+ selectedId={selectedId}
113
+ navigation={groupedNav}
114
+ leftNavMobileMenu={false}
115
+ draggable={true}
116
+ handleBarsOnClick={(id) => setSelectedId(id)}
117
+ handleChangeNavigation={(value) => setGroupedNav(value)}
118
+ handleDropEnd={() => {}}
119
+ handleToggleLeftNavMobileMenu={() => {}}
120
+ renderDashboardLogo={() => renderLogo()}
121
+ renderDashboardContent={renderContent}
122
+ renderDashboardHeaderContent={renderHeader}
123
+ />
124
+ </div>
125
+ </StorySection>
126
+
127
+ <StorySection
128
+ title="Collapsible Sidebar"
129
+ 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."
130
+ >
131
+ <div className="w-full h-96 relative overflow-hidden border rounded-lg">
132
+ <LeftNav
133
+ selectedId={selectedId}
134
+ navigation={navigation}
135
+ leftNavMobileMenu={false}
136
+ transition={{ headerVisible: true, collapse }}
137
+ handleBarsOnClick={(id) => setSelectedId(id)}
138
+ handleToggleCollapse={() => setCollapse(!collapse)}
139
+ handleToggleLeftNavMobileMenu={() => {}}
140
+ renderDashboardLogo={() => renderLogo(collapse)}
141
+ renderDashboardContent={renderContent}
142
+ renderDashboardHeaderContent={renderHeader}
143
+ />
144
+ </div>
145
+ </StorySection>
146
+
147
+ <StorySection
148
+ title="Footer Content"
149
+ description="renderDashboardFooterContent renders a slot at the bottom of the sidebar, above the border. Useful for user profile info or a sign-out button."
150
+ >
151
+ <div className="w-full h-96 relative overflow-hidden border rounded-lg">
152
+ <LeftNav
153
+ selectedId={selectedId}
154
+ navigation={navigation}
155
+ leftNavMobileMenu={false}
156
+ handleBarsOnClick={(id) => setSelectedId(id)}
157
+ handleToggleLeftNavMobileMenu={() => {}}
158
+ renderDashboardLogo={() => renderLogo()}
159
+ renderDashboardContent={renderContent}
160
+ renderDashboardHeaderContent={renderHeader}
161
+ renderDashboardFooterContent={() => (
162
+ <div className="text-sm text-gray-500">v1.0.0</div>
163
+ )}
164
+ />
165
+ </div>
166
+ </StorySection>
167
+
168
+ <StorySection
169
+ title="Dark Mode"
170
+ description="darkMode=true switches the sidebar and header to a dark theme. bgColor and navbarBgColor override the default background colours."
171
+ dark
172
+ >
173
+ <div className="w-full h-96 relative overflow-hidden border border-gray-700 rounded-lg">
174
+ <LeftNav
175
+ selectedId={selectedId}
176
+ navigation={navigation}
177
+ leftNavMobileMenu={darkMobile}
178
+ darkMode={true}
179
+ handleBarsOnClick={(id) => setSelectedId(id)}
180
+ handleToggleLeftNavMobileMenu={() => setDarkMobile(!darkMobile)}
181
+ renderDashboardLogo={() => renderLogo()}
182
+ renderDashboardContent={() => (
183
+ <div className="p-6 text-gray-400 text-sm">
184
+ Dashboard content.
185
+ </div>
186
+ )}
187
+ renderDashboardHeaderContent={renderHeader}
188
+ />
189
+ </div>
190
+ </StorySection>
191
+ </>
105
192
  );
106
- });
193
+ }
@@ -1,16 +1,12 @@
1
- import { storiesOf } from "@storybook/react";
2
1
  import React, { useState } from "react";
3
2
  import { Tabs } from ".";
4
- import README from "./README.md";
5
- const stories = storiesOf("Navigation", module);
3
+ import { StorySection } from "../../storyUtils";
6
4
 
7
- stories.addParameters({
8
- readme: {
9
- content: README,
10
- },
11
- });
5
+ const meta = { title: "Navigation/Tabs" };
6
+ export default meta;
12
7
 
13
- stories.add("Tabs", () => {
8
+
9
+ export const TabsStory = () => {
14
10
  const [selectedId, setSelectedId] = useState("account");
15
11
  const [tabs, setTabs] = useState([
16
12
  { id: "account", name: "My Account", href: "#" },
@@ -21,40 +17,62 @@ stories.add("Tabs", () => {
21
17
 
22
18
  return (
23
19
  <>
24
- <h1 className="mb-2 text-lg font-bold">Default</h1>
25
- <Tabs
26
- tabs={tabs}
27
- selectedId={selectedId}
28
- onClick={(id) => {
29
- setSelectedId(id);
30
- }}
31
- handleChangeTabs={(value) => setTabs(value)}
32
- handleDropEnd={() => {}}
33
- draggable={true}
34
- />
35
- <h1 className="mt-8 text-lg font-bold">Overflow Wrap</h1>
36
- <p className="mb-2 text-sm text-gray-500">
37
- Wrap tab options to new row when there's an overflow.
38
- </p>
39
- <Tabs
40
- tabs={tabs}
41
- selectedId={selectedId}
42
- onClick={(id) => {
43
- setSelectedId(id);
44
- }}
45
- overflowWrap
46
- />
47
- <h1 className="mt-8 mb-2 text-lg font-bold">Dark Mode</h1>
48
- <div className="p-4 bg-black rounded-lg">
20
+ <StorySection
21
+ title="Default"
22
+ description="Basic tab bar. Pass onClick to handle selection and selectedId to highlight the active tab."
23
+ >
24
+ <Tabs
25
+ tabs={tabs}
26
+ selectedId={selectedId}
27
+ onClick={(id) => setSelectedId(id)}
28
+ />
29
+ </StorySection>
30
+
31
+ <StorySection
32
+ title="Draggable"
33
+ description="Set draggable=true and provide handleChangeTabs to persist the new order. handleDropEnd fires when the drag interaction ends."
34
+ >
35
+ <Tabs
36
+ tabs={tabs}
37
+ selectedId={selectedId}
38
+ onClick={(id) => setSelectedId(id)}
39
+ handleChangeTabs={(value) => setTabs(value)}
40
+ handleDropEnd={() => {}}
41
+ draggable={true}
42
+ />
43
+ </StorySection>
44
+
45
+ <StorySection
46
+ title="Overflow Wrap"
47
+ description="overflowWrap causes tabs to wrap onto a new row when they exceed the container width, instead of scrolling horizontally."
48
+ >
49
+ <Tabs
50
+ tabs={tabs}
51
+ selectedId={selectedId}
52
+ onClick={(id) => setSelectedId(id)}
53
+ overflowWrap
54
+ />
55
+ </StorySection>
56
+
57
+ <StorySection
58
+ title="Link-based Navigation"
59
+ description="Omit onClick to render each tab as a Link using its href value. Useful for multi-page navigation."
60
+ >
61
+ <Tabs tabs={tabs} selectedId={selectedId} />
62
+ </StorySection>
63
+
64
+ <StorySection
65
+ title="Dark Mode"
66
+ description="Pass darkMode=true for use on dark backgrounds."
67
+ dark
68
+ >
49
69
  <Tabs
50
70
  tabs={tabs}
51
71
  selectedId={selectedId}
52
- onClick={(id) => {
53
- setSelectedId(id);
54
- }}
72
+ onClick={(id) => setSelectedId(id)}
55
73
  darkMode={true}
56
74
  />
57
- </div>
75
+ </StorySection>
58
76
  </>
59
77
  );
60
- });
78
+ }
@@ -1,16 +1,11 @@
1
- import { storiesOf } from "@storybook/react";
2
1
  import React from "react";
3
2
  import { Column } from ".";
4
- import README from "./README.md";
5
- const stories = storiesOf("Structure", module);
6
3
 
7
- stories.addParameters({
8
- readme: {
9
- content: README,
10
- },
11
- });
4
+ const meta = { title: "Structure/Column" };
5
+ export default meta;
12
6
 
13
- stories.add("Column", () => {
7
+
8
+ export const ColumnStory = () => {
14
9
  return (
15
10
  <>
16
11
  <Column orientation="row" mobileBp="sm" className="bg-gray-50">
@@ -23,4 +18,4 @@ stories.add("Column", () => {
23
18
  </Column>
24
19
  </>
25
20
  );
26
- });
21
+ }