@campxdev/react-blueprint 0.1.13 → 0.1.15
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/.storybook/main.ts +4 -3
- package/.storybook/preview.tsx +30 -13
- package/package.json +3 -1
- package/src/components/DataDisplay/DataTable/DataTable.stories.tsx +15 -6
- package/src/components/DataDisplay/DataTable/DataTable.tsx +21 -25
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +22 -0
- package/src/components/DataDisplay/styles.tsx +5 -0
- package/src/components/Layout/LayoutWrapper/LayoutWrapper.stories.tsx +44 -8
- package/src/components/Layout/LayoutWrapper/LayoutWrapper.tsx +49 -49
- package/src/components/Layout/LayoutWrapper/styles.tsx +52 -0
- package/src/components/Layout/PageContent/PageContent.tsx +26 -0
- package/src/components/Layout/SideNavigation/SideNavigation.tsx +1 -5
- package/src/components/Layout/SideNavigation/styles/styles.tsx +1 -58
- package/src/components/export.ts +2 -0
- package/src/store/activeStore.ts +1 -0
- package/src/components/Layout/ComponentBackground/ComponentBackground.tsx +0 -83
- package/src/components/Layout/ComponentBackground/DefaultBackground.tsx +0 -12
- package/src/components/Layout/ComponentBackground/PaperBackground.tsx +0 -12
- package/src/components/Layout/SideNavigation/SideNavigation.stories.tsx +0 -30
- package/src/components/Typography/Typography.stories.tsx +0 -95
- package/src/stories/Button.stories.ts +0 -52
- package/src/stories/Button.tsx +0 -48
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -33
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Page.stories.ts +0 -32
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
package/.storybook/main.ts
CHANGED
|
@@ -10,7 +10,8 @@ const config: StorybookConfig = {
|
|
|
10
10
|
"@storybook/addon-essentials",
|
|
11
11
|
"@chromatic-com/storybook",
|
|
12
12
|
"@storybook/addon-interactions",
|
|
13
|
-
"@storybook/addon-mdx-gfm"
|
|
13
|
+
"@storybook/addon-mdx-gfm",
|
|
14
|
+
"storybook-dark-mode",
|
|
14
15
|
],
|
|
15
16
|
|
|
16
17
|
framework: {
|
|
@@ -23,7 +24,7 @@ const config: StorybookConfig = {
|
|
|
23
24
|
staticDirs: ["../public"],
|
|
24
25
|
|
|
25
26
|
typescript: {
|
|
26
|
-
reactDocgen: "react-docgen-typescript"
|
|
27
|
-
}
|
|
27
|
+
reactDocgen: "react-docgen-typescript",
|
|
28
|
+
},
|
|
28
29
|
};
|
|
29
30
|
export default config;
|
package/.storybook/preview.tsx
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { CssBaseline } from "@mui/material";
|
|
2
2
|
import type { Preview } from "@storybook/react";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { MuiThemeProvider } from "../src/themes/MuiThemeProvider";
|
|
5
|
+
import { useDarkMode } from "storybook-dark-mode";
|
|
6
|
+
import { darkTheme } from "../src/themes/darkTheme";
|
|
7
|
+
import { lightTheme } from "../src/themes/lightTheme";
|
|
8
|
+
import { DarkColorTokens, LightColorTokens } from "../src/themes/colorTokens";
|
|
4
9
|
import { BrowserRouter } from "react-router-dom";
|
|
5
|
-
import { ComponentBackground } from "../src/components/Layout/ComponentBackground/ComponentBackground";
|
|
6
|
-
|
|
7
|
-
const withThemeProvider = (Story) => (
|
|
8
|
-
<ComponentBackground>
|
|
9
|
-
<BrowserRouter>
|
|
10
|
-
<Story />
|
|
11
|
-
</BrowserRouter>
|
|
12
|
-
<CssBaseline />
|
|
13
|
-
</ComponentBackground>
|
|
14
|
-
);
|
|
15
10
|
|
|
16
11
|
const preview: Preview = {
|
|
17
12
|
parameters: {
|
|
@@ -21,10 +16,32 @@ const preview: Preview = {
|
|
|
21
16
|
date: /Date$/i,
|
|
22
17
|
},
|
|
23
18
|
},
|
|
19
|
+
backgrounds: {
|
|
20
|
+
default: "light", // name of the default background to use
|
|
21
|
+
values: [
|
|
22
|
+
{ name: "light", value: LightColorTokens.background.default },
|
|
23
|
+
{ name: "light paper", value: LightColorTokens.background.paper },
|
|
24
|
+
{ name: "dark", value: DarkColorTokens.background.default },
|
|
25
|
+
{ name: "dark paper", value: DarkColorTokens.background.paper },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
24
28
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
decorators: [
|
|
30
|
+
(Story) => {
|
|
31
|
+
const isDarkMode = useDarkMode();
|
|
32
|
+
console.log(isDarkMode);
|
|
33
|
+
const theme = isDarkMode ? darkTheme : lightTheme;
|
|
34
|
+
return (
|
|
35
|
+
<BrowserRouter>
|
|
36
|
+
<MuiThemeProvider theme={theme}>
|
|
37
|
+
<CssBaseline />
|
|
38
|
+
<Story />
|
|
39
|
+
</MuiThemeProvider>
|
|
40
|
+
</BrowserRouter>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
tags: ["autodocs"],
|
|
28
45
|
};
|
|
29
46
|
|
|
30
47
|
export default preview;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/react-blueprint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"main": "./export.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"@mui/icons-material": "^5.14.11",
|
|
10
10
|
"@mui/material": "^5.14.11",
|
|
11
11
|
"@mui/x-data-grid": "^7.5.1",
|
|
12
|
+
"@storybook/addon-backgrounds": "^8.1.4",
|
|
12
13
|
"@testing-library/jest-dom": "^5.14.1",
|
|
13
14
|
"@testing-library/react": "^13.0.0",
|
|
14
15
|
"@testing-library/user-event": "^13.2.1",
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
"react-error-boundary": "^3.1.4",
|
|
25
26
|
"react-router-dom": "^6.4.2",
|
|
26
27
|
"react-scripts": "5.0.1",
|
|
28
|
+
"storybook-dark-mode": "^4.0.1",
|
|
27
29
|
"typescript": "^5.3.3",
|
|
28
30
|
"web-vitals": "^2.1.0"
|
|
29
31
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import DataTable from "./DataTable"; // Make sure the path to your component is correct
|
|
4
1
|
import { GridColDef } from "@mui/x-data-grid";
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { DataTable } from "./DataTable"; // Make sure the path to your component is correct
|
|
5
4
|
|
|
6
5
|
const columns: GridColDef[] = [
|
|
7
6
|
{ field: "id", headerName: "ID", width: 70 },
|
|
@@ -33,9 +32,18 @@ const rows = [
|
|
|
33
32
|
const meta: Meta<typeof DataTable> = {
|
|
34
33
|
title: "DataDisplay/DataTable",
|
|
35
34
|
component: DataTable,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
argTypes: {
|
|
36
|
+
totalCount: {
|
|
37
|
+
control: "number",
|
|
38
|
+
description: "Total Number of rows",
|
|
39
|
+
},
|
|
40
|
+
limit: {
|
|
41
|
+
control: "number",
|
|
42
|
+
description: "Total Number of rows",
|
|
43
|
+
},
|
|
44
|
+
offset: {
|
|
45
|
+
control: "number",
|
|
46
|
+
description: "Total Number of rows",
|
|
39
47
|
},
|
|
40
48
|
},
|
|
41
49
|
};
|
|
@@ -43,6 +51,7 @@ const meta: Meta<typeof DataTable> = {
|
|
|
43
51
|
export default meta;
|
|
44
52
|
const Template: StoryObj<typeof DataTable> = {
|
|
45
53
|
render: (args) => <DataTable {...args} />,
|
|
54
|
+
|
|
46
55
|
args: {
|
|
47
56
|
columns,
|
|
48
57
|
rows,
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Pagination } from "@mui/material";
|
|
2
|
+
import {
|
|
3
|
+
DataGrid as MuiDataGrid,
|
|
4
|
+
DataGridProps as MuiDataGridProps,
|
|
5
|
+
} from "@mui/x-data-grid";
|
|
6
|
+
import { DataGridContainer } from "../styles";
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
export type DataTableProps = {
|
|
9
|
+
limit: number;
|
|
10
|
+
offset: number;
|
|
11
|
+
totalCount: number;
|
|
12
|
+
} & MuiDataGridProps;
|
|
8
13
|
|
|
9
|
-
export
|
|
14
|
+
export const DataTable = (props: DataTableProps) => {
|
|
15
|
+
const pages = Math.ceil(props.totalCount / props.limit);
|
|
16
|
+
const currentPage = Math.ceil(props.offset / props.limit);
|
|
10
17
|
return (
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
pagination: {
|
|
17
|
-
paginationModel: { page: 0, pageSize: 5 },
|
|
18
|
-
},
|
|
19
|
-
}}
|
|
20
|
-
pageSizeOptions={[5, 10]}
|
|
21
|
-
checkboxSelection
|
|
22
|
-
onPaginationMetaChange={(params) => {
|
|
23
|
-
console.log(params);
|
|
24
|
-
}}
|
|
25
|
-
onPaginationModelChange={(params) => {
|
|
26
|
-
console.log(params);
|
|
18
|
+
<DataGridContainer>
|
|
19
|
+
<MuiDataGrid
|
|
20
|
+
{...props}
|
|
21
|
+
slots={{
|
|
22
|
+
pagination: () => <Pagination count={pages} page={currentPage} />,
|
|
27
23
|
}}
|
|
28
24
|
/>
|
|
29
|
-
</
|
|
25
|
+
</DataGridContainer>
|
|
30
26
|
);
|
|
31
|
-
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Pagination as MuiPagination,
|
|
3
|
+
PaginationProps as MuiPaginationProps,
|
|
4
|
+
Stack,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
import { Typography } from "../../Typography/Typography";
|
|
7
|
+
|
|
8
|
+
export type PaginationProps = {
|
|
9
|
+
pageStart: number;
|
|
10
|
+
pageEnd: number;
|
|
11
|
+
totalCount: number;
|
|
12
|
+
} & MuiPaginationProps;
|
|
13
|
+
|
|
14
|
+
export const TablePagination = (props: PaginationProps) => {
|
|
15
|
+
const { pageStart, pageEnd, totalCount } = props;
|
|
16
|
+
return (
|
|
17
|
+
<Stack direction="row">
|
|
18
|
+
<Typography variant="caption">{`${pageStart} - ${pageEnd} of ${totalCount}`}</Typography>
|
|
19
|
+
<MuiPagination {...props} variant="outlined" shape="rounded" />
|
|
20
|
+
</Stack>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import { Button, Stack } from "@mui/material";
|
|
1
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { DashBoardIcon } from "../../../assets/images/icons";
|
|
4
|
+
import DialogButton from "../../Modals/DialogButton";
|
|
5
|
+
import { PageContent } from "../PageContent/PageContent";
|
|
6
|
+
import { SideNavigation } from "../SideNavigation/SideNavigation";
|
|
3
7
|
import { LayoutWrapper, LayoutWrapperProps } from "./LayoutWrapper";
|
|
4
8
|
|
|
9
|
+
const LayoutWrapperStory = (props: LayoutWrapperProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<div style={{ minHeight: "500px" }}>
|
|
12
|
+
<LayoutWrapper {...props} />
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
5
17
|
// Define the default export with Meta type including the component type
|
|
6
|
-
const meta: Meta<typeof
|
|
18
|
+
const meta: Meta<typeof LayoutWrapperStory> = {
|
|
7
19
|
title: "Layout/LayoutWrapper",
|
|
8
|
-
component:
|
|
20
|
+
component: LayoutWrapperStory,
|
|
9
21
|
tags: ["autodocs"],
|
|
10
22
|
// argTypes: {
|
|
11
23
|
// menu: {
|
|
@@ -16,16 +28,40 @@ const meta: Meta<typeof LayoutWrapper> = {
|
|
|
16
28
|
};
|
|
17
29
|
|
|
18
30
|
export default meta;
|
|
19
|
-
type Story = StoryObj<typeof
|
|
31
|
+
type Story = StoryObj<typeof LayoutWrapperStory>;
|
|
20
32
|
|
|
21
33
|
// Primary story
|
|
22
34
|
export const Primary: Story = {
|
|
23
|
-
render: (args: LayoutWrapperProps) => <
|
|
35
|
+
render: (args: LayoutWrapperProps) => <LayoutWrapperStory {...args} />,
|
|
24
36
|
args: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
sideBar: ({ open, handleClick }: any) => (
|
|
38
|
+
<SideNavigation
|
|
39
|
+
open={open}
|
|
40
|
+
handleDrawer={handleClick}
|
|
41
|
+
menu={[
|
|
42
|
+
{ name: "Tickets", path: "/home", icon: DashBoardIcon },
|
|
43
|
+
{ name: "Item 2", path: "/item2" },
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
),
|
|
47
|
+
children: (
|
|
48
|
+
<>
|
|
49
|
+
<Stack alignItems={"flex-end"}>
|
|
50
|
+
<Button variant="contained">Add Tickets</Button>
|
|
51
|
+
</Stack>
|
|
52
|
+
<PageContent>Mahesh</PageContent>
|
|
53
|
+
</>
|
|
54
|
+
),
|
|
55
|
+
actionButtons: [
|
|
56
|
+
<DialogButton
|
|
57
|
+
anchor={({ open }) => (
|
|
58
|
+
<Button variant="contained" onClick={open}>
|
|
59
|
+
Create
|
|
60
|
+
</Button>
|
|
61
|
+
)}
|
|
62
|
+
content={({ close }) => <Button onClick={close}>Click Me</Button>}
|
|
63
|
+
title="Dialog Title"
|
|
64
|
+
/>,
|
|
28
65
|
],
|
|
29
|
-
children: <>hi</>,
|
|
30
66
|
},
|
|
31
67
|
};
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { IconButton,
|
|
1
|
+
import { Box, IconButton, Stack, Typography } from "@mui/material";
|
|
2
2
|
|
|
3
3
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
4
|
-
import { useState } from "react";
|
|
4
|
+
import { ReactNode, useState } from "react";
|
|
5
5
|
import { LeftIcon, RightIcon } from "../../../assets/images/icons";
|
|
6
6
|
import { activeStore } from "../../../store/activeStore";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
StyledLayoutContainer,
|
|
10
|
-
StyledMainContainer,
|
|
11
|
-
} from "../SideNavigation/styles/styles";
|
|
7
|
+
import { Main, StyledLayoutContainer, StyledMainContainer } from "./styles";
|
|
12
8
|
|
|
13
9
|
export interface LayoutWrapperProps {
|
|
14
10
|
title?: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
actionButtons?: ReactNode[];
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
sideBar: (props: {
|
|
14
|
+
open: boolean;
|
|
15
|
+
handleClick: (e: any) => void;
|
|
16
|
+
}) => ReactNode;
|
|
18
17
|
}
|
|
18
|
+
|
|
19
19
|
export const LayoutWrapper = ({
|
|
20
20
|
children,
|
|
21
21
|
title,
|
|
22
|
-
|
|
23
|
-
menu,
|
|
22
|
+
sideBar,
|
|
24
23
|
}: LayoutWrapperProps) => {
|
|
25
|
-
const [open, setOpen] = useState<boolean>(
|
|
26
|
-
window.innerWidth > 1024 ? true : false
|
|
27
|
-
);
|
|
28
24
|
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
25
|
+
const { open } = activeStore.useState((s) => s);
|
|
29
26
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const handleClick = () => {
|
|
28
|
+
activeStore.update((s) => {
|
|
29
|
+
s.open = !open;
|
|
30
|
+
});
|
|
34
31
|
};
|
|
35
32
|
|
|
36
33
|
return (
|
|
37
34
|
<StyledLayoutContainer>
|
|
38
35
|
<StyledMainContainer>
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
+
<LeftIcon />
|
|
54
|
+
) : !open && isHovered ? (
|
|
55
|
+
<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>
|
|
63
68
|
|
|
64
|
-
<
|
|
65
|
-
menu={menu}
|
|
66
|
-
children={children}
|
|
67
|
-
open={open}
|
|
68
|
-
handleDrawer={handleDrawer}
|
|
69
|
-
/>
|
|
69
|
+
<Main open={open}>{children}</Main>
|
|
70
70
|
</StyledMainContainer>
|
|
71
71
|
</StyledLayoutContainer>
|
|
72
72
|
);
|
|
@@ -0,0 +1,52 @@
|
|
|
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: 0,
|
|
37
|
+
},
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
export const StyledLayoutContainer = styled(Box)(({ theme }) => ({
|
|
41
|
+
width: "100%",
|
|
42
|
+
position: "fixed",
|
|
43
|
+
top: "70px",
|
|
44
|
+
backgroundColor: theme.palette.background.default,
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
export const StyledMainContainer = styled("main")(() => ({
|
|
48
|
+
width: "90%",
|
|
49
|
+
margin: "auto",
|
|
50
|
+
overflowY: "auto",
|
|
51
|
+
display: "flex",
|
|
52
|
+
}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box, styled } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const StyledContainer = styled(Box)(({ theme }) => ({
|
|
4
|
+
width: "100%",
|
|
5
|
+
height: "calc(100vh - 120px)",
|
|
6
|
+
overflowY: "auto",
|
|
7
|
+
backgroundColor: theme.palette.background.paper,
|
|
8
|
+
borderRadius: "5px",
|
|
9
|
+
"&::-webkit-scrollbar": {
|
|
10
|
+
width: "0.4em",
|
|
11
|
+
height: "0.4em",
|
|
12
|
+
},
|
|
13
|
+
"&::-webkit-scrollbar-thumb": {
|
|
14
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
15
|
+
borderRadius: "3px",
|
|
16
|
+
},
|
|
17
|
+
"@media (max-width: 1024px)": {
|
|
18
|
+
marginLeft: 0,
|
|
19
|
+
},
|
|
20
|
+
padding: "25px",
|
|
21
|
+
marginTop: "10px",
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export const PageContent = ({ children }: { children: React.ReactNode }) => {
|
|
25
|
+
return <StyledContainer> {children}</StyledContainer>;
|
|
26
|
+
};
|
|
@@ -4,7 +4,6 @@ import { HomeIcon } from "../../../assets/images/icons";
|
|
|
4
4
|
import { activeStore } from "../../../store/activeStore";
|
|
5
5
|
import { Typography } from "../../Typography/Typography";
|
|
6
6
|
import {
|
|
7
|
-
Main,
|
|
8
7
|
StyledDrawer,
|
|
9
8
|
StyledLinkButton,
|
|
10
9
|
StyledList,
|
|
@@ -14,7 +13,6 @@ import {
|
|
|
14
13
|
|
|
15
14
|
export interface SideNavigationProps {
|
|
16
15
|
menu?: any;
|
|
17
|
-
children: React.ReactNode;
|
|
18
16
|
open?: any;
|
|
19
17
|
handleDrawer?: any;
|
|
20
18
|
}
|
|
@@ -32,12 +30,11 @@ export interface MenuItemProps {
|
|
|
32
30
|
|
|
33
31
|
export const SideNavigation = ({
|
|
34
32
|
menu,
|
|
35
|
-
children,
|
|
36
33
|
open,
|
|
37
34
|
handleDrawer,
|
|
38
35
|
}: SideNavigationProps) => {
|
|
39
36
|
return (
|
|
40
|
-
<Stack gap="20px" direction={"row"}>
|
|
37
|
+
<Stack gap="20px" direction={"row"} marginTop={"10px"}>
|
|
41
38
|
<StyledDrawer
|
|
42
39
|
variant={window.innerWidth > 1024 ? "persistent" : "temporary"}
|
|
43
40
|
anchor="left"
|
|
@@ -50,7 +47,6 @@ export const SideNavigation = ({
|
|
|
50
47
|
))}
|
|
51
48
|
</StyledList>
|
|
52
49
|
</StyledDrawer>
|
|
53
|
-
<Main open={open}>{children}</Main>
|
|
54
50
|
</Stack>
|
|
55
51
|
);
|
|
56
52
|
};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Drawer,
|
|
4
|
-
List,
|
|
5
|
-
ListItem,
|
|
6
|
-
ListItemButton,
|
|
7
|
-
styled,
|
|
8
|
-
} from "@mui/material";
|
|
1
|
+
import { Drawer, List, ListItem, ListItemButton, styled } from "@mui/material";
|
|
9
2
|
import { Link } from "react-router-dom";
|
|
10
3
|
const drawerWidth: number = 240;
|
|
11
4
|
|
|
@@ -53,56 +46,6 @@ export const StyledLinkButton = styled(Link)({
|
|
|
53
46
|
},
|
|
54
47
|
});
|
|
55
48
|
|
|
56
|
-
export const Main = styled("main", {
|
|
57
|
-
shouldForwardProp: (prop) => prop !== "open",
|
|
58
|
-
})<{
|
|
59
|
-
open?: boolean;
|
|
60
|
-
}>(({ theme, open }) => ({
|
|
61
|
-
padding: "25px",
|
|
62
|
-
transition: theme.transitions.create("margin", {
|
|
63
|
-
easing: theme.transitions.easing.sharp,
|
|
64
|
-
duration: theme.transitions.duration.leavingScreen,
|
|
65
|
-
}),
|
|
66
|
-
marginLeft: `-${drawerWidth}px`,
|
|
67
|
-
...(open && {
|
|
68
|
-
transition: theme.transitions.create("margin", {
|
|
69
|
-
easing: theme.transitions.easing.easeOut,
|
|
70
|
-
duration: theme.transitions.duration.enteringScreen,
|
|
71
|
-
}),
|
|
72
|
-
marginLeft: 0,
|
|
73
|
-
}),
|
|
74
|
-
width: "100%",
|
|
75
|
-
height: "calc(100vh - 120px)",
|
|
76
|
-
overflowY: "auto",
|
|
77
|
-
backgroundColor: theme.palette.background.paper,
|
|
78
|
-
borderRadius: "5px",
|
|
79
|
-
"&::-webkit-scrollbar": {
|
|
80
|
-
width: "0.4em",
|
|
81
|
-
height: "0.4em",
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
"&::-webkit-scrollbar-thumb": {
|
|
85
|
-
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
86
|
-
borderRadius: "3px",
|
|
87
|
-
},
|
|
88
|
-
"@media (max-width: 1024px)": {
|
|
89
|
-
marginLeft: 0,
|
|
90
|
-
},
|
|
91
|
-
}));
|
|
92
|
-
|
|
93
|
-
export const StyledMainContainer = styled("main")(() => ({
|
|
94
|
-
width: "90%",
|
|
95
|
-
margin: "auto",
|
|
96
|
-
overflowY: "auto",
|
|
97
|
-
}));
|
|
98
|
-
|
|
99
|
-
export const StyledLayoutContainer = styled(Box)(({ theme }) => ({
|
|
100
|
-
width: "100%",
|
|
101
|
-
position: "fixed",
|
|
102
|
-
top: "60px",
|
|
103
|
-
backgroundColor: theme.palette.background.default,
|
|
104
|
-
}));
|
|
105
|
-
|
|
106
49
|
export const StyledList = styled(List)(({ theme }) => ({
|
|
107
50
|
backgroundColor: theme.palette.background.paper,
|
|
108
51
|
height: "calc(100vh - 120px)",
|
package/src/components/export.ts
CHANGED
|
@@ -8,3 +8,5 @@ export * from "./Layout/Header/AppHeader";
|
|
|
8
8
|
export * from "./Layout/Header/AppLogo";
|
|
9
9
|
export * from "./Layout/Header/AppsMenu";
|
|
10
10
|
export * from "./Layout/LayoutWrapper/LayoutWrapper";
|
|
11
|
+
export * from "./Layout/PageContent/PageContent";
|
|
12
|
+
export * from "./Layout/SideNavigation/SideNavigation";
|