gbs-add-block 1.0.1 → 1.0.4
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/README.md +3 -3
- package/package.json +1 -1
- package/source/components/sidebar/components/MenuSection.tsx +1 -1
- package/source/components/sidebar/components/SidebarMenu.tsx +1 -1
- package/source/components/sidebar/hooks/useSidebarState.ts +1 -1
- package/source/components/sidebar/index.tsx +63 -9
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v1.0.
|
|
1
|
+
# GBS Building Blocks 2.0 (v1.0.4)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,13 +6,13 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
|
|
|
6
6
|
|
|
7
7
|
For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://blackmax-designs.gitbook.io/building-block-v2.0)
|
|
8
8
|
|
|
9
|
-
## What's New 🎉 (Ver 1.0.
|
|
9
|
+
## What's New 🎉 (Ver 1.0.4)
|
|
10
10
|
|
|
11
11
|
- Major Update with more stable features and Data Grid.
|
|
12
12
|
- Deprecated Grid Component, Use New Data Grid instead.
|
|
13
13
|
- More UI/UX Optimization.
|
|
14
14
|
- Animation improvements.
|
|
15
|
-
- Custom Components in SideBar
|
|
15
|
+
- Custom Components in SideBar and Mobile Screen Support
|
|
16
16
|
|
|
17
17
|
## Authors
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ type MenuSectionProps = {
|
|
|
5
5
|
section: MenuSectionType;
|
|
6
6
|
sectionIndex: number;
|
|
7
7
|
iconMap: Record<string, IconComponent>;
|
|
8
|
-
toggleItem: (sectionIndex: number, itemId: number) => void;
|
|
8
|
+
toggleItem: (sectionIndex: number, itemId: number | string) => void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const MenuSection = ({
|
|
@@ -4,7 +4,7 @@ import { MenuSection as MenuSectionComponent } from "./MenuSection";
|
|
|
4
4
|
type SidebarMenuProps = {
|
|
5
5
|
sections?: MenuSection[];
|
|
6
6
|
iconMap: Record<string, IconComponent>;
|
|
7
|
-
toggleItem: (sectionIndex: number, itemId: number) => void;
|
|
7
|
+
toggleItem: (sectionIndex: number, itemId: number | string) => void;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const SidebarMenu = ({
|
|
@@ -4,7 +4,7 @@ import { MenuData } from "../type";
|
|
|
4
4
|
export const useSidebarState = (menuData: MenuData) => {
|
|
5
5
|
const [sidebarData, setSidebarData] = useState<MenuData>(menuData);
|
|
6
6
|
|
|
7
|
-
const toggleItem = (sectionIndex: number, itemId: number): void => {
|
|
7
|
+
const toggleItem = (sectionIndex: number, itemId: number | string): void => {
|
|
8
8
|
const newData = { ...sidebarData };
|
|
9
9
|
|
|
10
10
|
const section = newData.sections?.[sectionIndex];
|
|
@@ -4,20 +4,74 @@ import { SidebarLogo } from "./components/SidebarLogo";
|
|
|
4
4
|
import { SidebarMenu } from "./components/SidebarMenu";
|
|
5
5
|
import { SidebarFooter } from "./components/SidebarFooter";
|
|
6
6
|
import { UserProfile } from "./components/UserProfile";
|
|
7
|
+
import Icon from "../icon/Icon";
|
|
8
|
+
import { menuIcon, x } from "../icon/iconPaths";
|
|
9
|
+
import { useState } from "react";
|
|
7
10
|
|
|
8
11
|
export function Sidebar({ menuData, iconMap }: SidebarProps) {
|
|
9
12
|
const { sidebarData, toggleItem } = useSidebarState(menuData);
|
|
13
|
+
const [showSideBarMobile, setShowSideBarMobile] = useState(false);
|
|
10
14
|
|
|
11
15
|
return (
|
|
12
|
-
<div
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
<div>
|
|
17
|
+
{/* Mobile menu button - only show when sidebar is closed */}
|
|
18
|
+
{!showSideBarMobile && (
|
|
19
|
+
<button
|
|
20
|
+
className="md:hidden flex items-center justify-between absolute p-4 border z-50 bg-white rounded-xl top-3 left-3"
|
|
21
|
+
onClick={() => setShowSideBarMobile(true)}
|
|
22
|
+
>
|
|
23
|
+
<Icon
|
|
24
|
+
elements={menuIcon}
|
|
25
|
+
svgClass={"stroke-black fill-none"}
|
|
26
|
+
dimensions={{ width: "18", height: "18" }}
|
|
27
|
+
/>
|
|
28
|
+
</button>
|
|
29
|
+
)}
|
|
30
|
+
|
|
31
|
+
{/* Mobile sidebar overlay */}
|
|
32
|
+
{showSideBarMobile && (
|
|
33
|
+
<div
|
|
34
|
+
className="md:hidden fixed inset-0 z-40"
|
|
35
|
+
onClick={() => setShowSideBarMobile(false)}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
|
|
39
|
+
{/* Mobile sidebar */}
|
|
40
|
+
<div
|
|
41
|
+
className={`md:hidden fixed left-0 top-0 h-screen bg-white w-64 border-r border-gray-200 z-40 transform transition-transform duration-300 ease-in-out ${
|
|
42
|
+
showSideBarMobile ? "translate-x-0" : "-translate-x-full"
|
|
43
|
+
}`}
|
|
44
|
+
>
|
|
45
|
+
<div className="flex items-center justify-between pr-4">
|
|
46
|
+
<SidebarLogo logo={sidebarData.logo} />
|
|
47
|
+
<button onClick={() => setShowSideBarMobile(false)}>
|
|
48
|
+
<Icon
|
|
49
|
+
elements={x}
|
|
50
|
+
svgClass={"stroke-black fill-none"}
|
|
51
|
+
dimensions={{ width: "18", height: "18" }}
|
|
52
|
+
/>
|
|
53
|
+
</button>
|
|
54
|
+
</div>
|
|
55
|
+
<SidebarMenu
|
|
56
|
+
sections={sidebarData.sections}
|
|
57
|
+
iconMap={iconMap}
|
|
58
|
+
toggleItem={toggleItem}
|
|
59
|
+
/>
|
|
60
|
+
<SidebarFooter footerItems={sidebarData.footer} iconMap={iconMap} />
|
|
61
|
+
<UserProfile profile={sidebarData.profile} />
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
{/* Desktop sidebar */}
|
|
65
|
+
<div className="hidden md:flex flex-col h-screen bg-white w-64 border-r border-gray-200 sticky left-0 top-0">
|
|
66
|
+
<SidebarLogo logo={sidebarData.logo} />
|
|
67
|
+
<SidebarMenu
|
|
68
|
+
sections={sidebarData.sections}
|
|
69
|
+
iconMap={iconMap}
|
|
70
|
+
toggleItem={toggleItem}
|
|
71
|
+
/>
|
|
72
|
+
<SidebarFooter footerItems={sidebarData.footer} iconMap={iconMap} />
|
|
73
|
+
<UserProfile profile={sidebarData.profile} />
|
|
74
|
+
</div>
|
|
21
75
|
</div>
|
|
22
76
|
);
|
|
23
77
|
}
|