@campxdev/react-blueprint 0.1.31 → 0.1.33
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/App.tsx +1 -0
- 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 +4 -15
- package/src/components/Layout/AppHeader/styles/styles.tsx +21 -13
- 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/components/export.ts +0 -2
- package/src/stories/Layout/AppHeader.stories.tsx +1 -23
- package/src/stories/Navigation/FloatingSidebar.stories.tsx +42 -0
- package/src/components/Layout/LayoutWrapper/LayoutWrapper.tsx +0 -73
- package/src/components/Layout/LayoutWrapper/styles.tsx +0 -52
- package/src/components/Layout/SideNavigation/SideNavigation.tsx +0 -100
- package/src/components/Layout/SideNavigation/styles/styles.tsx +0 -58
- package/src/stories/Layout/LayoutWrapper.stories.tsx +0 -95
- package/src/stories/Layout/SideNavigation.stories.tsx +0 -57
package/package.json
CHANGED
package/src/App.tsx
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);
|
|
@@ -15,6 +15,7 @@ export interface AppHeaderProps {
|
|
|
15
15
|
clientLogoUrl?: string;
|
|
16
16
|
clientName: string;
|
|
17
17
|
userFullName: string;
|
|
18
|
+
collapsed: boolean;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export const AppHeader = ({
|
|
@@ -23,23 +24,11 @@ export const AppHeader = ({
|
|
|
23
24
|
clientLogoUrl,
|
|
24
25
|
clientName,
|
|
25
26
|
userFullName,
|
|
27
|
+
collapsed,
|
|
26
28
|
}: AppHeaderProps) => {
|
|
27
29
|
return (
|
|
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>
|
|
30
|
+
<StyledHeader collapsed={collapsed}>
|
|
31
|
+
<Typography variant={"subtitle2"}>{clientName}</Typography>
|
|
43
32
|
<Stack alignItems={"center"} gap={"12px"} flexDirection={"row"}>
|
|
44
33
|
<StyledIconButton
|
|
45
34
|
onClick={() => {
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { Box, styled } from "@mui/material";
|
|
2
2
|
import { Link } from "react-router-dom";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const sidebarWidth = { collapsed: "60px", expanded: "240px" };
|
|
5
|
+
|
|
6
|
+
export const StyledHeader = styled("header")(
|
|
7
|
+
({ theme, collapsed }: { theme?: any; collapsed: boolean }) => ({
|
|
8
|
+
display: "flex",
|
|
9
|
+
position: "fixed",
|
|
10
|
+
flexDirection: "row",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
width:
|
|
13
|
+
"calc(100% - 12px - " +
|
|
14
|
+
(collapsed ? sidebarWidth.collapsed : sidebarWidth.expanded) +
|
|
15
|
+
")",
|
|
16
|
+
top: "12px",
|
|
17
|
+
left: collapsed ? sidebarWidth.collapsed : sidebarWidth.expanded,
|
|
18
|
+
height: "60px",
|
|
19
|
+
backgroundColor: theme.palette.background.paper,
|
|
20
|
+
justifyContent: "space-between",
|
|
21
|
+
padding: "0 32px",
|
|
22
|
+
borderRadius: "8px",
|
|
23
|
+
})
|
|
24
|
+
);
|
|
17
25
|
|
|
18
26
|
export const StyledActionBox = styled(Box)(({ theme }) => ({
|
|
19
27
|
marginRight: "20px",
|
|
@@ -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
|
};
|
package/src/components/export.ts
CHANGED
|
@@ -4,8 +4,6 @@ export * from "./Input/export";
|
|
|
4
4
|
export * from "./Layout/AppHeader/AppHeader";
|
|
5
5
|
|
|
6
6
|
export * from "./Layout/AppHeader/AppsMenu";
|
|
7
|
-
export * from "./Layout/LayoutWrapper/LayoutWrapper";
|
|
8
7
|
export * from "./Layout/PageContent/PageContent";
|
|
9
|
-
export * from "./Layout/SideNavigation/SideNavigation";
|
|
10
8
|
export * from "./Navigation/exports";
|
|
11
9
|
export * from "./Feedback/exports";
|
|
@@ -41,28 +41,6 @@ export const Primary: Story = {
|
|
|
41
41
|
actions: [<p>asdjflsf</p>],
|
|
42
42
|
// appsMenu: <AppsMenu apps={["exams", "square", "admin"]} />,
|
|
43
43
|
userFullName: "Srikanth Yellapragada",
|
|
44
|
+
collapsed: false,
|
|
44
45
|
},
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
// Story with no apps menu
|
|
48
|
-
export const WithAppsMenu: Story = {
|
|
49
|
-
render: (args: AppHeaderProps) => (
|
|
50
|
-
<AppHeader
|
|
51
|
-
{...args}
|
|
52
|
-
appsMenu={
|
|
53
|
-
<AppsMenu
|
|
54
|
-
apps={[
|
|
55
|
-
"exams",
|
|
56
|
-
"square",
|
|
57
|
-
"admin",
|
|
58
|
-
"enroll",
|
|
59
|
-
"payments",
|
|
60
|
-
"hrms",
|
|
61
|
-
"hostels",
|
|
62
|
-
"commute_x",
|
|
63
|
-
]}
|
|
64
|
-
/>
|
|
65
|
-
}
|
|
66
|
-
/>
|
|
67
|
-
),
|
|
68
|
-
};
|
|
@@ -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
|
+
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Box, IconButton, Stack, Typography } from "@mui/material";
|
|
2
|
-
|
|
3
|
-
import MenuIcon from "@mui/icons-material/Menu";
|
|
4
|
-
import { ReactNode, useState } from "react";
|
|
5
|
-
import { activeStore } from "../../../store/activeStore";
|
|
6
|
-
import { Icons } from "../../export";
|
|
7
|
-
import { Main, StyledLayoutContainer, StyledMainContainer } from "./styles";
|
|
8
|
-
|
|
9
|
-
export interface LayoutWrapperProps {
|
|
10
|
-
title?: string;
|
|
11
|
-
actionButtons?: ReactNode[];
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
sideBar: (props: {
|
|
14
|
-
open: boolean;
|
|
15
|
-
handleClick: (e: any) => void;
|
|
16
|
-
}) => ReactNode;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const LayoutWrapper = ({
|
|
20
|
-
children,
|
|
21
|
-
title,
|
|
22
|
-
sideBar,
|
|
23
|
-
}: LayoutWrapperProps) => {
|
|
24
|
-
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
25
|
-
const { open } = activeStore.useState((s) => s);
|
|
26
|
-
|
|
27
|
-
const handleClick = () => {
|
|
28
|
-
activeStore.update((s) => {
|
|
29
|
-
s.open = !open;
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<StyledLayoutContainer>
|
|
35
|
-
<StyledMainContainer>
|
|
36
|
-
<Box>
|
|
37
|
-
<Stack
|
|
38
|
-
direction={"row"}
|
|
39
|
-
width={"100%"}
|
|
40
|
-
justifyContent={"space-between"}
|
|
41
|
-
>
|
|
42
|
-
<Stack direction={"row"} alignItems={"center"}>
|
|
43
|
-
<IconButton
|
|
44
|
-
color="inherit"
|
|
45
|
-
aria-label="open drawer"
|
|
46
|
-
onClick={handleClick}
|
|
47
|
-
edge="start"
|
|
48
|
-
sx={{ mr: 0.5, padding: "6px", marginLeft: "0px" }}
|
|
49
|
-
onMouseEnter={() => setIsHovered(true)}
|
|
50
|
-
onMouseLeave={() => setIsHovered(false)}
|
|
51
|
-
>
|
|
52
|
-
{open && isHovered ? (
|
|
53
|
-
<Icons.LeftIcon />
|
|
54
|
-
) : !open && isHovered ? (
|
|
55
|
-
<Icons.RightIcon />
|
|
56
|
-
) : (
|
|
57
|
-
<MenuIcon />
|
|
58
|
-
)}
|
|
59
|
-
</IconButton>
|
|
60
|
-
<Typography variant="subtitle1" noWrap>
|
|
61
|
-
{title ? title : ""}
|
|
62
|
-
</Typography>
|
|
63
|
-
</Stack>
|
|
64
|
-
</Stack>
|
|
65
|
-
|
|
66
|
-
{sideBar({ open: open, handleClick: handleClick })}
|
|
67
|
-
</Box>
|
|
68
|
-
|
|
69
|
-
<Main open={open}>{children}</Main>
|
|
70
|
-
</StyledMainContainer>
|
|
71
|
-
</StyledLayoutContainer>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Box, styled } from "@mui/material";
|
|
2
|
-
|
|
3
|
-
const drawerWidth: number = 240;
|
|
4
|
-
|
|
5
|
-
export const Main = styled("main", {
|
|
6
|
-
shouldForwardProp: (prop) => prop !== "open",
|
|
7
|
-
})<{
|
|
8
|
-
open?: boolean;
|
|
9
|
-
}>(({ theme, open }) => ({
|
|
10
|
-
padding: "0px 25px",
|
|
11
|
-
transition: theme.transitions.create("margin", {
|
|
12
|
-
easing: theme.transitions.easing.sharp,
|
|
13
|
-
duration: theme.transitions.duration.leavingScreen,
|
|
14
|
-
}),
|
|
15
|
-
marginLeft: `-${drawerWidth}px`,
|
|
16
|
-
...(open && {
|
|
17
|
-
transition: theme.transitions.create("margin", {
|
|
18
|
-
easing: theme.transitions.easing.easeOut,
|
|
19
|
-
duration: theme.transitions.duration.enteringScreen,
|
|
20
|
-
}),
|
|
21
|
-
marginLeft: 0,
|
|
22
|
-
}),
|
|
23
|
-
width: "100%",
|
|
24
|
-
overflowY: "auto",
|
|
25
|
-
borderRadius: "5px",
|
|
26
|
-
"&::-webkit-scrollbar": {
|
|
27
|
-
width: "0.4em",
|
|
28
|
-
height: "0.4em",
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
"&::-webkit-scrollbar-thumb": {
|
|
32
|
-
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
33
|
-
borderRadius: "3px",
|
|
34
|
-
},
|
|
35
|
-
"@media (max-width: 1024px)": {
|
|
36
|
-
marginLeft: "-50px",
|
|
37
|
-
},
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
export const StyledLayoutContainer = styled(Box)(({ theme }) => ({
|
|
41
|
-
width: "100%",
|
|
42
|
-
position: "fixed",
|
|
43
|
-
top: "80px",
|
|
44
|
-
backgroundColor: theme.palette.surface.defaultBackground,
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
export const StyledMainContainer = styled("main")(() => ({
|
|
48
|
-
width: "90%",
|
|
49
|
-
margin: "auto",
|
|
50
|
-
overflowY: "auto",
|
|
51
|
-
display: "flex",
|
|
52
|
-
}));
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { ListItemIcon, Stack } from "@mui/material";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
import { useMatch, useResolvedPath } from "react-router-dom";
|
|
4
|
-
import { activeStore } from "../../../store/activeStore";
|
|
5
|
-
import { Typography } from "../../DataDisplay/Typography/Typography";
|
|
6
|
-
import { Icons } from "../../export";
|
|
7
|
-
import {
|
|
8
|
-
StyledBox,
|
|
9
|
-
StyledContainer,
|
|
10
|
-
StyledDrawer,
|
|
11
|
-
StyledLinkButton,
|
|
12
|
-
StyledListItem,
|
|
13
|
-
StyledListItemButton,
|
|
14
|
-
} from "./styles/styles";
|
|
15
|
-
|
|
16
|
-
export interface SideNavigationProps {
|
|
17
|
-
menu?: MenuItemProps[];
|
|
18
|
-
children?: ReactNode;
|
|
19
|
-
open?: any;
|
|
20
|
-
handleDrawer?: any;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface MenuItemProps {
|
|
24
|
-
name: string;
|
|
25
|
-
path: string;
|
|
26
|
-
icon?: any;
|
|
27
|
-
permissionKey?: string;
|
|
28
|
-
iconType?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const SideNavigation = ({
|
|
32
|
-
menu,
|
|
33
|
-
open,
|
|
34
|
-
handleDrawer,
|
|
35
|
-
children,
|
|
36
|
-
}: SideNavigationProps) => {
|
|
37
|
-
return (
|
|
38
|
-
<Stack gap="20px" direction={"row"} marginTop={"10px"}>
|
|
39
|
-
<StyledDrawer
|
|
40
|
-
variant={window.innerWidth > 1024 ? "persistent" : "temporary"}
|
|
41
|
-
anchor="left"
|
|
42
|
-
open={open}
|
|
43
|
-
onClose={handleDrawer}
|
|
44
|
-
>
|
|
45
|
-
<StyledBox>
|
|
46
|
-
{menu &&
|
|
47
|
-
menu.length > 0 &&
|
|
48
|
-
menu?.map((item: any, index: number) => (
|
|
49
|
-
<MenuItem menuItem={item} index={index} key={index} />
|
|
50
|
-
))}
|
|
51
|
-
<StyledContainer>{children}</StyledContainer>
|
|
52
|
-
</StyledBox>
|
|
53
|
-
</StyledDrawer>
|
|
54
|
-
</Stack>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const MenuItem = ({
|
|
59
|
-
menuItem,
|
|
60
|
-
index,
|
|
61
|
-
}: {
|
|
62
|
-
menuItem: MenuItemProps;
|
|
63
|
-
index: number;
|
|
64
|
-
}) => {
|
|
65
|
-
const { path, icon: Icon, name, permissionKey, iconType } = menuItem;
|
|
66
|
-
|
|
67
|
-
let resolved = useResolvedPath(path);
|
|
68
|
-
// const permissions = PermissionsStore.useState((s) => s).permissions
|
|
69
|
-
let match = useMatch({ path: resolved.pathname, end: false });
|
|
70
|
-
|
|
71
|
-
// const hasAccess = permissionKey ? permissions[permissionKey] : accessIfNoKey
|
|
72
|
-
|
|
73
|
-
// if (!hasAccess) return null
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<StyledListItem key={path} disablePadding match={match}>
|
|
77
|
-
<StyledLinkButton
|
|
78
|
-
to={path}
|
|
79
|
-
style={{ width: "100%" }}
|
|
80
|
-
onClick={() =>
|
|
81
|
-
activeStore.update((s) => {
|
|
82
|
-
s.active = index;
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
>
|
|
86
|
-
<StyledListItemButton>
|
|
87
|
-
<ListItemIcon
|
|
88
|
-
sx={{
|
|
89
|
-
minWidth: "16px",
|
|
90
|
-
marginRight: "8px",
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
{Icon ? <Icon /> : <Icons.HomeIcon />}
|
|
94
|
-
</ListItemIcon>
|
|
95
|
-
<Typography variant="subtitle3">{name}</Typography>
|
|
96
|
-
</StyledListItemButton>
|
|
97
|
-
</StyledLinkButton>
|
|
98
|
-
</StyledListItem>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Box, Drawer, ListItem, ListItemButton, styled } from "@mui/material";
|
|
2
|
-
import { Link } from "react-router-dom";
|
|
3
|
-
const drawerWidth: number = 240;
|
|
4
|
-
|
|
5
|
-
export const StyledDrawer = styled(Drawer)(() => ({
|
|
6
|
-
width: drawerWidth,
|
|
7
|
-
flexShrink: 0,
|
|
8
|
-
"& .MuiDrawer-paper": {
|
|
9
|
-
width: drawerWidth,
|
|
10
|
-
boxSizing: "border-box",
|
|
11
|
-
position: "unset",
|
|
12
|
-
transition: "none !important",
|
|
13
|
-
borderRight: "none !important",
|
|
14
|
-
borderRadius: "5px",
|
|
15
|
-
},
|
|
16
|
-
"@media (max-width: 1024px)": {
|
|
17
|
-
"& .MuiDrawer-paper": {
|
|
18
|
-
borderRadius: "0px",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
interface StyledListItemProps {
|
|
24
|
-
match: any;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const StyledListItem = styled(ListItem)<StyledListItemProps>(
|
|
28
|
-
({ theme, match }) => ({
|
|
29
|
-
backgroundColor: match ? theme.palette.secondary.main : "none",
|
|
30
|
-
width: "auto",
|
|
31
|
-
margin: "5px 8px",
|
|
32
|
-
borderRadius: "5px",
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
export const StyledContainer = styled(Box)(({ theme }) => ({
|
|
37
|
-
width: "auto",
|
|
38
|
-
margin: "5px 10px",
|
|
39
|
-
}));
|
|
40
|
-
export const StyledListItemButton = styled(ListItemButton)(() => ({
|
|
41
|
-
alignItems: "center",
|
|
42
|
-
display: "flex",
|
|
43
|
-
paddingBottom: "5px",
|
|
44
|
-
paddingTop: "5px",
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
export const StyledLinkButton = styled(Link)({
|
|
48
|
-
textDecoration: "none",
|
|
49
|
-
"&:hover": {
|
|
50
|
-
color: "unset",
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export const StyledBox = styled(Box)(({ theme }) => ({
|
|
55
|
-
backgroundColor: theme.palette.background.paper,
|
|
56
|
-
height: "calc(100vh - 120px)",
|
|
57
|
-
paddingTop: "20px",
|
|
58
|
-
}));
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Button, Stack } from "@mui/material";
|
|
2
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Icons } from "../../components/Assets/Icons/Icons";
|
|
4
|
-
import {
|
|
5
|
-
LayoutWrapper,
|
|
6
|
-
LayoutWrapperProps,
|
|
7
|
-
} from "../../components/Layout/LayoutWrapper/LayoutWrapper";
|
|
8
|
-
import { PageContent } from "../../components/Layout/PageContent/PageContent";
|
|
9
|
-
import { SideNavigation } from "../../components/Layout/SideNavigation/SideNavigation";
|
|
10
|
-
import DialogButton from "../../components/Navigation/DialogButton/DialogButton";
|
|
11
|
-
|
|
12
|
-
const LayoutWrapperStory = (props: LayoutWrapperProps) => {
|
|
13
|
-
return (
|
|
14
|
-
<div style={{ minHeight: "500px" }}>
|
|
15
|
-
<LayoutWrapper {...props} />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// Define the default export with Meta type including the component type
|
|
21
|
-
const meta: Meta<typeof LayoutWrapperStory> = {
|
|
22
|
-
title: "Layout/LayoutWrapper",
|
|
23
|
-
component: LayoutWrapperStory,
|
|
24
|
-
tags: ["autodocs"],
|
|
25
|
-
argTypes: {
|
|
26
|
-
title: {
|
|
27
|
-
control: "text",
|
|
28
|
-
description: "The title of the component",
|
|
29
|
-
type: { name: "string", required: false },
|
|
30
|
-
},
|
|
31
|
-
actionButtons: {
|
|
32
|
-
control: "object",
|
|
33
|
-
description: "Array of React nodes for action buttons",
|
|
34
|
-
// type: { name: "ReactNode[]", required: false },
|
|
35
|
-
},
|
|
36
|
-
children: {
|
|
37
|
-
control: "object",
|
|
38
|
-
description: "The content of the component",
|
|
39
|
-
},
|
|
40
|
-
sideBar: {
|
|
41
|
-
control: false,
|
|
42
|
-
description:
|
|
43
|
-
"A function that returns a ReactNode, with props for open and handleClick",
|
|
44
|
-
type: {
|
|
45
|
-
name: "function",
|
|
46
|
-
required: true,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
// menu: {
|
|
51
|
-
// control: "object",
|
|
52
|
-
// description:
|
|
53
|
-
// "Menu configuration object, which may include items or other menu-related settings.",
|
|
54
|
-
// },
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default meta;
|
|
59
|
-
type Story = StoryObj<typeof LayoutWrapperStory>;
|
|
60
|
-
|
|
61
|
-
// Primary story
|
|
62
|
-
export const Primary: Story = {
|
|
63
|
-
render: (args: LayoutWrapperProps) => <LayoutWrapperStory {...args} />,
|
|
64
|
-
args: {
|
|
65
|
-
sideBar: ({ open, handleClick }: any) => (
|
|
66
|
-
<SideNavigation
|
|
67
|
-
open={open}
|
|
68
|
-
handleDrawer={handleClick}
|
|
69
|
-
menu={[
|
|
70
|
-
{ name: "Tickets", path: "/home", icon: Icons.DashBoardIcon },
|
|
71
|
-
{ name: "Item 2", path: "/item2" },
|
|
72
|
-
]}
|
|
73
|
-
/>
|
|
74
|
-
),
|
|
75
|
-
children: (
|
|
76
|
-
<>
|
|
77
|
-
<Stack alignItems={"flex-end"}>
|
|
78
|
-
<Button variant="contained">Add Tickets</Button>
|
|
79
|
-
</Stack>
|
|
80
|
-
<PageContent>Mahesh</PageContent>
|
|
81
|
-
</>
|
|
82
|
-
),
|
|
83
|
-
actionButtons: [
|
|
84
|
-
<DialogButton
|
|
85
|
-
anchor={({ open }) => (
|
|
86
|
-
<Button variant="contained" onClick={open}>
|
|
87
|
-
Create
|
|
88
|
-
</Button>
|
|
89
|
-
)}
|
|
90
|
-
content={({ close }) => <Button onClick={close}>Click Me</Button>}
|
|
91
|
-
title="Dialog Title"
|
|
92
|
-
/>,
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Typography } from "@mui/material";
|
|
2
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Icons } from "../../components/Assets/Icons/Icons";
|
|
4
|
-
import {
|
|
5
|
-
SideNavigation,
|
|
6
|
-
SideNavigationProps,
|
|
7
|
-
} from "../../components/Layout/SideNavigation/SideNavigation";
|
|
8
|
-
|
|
9
|
-
// Define the default export with Meta type including the component type
|
|
10
|
-
const meta: Meta<typeof SideNavigation> = {
|
|
11
|
-
title: "Layout/SideNavigation",
|
|
12
|
-
component: SideNavigation,
|
|
13
|
-
tags: ["autodocs"],
|
|
14
|
-
argTypes: {
|
|
15
|
-
menu: {
|
|
16
|
-
control: "object",
|
|
17
|
-
description: "Array of menu item props",
|
|
18
|
-
},
|
|
19
|
-
open: {
|
|
20
|
-
control: "boolean",
|
|
21
|
-
description: "State to control if the drawer is open",
|
|
22
|
-
},
|
|
23
|
-
handleDrawer: {
|
|
24
|
-
control: false,
|
|
25
|
-
description: "Function to handle drawer state",
|
|
26
|
-
type: { name: "function", required: false },
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default meta;
|
|
32
|
-
type Story = StoryObj<typeof SideNavigation>;
|
|
33
|
-
|
|
34
|
-
// Primary story
|
|
35
|
-
export const Primary: Story = {
|
|
36
|
-
render: (args: SideNavigationProps) => <SideNavigation {...args} />,
|
|
37
|
-
args: {
|
|
38
|
-
open: true,
|
|
39
|
-
menu: [
|
|
40
|
-
{ name: "Tickets", path: "/home", icon: Icons.DashBoardIcon },
|
|
41
|
-
{ name: "Item 2", path: "/item2" },
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const WithoutMenu: Story = {
|
|
47
|
-
render: (args: SideNavigationProps) => <SideNavigation {...args} />,
|
|
48
|
-
args: {
|
|
49
|
-
open: true,
|
|
50
|
-
children: (
|
|
51
|
-
<Typography variant="body2">
|
|
52
|
-
Vestibulum blandit viverra conv allis. Pellentesque ligula urna,
|
|
53
|
-
fermentum ut semper in, tincidunt nec dui.
|
|
54
|
-
</Typography>
|
|
55
|
-
),
|
|
56
|
-
},
|
|
57
|
-
};
|