@campxdev/react-blueprint 0.1.32 → 0.1.34
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 +9 -13
- package/src/App.tsx +1 -0
- package/src/components/Layout/AppHeader/AppHeader.tsx +3 -1
- package/src/components/Layout/AppHeader/styles/styles.tsx +21 -13
- package/src/components/export.ts +0 -2
- package/src/stories/Layout/AppHeader.stories.tsx +1 -23
- 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 -93
- package/src/components/Layout/SideNavigation/styles/styles.tsx +0 -58
- package/src/stories/Layout/LayoutWrapper.stories.tsx +0 -99
- package/src/stories/Layout/SideNavigation.stories.tsx +0 -57
package/package.json
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/react-blueprint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"main": "./export.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@emotion/react": "^11.11.4",
|
|
8
8
|
"@emotion/styled": "^11.11.5",
|
|
9
|
-
"@mui/icons-material": "^5.
|
|
10
|
-
"@mui/material": "^5.
|
|
9
|
+
"@mui/icons-material": "^5.15.20",
|
|
10
|
+
"@mui/material": "^5.15.20",
|
|
11
11
|
"@mui/x-data-grid": "^7.5.1",
|
|
12
12
|
"@storybook/addon-backgrounds": "^8.1.5",
|
|
13
13
|
"@storybook/addon-designs": "^8.0.2",
|
|
14
|
-
"@testing-library/jest-dom": "^5.14.1",
|
|
15
|
-
"@testing-library/react": "^13.0.0",
|
|
16
|
-
"@testing-library/user-event": "^13.2.1",
|
|
17
|
-
"@types/jest": "^27.0.1",
|
|
18
|
-
"@types/node": "^16.7.13",
|
|
19
|
-
"@types/react": "^18.0.0",
|
|
20
|
-
"@types/react-dom": "^18.0.0",
|
|
21
14
|
"axios": "^1.7.2",
|
|
22
15
|
"framer-motion": "^11.2.9",
|
|
23
16
|
"js-cookie": "^3.0.5",
|
|
@@ -26,10 +19,10 @@
|
|
|
26
19
|
"react": "^18.3.1",
|
|
27
20
|
"react-dom": "^18.3.1",
|
|
28
21
|
"react-error-boundary": "^3.1.4",
|
|
29
|
-
"react-router-dom": "^6.
|
|
30
|
-
"react-scripts": "5.0.1",
|
|
22
|
+
"react-router-dom": "^6.24.0",
|
|
23
|
+
"react-scripts": "^5.0.1",
|
|
31
24
|
"storybook-dark-mode": "^4.0.1",
|
|
32
|
-
"typescript": "^5.
|
|
25
|
+
"typescript": "^5.5.2",
|
|
33
26
|
"web-vitals": "^2.1.0"
|
|
34
27
|
},
|
|
35
28
|
"scripts": {
|
|
@@ -73,6 +66,9 @@
|
|
|
73
66
|
"@storybook/react-webpack5": "^8.1.5",
|
|
74
67
|
"@storybook/test": "^8.1.5",
|
|
75
68
|
"@types/js-cookie": "^3.0.5",
|
|
69
|
+
"@types/react": "^18.0.0",
|
|
70
|
+
"@types/react-dom": "^18.3.0",
|
|
71
|
+
"@types/react-router-dom": "^5.3.3",
|
|
76
72
|
"eslint-plugin-storybook": "^0.8.0",
|
|
77
73
|
"prop-types": "^15.8.1",
|
|
78
74
|
"storybook": "^8.1.5",
|
package/src/App.tsx
CHANGED
|
@@ -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,9 +24,10 @@ export const AppHeader = ({
|
|
|
23
24
|
clientLogoUrl,
|
|
24
25
|
clientName,
|
|
25
26
|
userFullName,
|
|
27
|
+
collapsed,
|
|
26
28
|
}: AppHeaderProps) => {
|
|
27
29
|
return (
|
|
28
|
-
<StyledHeader>
|
|
30
|
+
<StyledHeader collapsed={collapsed}>
|
|
29
31
|
<Typography variant={"subtitle2"}>{clientName}</Typography>
|
|
30
32
|
<Stack alignItems={"center"} gap={"12px"} flexDirection={"row"}>
|
|
31
33
|
<StyledIconButton
|
|
@@ -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",
|
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
|
-
};
|
|
@@ -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: "60px",
|
|
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,93 +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
|
-
<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>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const MenuItem = ({
|
|
57
|
-
menuItem,
|
|
58
|
-
index,
|
|
59
|
-
}: {
|
|
60
|
-
menuItem: MenuItemProps;
|
|
61
|
-
index: number;
|
|
62
|
-
}) => {
|
|
63
|
-
const { path, icon: Icon, name, permissionKey, iconType } = menuItem;
|
|
64
|
-
|
|
65
|
-
let resolved = useResolvedPath(path);
|
|
66
|
-
let match = useMatch({ path: resolved.pathname, end: false });
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<StyledListItem key={path} disablePadding match={match}>
|
|
70
|
-
<StyledLinkButton
|
|
71
|
-
to={path}
|
|
72
|
-
style={{ width: "100%" }}
|
|
73
|
-
onClick={() =>
|
|
74
|
-
activeStore.update((s) => {
|
|
75
|
-
s.active = index;
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
>
|
|
79
|
-
<StyledListItemButton>
|
|
80
|
-
<ListItemIcon
|
|
81
|
-
sx={{
|
|
82
|
-
minWidth: "16px",
|
|
83
|
-
marginRight: "8px",
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
{Icon ? <Icon /> : <Icons.HomeIcon />}
|
|
87
|
-
</ListItemIcon>
|
|
88
|
-
<Typography variant="subtitle3">{name}</Typography>
|
|
89
|
-
</StyledListItemButton>
|
|
90
|
-
</StyledLinkButton>
|
|
91
|
-
</StyledListItem>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
@@ -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,99 +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
|
-
{
|
|
71
|
-
name: "Self Service Portal",
|
|
72
|
-
path: "/home",
|
|
73
|
-
icon: Icons.DashBoardIcon,
|
|
74
|
-
},
|
|
75
|
-
{ name: "Self Service Portal", path: "/item2" },
|
|
76
|
-
]}
|
|
77
|
-
/>
|
|
78
|
-
),
|
|
79
|
-
children: (
|
|
80
|
-
<>
|
|
81
|
-
<Stack alignItems={"flex-end"}>
|
|
82
|
-
<Button variant="contained">Add Tickets</Button>
|
|
83
|
-
</Stack>
|
|
84
|
-
<PageContent>Mahesh</PageContent>
|
|
85
|
-
</>
|
|
86
|
-
),
|
|
87
|
-
actionButtons: [
|
|
88
|
-
<DialogButton
|
|
89
|
-
anchor={({ open }) => (
|
|
90
|
-
<Button variant="contained" onClick={open}>
|
|
91
|
-
Create
|
|
92
|
-
</Button>
|
|
93
|
-
)}
|
|
94
|
-
content={({ close }) => <Button onClick={close}>Click Me</Button>}
|
|
95
|
-
title="Dialog Title"
|
|
96
|
-
/>,
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
};
|
|
@@ -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
|
-
};
|