@campxdev/react-blueprint 0.1.31 → 0.1.32
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/package.json +1 -1
- package/src/assets/images/svg/campx-logo.svg +32 -0
- package/src/components/Assets/Icons/IconComponents/BulbIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.tsx +56 -0
- package/src/components/Assets/Icons/IconComponents/DashBoardIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/HomeIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/InfoIcon.tsx +1 -1
- package/src/components/Assets/Icons/Icons.tsx +2 -0
- package/src/components/Input/Button/ButtonLoader.css +2 -1
- package/src/components/Layout/AppHeader/AppHeader.tsx +1 -14
- package/src/components/Layout/AppHeader/styles/styles.tsx +2 -2
- package/src/components/Layout/LayoutWrapper/styles.tsx +2 -2
- package/src/components/Layout/SideNavigation/SideNavigation.tsx +15 -22
- package/src/components/Navigation/FloatingSidebar/FloatingSidebar.tsx +82 -0
- package/src/components/Navigation/FloatingSidebar/styles.tsx +101 -0
- package/src/components/Navigation/exports.ts +2 -0
- package/src/stories/Layout/FloatingSidebar.stories.tsx +42 -0
- package/src/stories/Layout/LayoutWrapper.stories.tsx +6 -2
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1177.77 217.66">
|
|
2
|
+
<defs>
|
|
3
|
+
<style>
|
|
4
|
+
.cls-1, .cls-2, .cls-3 {
|
|
5
|
+
stroke-width: 0px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.cls-2 {
|
|
9
|
+
fill: #1e19f5;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.cls-3 {
|
|
13
|
+
fill: #121212;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
</defs>
|
|
17
|
+
<g id="Layer_1-2" data-name="Layer 1">
|
|
18
|
+
<g>
|
|
19
|
+
<g id="Group_4155" data-name="Group 4155">
|
|
20
|
+
<path class="cls-3" d="m189.83,186.55c-21.46,21.16-49.17,30.99-79.27,30.99C33.08,217.54.3,164.2,0,109.96-.3,55.43,35.17,0,110.56,0c28.31,0,55.13,10.73,76.59,31.89l-26.22,25.33c-13.71-13.41-32.18-19.67-50.36-19.67-50.36,0-72.12,37.55-71.82,72.41.3,34.57,20.26,70.63,71.82,70.63,18.18,0,38.74-7.45,52.45-21.16l26.82,27.12Z"/>
|
|
21
|
+
<path class="cls-3" d="m375.48,173.44h-109.07l-17.88,39.34h-42.61L299.49,4.17h42.91l93.57,208.6h-42.91l-17.58-39.34Zm-54.53-125.46l-38.74,88.8h77.48l-38.74-88.8Z"/>
|
|
22
|
+
<path class="cls-3" d="m652.33,61.69l-67.94,90.59h-7.75l-66.46-90.89v151.68h-39.34V4.47h45.3l65.26,89.7L646.66,4.47h45v208.6h-39.34V61.69Z"/>
|
|
23
|
+
<path class="cls-3" d="m789.7,151.39v61.39h-39.34V4.17c32.48,0,65.86-.3,98.34-.3,102.51,0,102.81,146.62,0,147.51h-59Zm0-36.06h59c50.36,0,50.07-73.91,0-73.91h-59v73.91Z"/>
|
|
24
|
+
<path id="Subtraction_8" data-name="Subtraction 8" class="cls-2" d="m1149.43,217.66h-50.26l-29.65-40.82,25.85-35.57,55,75.71-.94.68h0Zm-153.97,0h-50.36l-.94-.69,77.35-106.47L944.16,4.04l.52-.38h51.01l51.73,71.2h.01s25.9,35.63,25.9,35.63v.02s.03.05.03.05l-25.9,35.65-.04-.05-51.95,71.51h0Zm99.7-137.63h0l-25.85-35.57,29.64-40.8h50.9l.52.38-55.21,76Z"/>
|
|
25
|
+
</g>
|
|
26
|
+
<g>
|
|
27
|
+
<path class="cls-1" d="m1165.77,3.47c-2.37,0-4.69.7-6.67,2.02-1.97,1.32-3.51,3.19-4.42,5.39-.91,2.19-1.15,4.61-.68,6.93.46,2.33,1.61,4.47,3.28,6.14,1.68,1.68,3.82,2.82,6.14,3.28,2.33.46,4.74.23,6.93-.68,2.19-.91,4.07-2.45,5.39-4.42,1.32-1.97,2.02-4.29,2.02-6.67,0-3.18-1.26-6.23-3.51-8.49-2.25-2.25-5.3-3.51-8.49-3.51h0Zm0,21.6c-1.9,0-3.75-.56-5.33-1.62-1.58-1.05-2.81-2.55-3.54-4.31s-.92-3.68-.55-5.55c.37-1.86,1.28-3.57,2.63-4.92s3.05-2.26,4.92-2.63c1.86-.37,3.79-.18,5.55.55,1.75.73,3.25,1.96,4.31,3.54,1.05,1.58,1.62,3.43,1.62,5.33,0,2.55-1.01,4.99-2.81,6.79-1.8,1.8-4.24,2.81-6.79,2.81h0Z"/>
|
|
28
|
+
<path class="cls-1" d="m1170.57,13.07c0-.95-.38-1.87-1.05-2.55s-1.59-1.05-2.55-1.05h-6v12h2.4v-4.8h1.75l3.2,4.8h2.88l-3.3-4.94c.76-.2,1.43-.65,1.92-1.28.48-.62.74-1.39.75-2.18Zm-3.6,1.2h-3.6v-2.4h3.6c.32,0,.62.13.85.35.22.23.35.53.35.85s-.13.62-.35.85-.53.35-.85.35Z"/>
|
|
29
|
+
</g>
|
|
30
|
+
</g>
|
|
31
|
+
</g>
|
|
32
|
+
</svg>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const CampxFullLogoIcon = () => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
|
|
6
|
+
const color = theme.palette.mode === "dark" ? "#FFFFFF" : "#1e19f5";
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
id="Layer_2"
|
|
11
|
+
data-name="Layer 2"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
viewBox="0 0 1177.77 217.66"
|
|
14
|
+
style={{
|
|
15
|
+
strokeWidth: "0px",
|
|
16
|
+
fill: theme.palette.text.primary,
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
{/* <defs>
|
|
20
|
+
<style>
|
|
21
|
+
.cls-1, .cls-2, .cls-3 {
|
|
22
|
+
stroke-width: 0px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cls-2 {
|
|
26
|
+
fill: #1e19f5;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.cls-3 {
|
|
30
|
+
fill: #121212;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
33
|
+
</defs> */}
|
|
34
|
+
<g id="Layer_1-2" data-name="Layer 1">
|
|
35
|
+
<g>
|
|
36
|
+
<g id="Group_4155" data-name="Group 4155">
|
|
37
|
+
<path d="m189.83,186.55c-21.46,21.16-49.17,30.99-79.27,30.99C33.08,217.54.3,164.2,0,109.96-.3,55.43,35.17,0,110.56,0c28.31,0,55.13,10.73,76.59,31.89l-26.22,25.33c-13.71-13.41-32.18-19.67-50.36-19.67-50.36,0-72.12,37.55-71.82,72.41.3,34.57,20.26,70.63,71.82,70.63,18.18,0,38.74-7.45,52.45-21.16l26.82,27.12Z" />
|
|
38
|
+
<path d="m375.48,173.44h-109.07l-17.88,39.34h-42.61L299.49,4.17h42.91l93.57,208.6h-42.91l-17.58-39.34Zm-54.53-125.46l-38.74,88.8h77.48l-38.74-88.8Z" />
|
|
39
|
+
<path d="m652.33,61.69l-67.94,90.59h-7.75l-66.46-90.89v151.68h-39.34V4.47h45.3l65.26,89.7L646.66,4.47h45v208.6h-39.34V61.69Z" />
|
|
40
|
+
<path d="m789.7,151.39v61.39h-39.34V4.17c32.48,0,65.86-.3,98.34-.3,102.51,0,102.81,146.62,0,147.51h-59Zm0-36.06h59c50.36,0,50.07-73.91,0-73.91h-59v73.91Z" />
|
|
41
|
+
<path
|
|
42
|
+
id="Subtraction_8"
|
|
43
|
+
data-name="Subtraction 8"
|
|
44
|
+
style={{ fill: color }}
|
|
45
|
+
d="m1149.43,217.66h-50.26l-29.65-40.82,25.85-35.57,55,75.71-.94.68h0Zm-153.97,0h-50.36l-.94-.69,77.35-106.47L944.16,4.04l.52-.38h51.01l51.73,71.2h.01s25.9,35.63,25.9,35.63v.02s.03.05.03.05l-25.9,35.65-.04-.05-51.95,71.51h0Zm99.7-137.63h0l-25.85-35.57,29.64-40.8h50.9l.52.38-55.21,76Z"
|
|
46
|
+
/>
|
|
47
|
+
</g>
|
|
48
|
+
<g>
|
|
49
|
+
<path d="m1165.77,3.47c-2.37,0-4.69.7-6.67,2.02-1.97,1.32-3.51,3.19-4.42,5.39-.91,2.19-1.15,4.61-.68,6.93.46,2.33,1.61,4.47,3.28,6.14,1.68,1.68,3.82,2.82,6.14,3.28,2.33.46,4.74.23,6.93-.68,2.19-.91,4.07-2.45,5.39-4.42,1.32-1.97,2.02-4.29,2.02-6.67,0-3.18-1.26-6.23-3.51-8.49-2.25-2.25-5.3-3.51-8.49-3.51h0Zm0,21.6c-1.9,0-3.75-.56-5.33-1.62-1.58-1.05-2.81-2.55-3.54-4.31s-.92-3.68-.55-5.55c.37-1.86,1.28-3.57,2.63-4.92s3.05-2.26,4.92-2.63c1.86-.37,3.79-.18,5.55.55,1.75.73,3.25,1.96,4.31,3.54,1.05,1.58,1.62,3.43,1.62,5.33,0,2.55-1.01,4.99-2.81,6.79-1.8,1.8-4.24,2.81-6.79,2.81h0Z" />
|
|
50
|
+
<path d="m1170.57,13.07c0-.95-.38-1.87-1.05-2.55s-1.59-1.05-2.55-1.05h-6v12h2.4v-4.8h1.75l3.2,4.8h2.88l-3.3-4.94c.76-.2,1.43-.65,1.92-1.28.48-.62.74-1.39.75-2.18Zm-3.6,1.2h-3.6v-2.4h3.6c.32,0,.62.13.85.35.22.23.35.53.35.85s-.13.62-.35.85-.53.35-.85.35Z" />
|
|
51
|
+
</g>
|
|
52
|
+
</g>
|
|
53
|
+
</g>
|
|
54
|
+
</svg>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -29,6 +29,7 @@ import { TicketsIcon } from "./IconComponents/TicketsIcon";
|
|
|
29
29
|
import { UnCheckedCheckboxIcon } from "./IconComponents/UncheckCheckBoxIcon";
|
|
30
30
|
import { UnCheckedRadioIcon } from "./IconComponents/UncheckedRadioIcon";
|
|
31
31
|
import { AdministratorIcon } from "./IconComponents/AdministratorIcon";
|
|
32
|
+
import { CampxFullLogoIcon } from "./IconComponents/CampxFullLogoIcon";
|
|
32
33
|
export const Icons = {
|
|
33
34
|
AppsIcon,
|
|
34
35
|
CareerIcon,
|
|
@@ -60,4 +61,5 @@ export const Icons = {
|
|
|
60
61
|
ProductFeaturesIcon,
|
|
61
62
|
CampxIcon,
|
|
62
63
|
AdministratorIcon,
|
|
64
|
+
CampxFullLogoIcon,
|
|
63
65
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* HTML: <div class="buttonLoader"></div> */
|
|
2
2
|
.buttonLoader {
|
|
3
3
|
max-height: 40px;
|
|
4
|
-
padding:
|
|
4
|
+
padding: 10px 20px;
|
|
5
|
+
font-size: '14px';
|
|
5
6
|
aspect-ratio: 2.5;
|
|
6
7
|
--_g: no-repeat radial-gradient(farthest-side,#000 90%,#0000);
|
|
7
8
|
background: var(--_g), var(--_g), var(--_g), var(--_g);
|
|
@@ -26,20 +26,7 @@ export const AppHeader = ({
|
|
|
26
26
|
}: AppHeaderProps) => {
|
|
27
27
|
return (
|
|
28
28
|
<StyledHeader>
|
|
29
|
-
<
|
|
30
|
-
flexDirection={"row"}
|
|
31
|
-
alignItems={"center"}
|
|
32
|
-
gap={"20px"}
|
|
33
|
-
divider={<Divider orientation="vertical" flexItem />}
|
|
34
|
-
>
|
|
35
|
-
{/* {appsMenu && (
|
|
36
|
-
<Stack alignItems={"center"} gap={"12px"} flexDirection={"row"}>
|
|
37
|
-
{appsMenu}
|
|
38
|
-
</Stack>
|
|
39
|
-
)} */}
|
|
40
|
-
<CampxIcon />
|
|
41
|
-
<Typography variant={"subtitle2"}>{clientName}</Typography>
|
|
42
|
-
</Stack>
|
|
29
|
+
<Typography variant={"subtitle2"}>{clientName}</Typography>
|
|
43
30
|
<Stack alignItems={"center"} gap={"12px"} flexDirection={"row"}>
|
|
44
31
|
<StyledIconButton
|
|
45
32
|
onClick={() => {
|
|
@@ -7,12 +7,12 @@ export const StyledHeader = styled("header")(({ theme }) => ({
|
|
|
7
7
|
alignItems: "center",
|
|
8
8
|
width: "100%",
|
|
9
9
|
position: "fixed",
|
|
10
|
-
top:
|
|
10
|
+
top: "12px",
|
|
11
11
|
height: "60px",
|
|
12
12
|
backgroundColor: theme.palette.background.paper,
|
|
13
13
|
justifyContent: "space-between",
|
|
14
14
|
padding: "0 32px",
|
|
15
|
-
|
|
15
|
+
borderRadius: "8px",
|
|
16
16
|
}));
|
|
17
17
|
|
|
18
18
|
export const StyledActionBox = styled(Box)(({ theme }) => ({
|
|
@@ -40,12 +40,12 @@ export const Main = styled("main", {
|
|
|
40
40
|
export const StyledLayoutContainer = styled(Box)(({ theme }) => ({
|
|
41
41
|
width: "100%",
|
|
42
42
|
position: "fixed",
|
|
43
|
-
top: "
|
|
43
|
+
top: "60px",
|
|
44
44
|
backgroundColor: theme.palette.surface.defaultBackground,
|
|
45
45
|
}));
|
|
46
46
|
|
|
47
47
|
export const StyledMainContainer = styled("main")(() => ({
|
|
48
|
-
width: "90%",
|
|
48
|
+
// width: "90%",
|
|
49
49
|
margin: "auto",
|
|
50
50
|
overflowY: "auto",
|
|
51
51
|
display: "flex",
|
|
@@ -35,23 +35,21 @@ export const SideNavigation = ({
|
|
|
35
35
|
children,
|
|
36
36
|
}: SideNavigationProps) => {
|
|
37
37
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</StyledDrawer>
|
|
54
|
-
</Stack>
|
|
38
|
+
<StyledDrawer
|
|
39
|
+
variant={window.innerWidth > 1024 ? "persistent" : "temporary"}
|
|
40
|
+
anchor="left"
|
|
41
|
+
open={open}
|
|
42
|
+
onClose={handleDrawer}
|
|
43
|
+
>
|
|
44
|
+
<StyledBox>
|
|
45
|
+
{menu &&
|
|
46
|
+
menu.length > 0 &&
|
|
47
|
+
menu?.map((item: any, index: number) => (
|
|
48
|
+
<MenuItem menuItem={item} index={index} key={index} />
|
|
49
|
+
))}
|
|
50
|
+
<StyledContainer>{children}</StyledContainer>
|
|
51
|
+
</StyledBox>
|
|
52
|
+
</StyledDrawer>
|
|
55
53
|
);
|
|
56
54
|
};
|
|
57
55
|
|
|
@@ -65,13 +63,8 @@ const MenuItem = ({
|
|
|
65
63
|
const { path, icon: Icon, name, permissionKey, iconType } = menuItem;
|
|
66
64
|
|
|
67
65
|
let resolved = useResolvedPath(path);
|
|
68
|
-
// const permissions = PermissionsStore.useState((s) => s).permissions
|
|
69
66
|
let match = useMatch({ path: resolved.pathname, end: false });
|
|
70
67
|
|
|
71
|
-
// const hasAccess = permissionKey ? permissions[permissionKey] : accessIfNoKey
|
|
72
|
-
|
|
73
|
-
// if (!hasAccess) return null
|
|
74
|
-
|
|
75
68
|
return (
|
|
76
69
|
<StyledListItem key={path} disablePadding match={match}>
|
|
77
70
|
<StyledLinkButton
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { IconButton, ListItemIcon } from "@mui/material";
|
|
3
|
+
import { RightIcon } from "../../Assets/Icons/IconComponents/RightIcon";
|
|
4
|
+
import { LeftIcon } from "../../Assets/Icons/IconComponents/LeftIcon";
|
|
5
|
+
import { createSidebarStyles } from "./styles";
|
|
6
|
+
import { useMatch, useResolvedPath } from "react-router-dom";
|
|
7
|
+
import { Icons } from "../../export";
|
|
8
|
+
import { Typography } from "../../DataDisplay/Typography/Typography";
|
|
9
|
+
import { CampxIcon } from "../../Assets/Icons/IconComponents/CampxIcon";
|
|
10
|
+
import { CampxFullLogoIcon } from "../../Assets/Icons/IconComponents/CampxFullLogoIcon";
|
|
11
|
+
|
|
12
|
+
export interface MenuItemProps {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
icon?: any;
|
|
16
|
+
permissionKey?: string;
|
|
17
|
+
iconType?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const FloatingSidebar = ({ menu }: { menu: MenuItemProps[] }) => {
|
|
21
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
22
|
+
const {
|
|
23
|
+
StyledSidebarContainer,
|
|
24
|
+
StyledLogoArea,
|
|
25
|
+
StyledMenuBar,
|
|
26
|
+
StyledCollapsibleSection,
|
|
27
|
+
StyledListItem,
|
|
28
|
+
StyledLinkButton,
|
|
29
|
+
StyledListItemButton,
|
|
30
|
+
StyledListItemIcon,
|
|
31
|
+
} = createSidebarStyles(collapsed);
|
|
32
|
+
|
|
33
|
+
const toggleSidebar = () => {
|
|
34
|
+
setCollapsed(!collapsed);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const MenuItem = ({
|
|
38
|
+
menuItem,
|
|
39
|
+
index,
|
|
40
|
+
}: {
|
|
41
|
+
menuItem: MenuItemProps;
|
|
42
|
+
index: number;
|
|
43
|
+
}) => {
|
|
44
|
+
const { path, icon: Icon, name } = menuItem;
|
|
45
|
+
let resolved = useResolvedPath(path);
|
|
46
|
+
let match = useMatch({ path: resolved.pathname, end: false });
|
|
47
|
+
return (
|
|
48
|
+
<StyledListItem key={path} disablePadding match={match}>
|
|
49
|
+
<StyledLinkButton to={path} onClick={() => {}}>
|
|
50
|
+
<StyledListItemButton collapsed={collapsed}>
|
|
51
|
+
<StyledListItemIcon collapsed={collapsed}>
|
|
52
|
+
{Icon ? <Icon /> : <Icons.HomeIcon />}
|
|
53
|
+
</StyledListItemIcon>
|
|
54
|
+
{!collapsed && <Typography variant="subtitle3">{name}</Typography>}
|
|
55
|
+
</StyledListItemButton>
|
|
56
|
+
</StyledLinkButton>
|
|
57
|
+
</StyledListItem>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<StyledSidebarContainer direction="column" spacing={2}>
|
|
63
|
+
<StyledLogoArea collapsed={collapsed}>
|
|
64
|
+
{collapsed ? <CampxIcon /> : <CampxFullLogoIcon />}
|
|
65
|
+
</StyledLogoArea>
|
|
66
|
+
<StyledMenuBar>
|
|
67
|
+
{menu &&
|
|
68
|
+
menu.length > 0 &&
|
|
69
|
+
menu?.map((item: any, index: number) => (
|
|
70
|
+
<MenuItem menuItem={item} index={index} key={index} />
|
|
71
|
+
))}
|
|
72
|
+
</StyledMenuBar>
|
|
73
|
+
<StyledCollapsibleSection>
|
|
74
|
+
<IconButton onClick={toggleSidebar}>
|
|
75
|
+
{collapsed ? <RightIcon /> : <LeftIcon />}
|
|
76
|
+
</IconButton>
|
|
77
|
+
</StyledCollapsibleSection>
|
|
78
|
+
</StyledSidebarContainer>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default FloatingSidebar;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
ListItem,
|
|
4
|
+
ListItemButton,
|
|
5
|
+
ListItemIcon,
|
|
6
|
+
Stack,
|
|
7
|
+
} from "@mui/material";
|
|
8
|
+
import { styled, Theme } from "@mui/material/styles";
|
|
9
|
+
import { Link } from "react-router-dom";
|
|
10
|
+
|
|
11
|
+
export const createSidebarStyles = (collapsed: boolean) => {
|
|
12
|
+
const StyledSidebarContainer = styled(Stack)(({ theme }) => ({
|
|
13
|
+
height: "100vh",
|
|
14
|
+
width: collapsed ? "60px" : "240px",
|
|
15
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
16
|
+
position: "fixed",
|
|
17
|
+
left: "12px",
|
|
18
|
+
top: "12px",
|
|
19
|
+
bottom: "12px",
|
|
20
|
+
zIndex: 1000,
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const StyledLogoArea = styled(Box)(
|
|
24
|
+
({ theme, collapsed }: { theme?: any; collapsed: boolean }) => ({
|
|
25
|
+
display: "flex",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
padding: collapsed ? "0px" : "12px 36px",
|
|
29
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
30
|
+
height: "60px",
|
|
31
|
+
borderRadius: "8px",
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const StyledMenuBar = styled(Box)(({ theme }) => ({
|
|
36
|
+
flexGrow: 1,
|
|
37
|
+
borderRadius: "8px",
|
|
38
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
const StyledCollapsibleSection = styled(Box)(({ theme }) => ({
|
|
42
|
+
display: "flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
padding: theme.spacing(2),
|
|
46
|
+
borderRadius: "8px",
|
|
47
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
48
|
+
transition: "max-height 0.3s ease-out",
|
|
49
|
+
height: "60px",
|
|
50
|
+
}));
|
|
51
|
+
interface StyledListItemProps {
|
|
52
|
+
match: any;
|
|
53
|
+
}
|
|
54
|
+
const StyledListItem = styled(ListItem)<StyledListItemProps>(
|
|
55
|
+
({ theme, match }) => ({
|
|
56
|
+
backgroundColor: match ? theme.palette.secondary.main : "none",
|
|
57
|
+
width: "auto",
|
|
58
|
+
margin: "5px 8px",
|
|
59
|
+
borderRadius: "4px",
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const StyledLinkButton = styled(Link)({
|
|
64
|
+
width: "100%",
|
|
65
|
+
textDecoration: "none",
|
|
66
|
+
"&:hover": {
|
|
67
|
+
color: "unset",
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const StyledListItemButton = styled(ListItemButton)(
|
|
72
|
+
({ collapsed }: { collapsed: boolean }) => ({
|
|
73
|
+
display: "flex",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
justifyContent: collapsed ? "center" : "flex-start",
|
|
76
|
+
paddingBottom: "5px",
|
|
77
|
+
paddingTop: "5px",
|
|
78
|
+
width: "100%",
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const StyledListItemIcon = styled(ListItemIcon)(
|
|
83
|
+
({ collapsed }: { collapsed: boolean }) => ({
|
|
84
|
+
minWidth: "auto",
|
|
85
|
+
paddingRight: collapsed ? "0px" : "8px",
|
|
86
|
+
display: "flex",
|
|
87
|
+
justifyContent: "center",
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
StyledSidebarContainer,
|
|
93
|
+
StyledLogoArea,
|
|
94
|
+
StyledMenuBar,
|
|
95
|
+
StyledCollapsibleSection,
|
|
96
|
+
StyledListItem,
|
|
97
|
+
StyledLinkButton,
|
|
98
|
+
StyledListItemButton,
|
|
99
|
+
StyledListItemIcon,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
@@ -4,6 +4,7 @@ import { DropdownMenu } from "./DropDownMenu/DropDownMenu";
|
|
|
4
4
|
import { DropDownIcon } from "./DropDownMenu/DropDownIcon";
|
|
5
5
|
import { DropdownMenuItem } from "./DropDownMenu/DropdownMenuItem";
|
|
6
6
|
import { TabsContainer } from "./TabsContainer/TabsContainer";
|
|
7
|
+
import { FloatingSidebar } from "./FloatingSidebar/FloatingSidebar";
|
|
7
8
|
|
|
8
9
|
export {
|
|
9
10
|
CustomDialog,
|
|
@@ -12,4 +13,5 @@ export {
|
|
|
12
13
|
DropDownIcon,
|
|
13
14
|
DropdownMenuItem,
|
|
14
15
|
TabsContainer,
|
|
16
|
+
FloatingSidebar,
|
|
15
17
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { FloatingSidebar, Icons } from "../../components/export";
|
|
4
|
+
|
|
5
|
+
// Define the default export with Meta type including the component type
|
|
6
|
+
const meta: Meta<typeof FloatingSidebar> = {
|
|
7
|
+
title: "Navigation/FloatingSidebar",
|
|
8
|
+
component: FloatingSidebar,
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<Box
|
|
12
|
+
sx={{
|
|
13
|
+
display: "flex",
|
|
14
|
+
width: "100vw",
|
|
15
|
+
height: "100vh",
|
|
16
|
+
overflow: "hidden",
|
|
17
|
+
position: "relative",
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<Story />
|
|
21
|
+
</Box>
|
|
22
|
+
),
|
|
23
|
+
],
|
|
24
|
+
tags: ["autodocs"],
|
|
25
|
+
parameters: {
|
|
26
|
+
layout: "fullscreen", // Ensures that the story takes the full screen
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof FloatingSidebar>;
|
|
32
|
+
|
|
33
|
+
// Primary story
|
|
34
|
+
export const Primary: Story = {
|
|
35
|
+
render: (args) => <FloatingSidebar {...args} />,
|
|
36
|
+
args: {
|
|
37
|
+
menu: [
|
|
38
|
+
{ name: "Home", path: "/home", icon: Icons.DashBoardIcon },
|
|
39
|
+
{ name: "Self Service Portal", path: "/item2" },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -67,8 +67,12 @@ export const Primary: Story = {
|
|
|
67
67
|
open={open}
|
|
68
68
|
handleDrawer={handleClick}
|
|
69
69
|
menu={[
|
|
70
|
-
{
|
|
71
|
-
|
|
70
|
+
{
|
|
71
|
+
name: "Self Service Portal",
|
|
72
|
+
path: "/home",
|
|
73
|
+
icon: Icons.DashBoardIcon,
|
|
74
|
+
},
|
|
75
|
+
{ name: "Self Service Portal", path: "/item2" },
|
|
72
76
|
]}
|
|
73
77
|
/>
|
|
74
78
|
),
|