@campxdev/react-blueprint 0.1.9 → 0.1.11
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 -2
- package/src/assets/images/icons.tsx +111 -0
- package/src/components/Layout/LayoutWrapper/LayoutWrapper.stories.tsx +2 -1
- package/src/components/Layout/LayoutWrapper/LayoutWrapper.tsx +42 -34
- package/src/components/Layout/SideNavigation/SideNavigation.tsx +6 -19
- package/src/components/Layout/SideNavigation/styles/styles.tsx +32 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/react-blueprint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"main": "./export.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"build": "react-scripts build",
|
|
32
32
|
"test": "react-scripts test",
|
|
33
33
|
"eject": "react-scripts eject",
|
|
34
|
-
"push-package": "npm run build && npm publish",
|
|
35
34
|
"storybook": "storybook dev -p 6006",
|
|
36
35
|
"build-storybook": "storybook build"
|
|
37
36
|
},
|
|
@@ -314,3 +314,114 @@ export const LeftIcon = () => (
|
|
|
314
314
|
</g>
|
|
315
315
|
</svg>
|
|
316
316
|
);
|
|
317
|
+
|
|
318
|
+
export const DashBoardIcon = () => {
|
|
319
|
+
const theme = useTheme();
|
|
320
|
+
const color = theme.palette.text.primary;
|
|
321
|
+
return (
|
|
322
|
+
<svg
|
|
323
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
324
|
+
width="16"
|
|
325
|
+
height="16"
|
|
326
|
+
viewBox="0 0 16 16"
|
|
327
|
+
>
|
|
328
|
+
<g
|
|
329
|
+
id="vuesax_linear_chart-2"
|
|
330
|
+
data-name="vuesax/linear/chart-2"
|
|
331
|
+
transform="translate(-236 -188)"
|
|
332
|
+
>
|
|
333
|
+
<g id="chart-2" transform="translate(236 188)">
|
|
334
|
+
<path
|
|
335
|
+
id="Vector"
|
|
336
|
+
d="M4.667,13.333h4c3.333,0,4.667-1.333,4.667-4.667v-4C13.333,1.333,12,0,8.667,0h-4C1.333,0,0,1.333,0,4.667v4C0,12,1.333,13.333,4.667,13.333Z"
|
|
337
|
+
transform="translate(1.333 1.333)"
|
|
338
|
+
fill="none"
|
|
339
|
+
stroke={color}
|
|
340
|
+
stroke-linecap="round"
|
|
341
|
+
stroke-linejoin="round"
|
|
342
|
+
stroke-width="1.2"
|
|
343
|
+
/>
|
|
344
|
+
<path
|
|
345
|
+
id="Vector-2"
|
|
346
|
+
data-name="Vector"
|
|
347
|
+
d="M1.333,8.667A1.337,1.337,0,0,0,2.667,7.333v-6A1.333,1.333,0,0,0,0,1.333v6A1.333,1.333,0,0,0,1.333,8.667Z"
|
|
348
|
+
transform="translate(9 3.667)"
|
|
349
|
+
fill="none"
|
|
350
|
+
stroke={color}
|
|
351
|
+
stroke-linecap="round"
|
|
352
|
+
stroke-linejoin="round"
|
|
353
|
+
stroke-width="1.2"
|
|
354
|
+
/>
|
|
355
|
+
<path
|
|
356
|
+
id="Vector-3"
|
|
357
|
+
data-name="Vector"
|
|
358
|
+
d="M1.333,5A1.337,1.337,0,0,0,2.667,3.667V1.333A1.333,1.333,0,0,0,0,1.333V3.667A1.333,1.333,0,0,0,1.333,5Z"
|
|
359
|
+
transform="translate(4.333 7.333)"
|
|
360
|
+
fill="none"
|
|
361
|
+
stroke={color}
|
|
362
|
+
stroke-linecap="round"
|
|
363
|
+
stroke-linejoin="round"
|
|
364
|
+
stroke-width="1.2"
|
|
365
|
+
/>
|
|
366
|
+
<path
|
|
367
|
+
id="Vector-4"
|
|
368
|
+
data-name="Vector"
|
|
369
|
+
d="M0,0H16V16H0Z"
|
|
370
|
+
fill="none"
|
|
371
|
+
opacity="0"
|
|
372
|
+
/>
|
|
373
|
+
</g>
|
|
374
|
+
</g>
|
|
375
|
+
</svg>
|
|
376
|
+
);
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
export const HomeIcon = () => {
|
|
380
|
+
const theme = useTheme();
|
|
381
|
+
const color = theme.palette.text.primary;
|
|
382
|
+
return (
|
|
383
|
+
<svg
|
|
384
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
385
|
+
width="16"
|
|
386
|
+
height="16"
|
|
387
|
+
viewBox="0 0 16 16"
|
|
388
|
+
>
|
|
389
|
+
<g
|
|
390
|
+
id="vuesax_linear_home-2"
|
|
391
|
+
data-name="vuesax/linear/home-2"
|
|
392
|
+
transform="translate(-620 -188)"
|
|
393
|
+
>
|
|
394
|
+
<g id="home-2" transform="translate(620 188)">
|
|
395
|
+
<path
|
|
396
|
+
id="Vector"
|
|
397
|
+
d="M4.68.548l-3.593,2.8A3.172,3.172,0,0,0,0,5.562V10.5a2.817,2.817,0,0,0,2.807,2.813h7.72a2.815,2.815,0,0,0,2.807-2.807V5.655a3.149,3.149,0,0,0-1.2-2.3L8.013.468A2.991,2.991,0,0,0,4.68.548Z"
|
|
398
|
+
transform="translate(1.333 1.345)"
|
|
399
|
+
fill="none"
|
|
400
|
+
stroke={color}
|
|
401
|
+
stroke-linecap="round"
|
|
402
|
+
stroke-linejoin="round"
|
|
403
|
+
stroke-width="1.2"
|
|
404
|
+
/>
|
|
405
|
+
<path
|
|
406
|
+
id="Vector-2"
|
|
407
|
+
data-name="Vector"
|
|
408
|
+
d="M0,2V0"
|
|
409
|
+
transform="translate(8 9.993)"
|
|
410
|
+
fill="none"
|
|
411
|
+
stroke={color}
|
|
412
|
+
stroke-linecap="round"
|
|
413
|
+
stroke-linejoin="round"
|
|
414
|
+
stroke-width="1.2"
|
|
415
|
+
/>
|
|
416
|
+
<path
|
|
417
|
+
id="Vector-3"
|
|
418
|
+
data-name="Vector"
|
|
419
|
+
d="M0,0H16V16H0Z"
|
|
420
|
+
fill="none"
|
|
421
|
+
opacity="0"
|
|
422
|
+
/>
|
|
423
|
+
</g>
|
|
424
|
+
</g>
|
|
425
|
+
</svg>
|
|
426
|
+
);
|
|
427
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { DashBoardIcon } from "../../../assets/images/icons";
|
|
2
3
|
import { LayoutWrapper, LayoutWrapperProps } from "./LayoutWrapper";
|
|
3
4
|
|
|
4
5
|
// Define the default export with Meta type including the component type
|
|
@@ -22,7 +23,7 @@ export const Primary: Story = {
|
|
|
22
23
|
render: (args: LayoutWrapperProps) => <LayoutWrapper {...args} />,
|
|
23
24
|
args: {
|
|
24
25
|
menu: [
|
|
25
|
-
{ name: "
|
|
26
|
+
{ name: "Tickets", path: "/home", icon: DashBoardIcon },
|
|
26
27
|
{ name: "Item 2", path: "/item2" },
|
|
27
28
|
],
|
|
28
29
|
children: <>hi</>,
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconButton, Toolbar, Typography } from "@mui/material";
|
|
2
2
|
|
|
3
3
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { LeftIcon, RightIcon } from "../../../assets/images/icons";
|
|
6
6
|
import { SideNavigation } from "../SideNavigation/SideNavigation";
|
|
7
|
+
import {
|
|
8
|
+
StyledLayoutContainer,
|
|
9
|
+
StyledMainContainer,
|
|
10
|
+
} from "../SideNavigation/styles/styles";
|
|
7
11
|
|
|
8
12
|
export interface LayoutWrapperProps {
|
|
9
13
|
title?: string;
|
|
@@ -28,40 +32,44 @@ export const LayoutWrapper = ({
|
|
|
28
32
|
setOpen(!open);
|
|
29
33
|
};
|
|
30
34
|
|
|
35
|
+
console.log(active, menu[active].name);
|
|
36
|
+
|
|
31
37
|
return (
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
<StyledLayoutContainer>
|
|
39
|
+
<StyledMainContainer>
|
|
40
|
+
<Toolbar sx={{ paddingLeft: "0px !important" }}>
|
|
41
|
+
{showIcon && (
|
|
42
|
+
<IconButton
|
|
43
|
+
color="inherit"
|
|
44
|
+
aria-label="open drawer"
|
|
45
|
+
onClick={handleDrawer}
|
|
46
|
+
edge="start"
|
|
47
|
+
sx={{ mr: 0.5 }}
|
|
48
|
+
onMouseEnter={() => setIsHovered(true)}
|
|
49
|
+
onMouseLeave={() => setIsHovered(false)}
|
|
50
|
+
>
|
|
51
|
+
{open && isHovered ? (
|
|
52
|
+
<LeftIcon />
|
|
53
|
+
) : !open && isHovered ? (
|
|
54
|
+
<RightIcon />
|
|
55
|
+
) : (
|
|
56
|
+
<MenuIcon />
|
|
57
|
+
)}
|
|
58
|
+
</IconButton>
|
|
59
|
+
)}
|
|
60
|
+
<Typography variant="subtitle1" noWrap>
|
|
61
|
+
{title ? title : menu[active].name}
|
|
62
|
+
</Typography>
|
|
63
|
+
</Toolbar>
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
<SideNavigation
|
|
66
|
+
menu={menu}
|
|
67
|
+
children={children}
|
|
68
|
+
open={open}
|
|
69
|
+
handleDrawer={handleDrawer}
|
|
70
|
+
setActive={setActive}
|
|
71
|
+
/>
|
|
72
|
+
</StyledMainContainer>
|
|
73
|
+
</StyledLayoutContainer>
|
|
66
74
|
);
|
|
67
75
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ListItemIcon, Stack } from "@mui/material";
|
|
2
2
|
import { useMatch, useResolvedPath } from "react-router-dom";
|
|
3
|
+
import { HomeIcon } from "../../../assets/images/icons";
|
|
3
4
|
import { Typography } from "../../Typography/Typography";
|
|
4
5
|
import {
|
|
5
6
|
Main,
|
|
@@ -72,6 +73,8 @@ const MenuItem = ({ menuItem, index, setActive }: MenuItemProps) => {
|
|
|
72
73
|
|
|
73
74
|
// if (!hasAccess) return null
|
|
74
75
|
|
|
76
|
+
console.log(index, "path");
|
|
77
|
+
|
|
75
78
|
return (
|
|
76
79
|
<StyledListItem key={path} disablePadding match={match}>
|
|
77
80
|
<StyledLinkButton
|
|
@@ -86,25 +89,9 @@ const MenuItem = ({ menuItem, index, setActive }: MenuItemProps) => {
|
|
|
86
89
|
marginRight: "8px",
|
|
87
90
|
}}
|
|
88
91
|
>
|
|
89
|
-
<
|
|
90
|
-
sx={{
|
|
91
|
-
minWidth: "16px",
|
|
92
|
-
marginRight: "8px",
|
|
93
|
-
display: "flex",
|
|
94
|
-
alignItems: "center",
|
|
95
|
-
justifyContent: "center",
|
|
96
|
-
}}
|
|
97
|
-
>
|
|
98
|
-
{/* <GetSidenavIconByType
|
|
99
|
-
iconType={iconType}
|
|
100
|
-
color={match ? '#323167' : '#000'}
|
|
101
|
-
/> */}
|
|
102
|
-
{/* {getSidenavIconByType(iconType, 'red')} */}
|
|
103
|
-
</Box>
|
|
92
|
+
{Icon ? <Icon /> : <HomeIcon />}
|
|
104
93
|
</ListItemIcon>
|
|
105
|
-
<
|
|
106
|
-
primary={<Typography variant="subtitle3">{name}</Typography>}
|
|
107
|
-
/>
|
|
94
|
+
<Typography variant="subtitle3">{name}</Typography>
|
|
108
95
|
</StyledListItemButton>
|
|
109
96
|
</StyledLinkButton>
|
|
110
97
|
</StyledListItem>
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Drawer,
|
|
4
|
+
List,
|
|
5
|
+
ListItem,
|
|
6
|
+
ListItemButton,
|
|
7
|
+
styled,
|
|
8
|
+
} from "@mui/material";
|
|
2
9
|
import { Link } from "react-router-dom";
|
|
3
10
|
const drawerWidth: number = 240;
|
|
4
11
|
|
|
@@ -20,12 +27,6 @@ export const StyledDrawer = styled(Drawer)(() => ({
|
|
|
20
27
|
},
|
|
21
28
|
}));
|
|
22
29
|
|
|
23
|
-
export const StyledList = styled(List)(({ theme }) => ({
|
|
24
|
-
backgroundColor: theme.palette.background.paper,
|
|
25
|
-
height: "calc(100vh - 120px)",
|
|
26
|
-
paddingTop: "20px",
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
30
|
interface StyledListItemProps {
|
|
30
31
|
match: any;
|
|
31
32
|
}
|
|
@@ -33,13 +34,16 @@ interface StyledListItemProps {
|
|
|
33
34
|
export const StyledListItem = styled(ListItem)<StyledListItemProps>(
|
|
34
35
|
({ theme, match }) => ({
|
|
35
36
|
backgroundColor: match ? theme.palette.secondary.main : "none",
|
|
37
|
+
width: "auto",
|
|
38
|
+
margin: "5px 8px",
|
|
39
|
+
borderRadius: "5px",
|
|
36
40
|
})
|
|
37
41
|
);
|
|
38
42
|
export const StyledListItemButton = styled(ListItemButton)(() => ({
|
|
39
43
|
alignItems: "center",
|
|
40
44
|
display: "flex",
|
|
41
|
-
paddingBottom: "
|
|
42
|
-
paddingTop: "
|
|
45
|
+
paddingBottom: "5px",
|
|
46
|
+
paddingTop: "5px",
|
|
43
47
|
}));
|
|
44
48
|
|
|
45
49
|
export const StyledLinkButton = styled(Link)({
|
|
@@ -82,3 +86,22 @@ export const Main = styled("main", {
|
|
|
82
86
|
marginLeft: 0,
|
|
83
87
|
},
|
|
84
88
|
}));
|
|
89
|
+
|
|
90
|
+
export const StyledMainContainer = styled("main")(() => ({
|
|
91
|
+
width: "90%",
|
|
92
|
+
margin: "auto",
|
|
93
|
+
overflowY: "auto",
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
export const StyledLayoutContainer = styled(Box)(({ theme }) => ({
|
|
97
|
+
width: "100%",
|
|
98
|
+
position: "fixed",
|
|
99
|
+
top: "60px",
|
|
100
|
+
backgroundColor: theme.palette.background.default,
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
export const StyledList = styled(List)(({ theme }) => ({
|
|
104
|
+
backgroundColor: theme.palette.background.paper,
|
|
105
|
+
height: "calc(100vh - 120px)",
|
|
106
|
+
paddingTop: "20px",
|
|
107
|
+
}));
|