@campxdev/react-blueprint 0.1.15 → 0.1.17
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/preview.tsx +3 -3
- package/package.json +15 -14
- package/src/components/DataDisplay/DataTable/DataTable.stories.tsx +34 -17
- package/src/components/DataDisplay/DataTable/DataTable.tsx +32 -7
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +60 -6
- package/src/components/DataDisplay/styles.tsx +2 -0
- package/src/components/DropDownMenu/DropDownButton.tsx +3 -25
- package/src/components/DropDownMenu/DropDownMenu.stories.tsx +34 -31
- package/src/components/DropDownMenu/DropDownMenu.tsx +4 -4
- package/src/components/DropDownMenu/DropdownMenuItem.tsx +25 -0
- package/src/components/DropDownMenu/styles.tsx +1 -7
- package/src/components/Icons/IconComponents/AppsIcon.tsx +36 -0
- package/src/components/Icons/IconComponents/CareerIcon.tsx +24 -0
- package/src/components/Icons/IconComponents/ClogWheelIcon.tsx +38 -0
- package/src/components/Icons/IconComponents/DashBoardIcon.tsx +65 -0
- package/src/components/Icons/IconComponents/ExamResultIcon.tsx +26 -0
- package/src/components/Icons/IconComponents/HelpIcon.tsx +57 -0
- package/src/components/Icons/IconComponents/HomeIcon.tsx +52 -0
- package/src/components/Icons/IconComponents/LeftIcon.tsx +72 -0
- package/src/components/Icons/IconComponents/LogoutIcon.tsx +66 -0
- package/src/components/Icons/IconComponents/NotificationIcon.tsx +29 -0
- package/src/components/Icons/IconComponents/RightIcon.tsx +65 -0
- package/src/components/Icons/IconComponents/TicketsIcon.tsx +74 -0
- package/src/components/Icons/Icons.stories.tsx +21 -0
- package/src/components/Icons/Icons.tsx +14 -0
- package/src/components/Icons/export.ts +26 -0
- package/src/components/Input/Button/Button.tsx +10 -8
- package/src/components/Input/LabelWrapper/LabelWrapper.tsx +35 -0
- package/src/components/Input/SingleSelect/SingleSelect.stories.tsx +85 -36
- package/src/components/Input/SingleSelect/SingleSelect.tsx +17 -69
- package/src/components/Input/TextField/TextField.tsx +9 -5
- package/src/components/Input/components/FetchingOptionsLoader.tsx +16 -4
- package/src/components/Input/styles.tsx +9 -1
- package/src/components/Layout/Header/AppHeader.stories.tsx +5 -5
- package/src/components/Layout/Header/AppsMenu.tsx +2 -2
- package/src/components/Layout/Header/HeaderActions/CogWheelMenu.tsx +4 -4
- package/src/components/Layout/Header/HeaderActions/HeaderActions.tsx +2 -2
- package/src/components/Layout/Header/HeaderActions/UserBox.tsx +33 -18
- package/src/components/Layout/LayoutWrapper/LayoutWrapper.stories.tsx +33 -8
- package/src/components/Layout/LayoutWrapper/LayoutWrapper.tsx +3 -3
- package/src/components/Layout/LayoutWrapper/styles.tsx +1 -1
- package/src/components/Layout/PageContent/PageContent.stories.tsx +26 -0
- package/src/components/Layout/PageContent/PageContent.tsx +8 -2
- package/src/components/Layout/SideNavigation/SideNavigation.stories.tsx +57 -0
- package/src/components/Layout/SideNavigation/SideNavigation.tsx +28 -18
- package/src/components/Layout/SideNavigation/styles/styles.tsx +7 -2
- package/src/components/Layout/Spinner/Spinner.css +1 -1
- package/src/components/Layout/Spinner/Spinner.stories.tsx +1 -1
- package/src/components/Layout/Spinner/Spinner.tsx +1 -1
- package/src/components/Modals/DialogButton.tsx +1 -1
- package/src/components/TabsContainer/TabsContainer.stories.tsx +48 -0
- package/src/components/TabsContainer/TabsContainer.tsx +58 -0
- package/src/components/export.ts +1 -0
- package/src/themes/commonTheme.ts +60 -20
- package/src/themes/darkTheme.ts +2 -3
- package/src/themes/lightTheme.ts +2 -3
- package/src/utils/campxAxios.ts +1 -1
- package/tsconfig.json +1 -3
- package/types/theme.d.ts +41 -0
- package/src/assets/images/icons.tsx +0 -427
- package/src/components/DropDownMenu/MenuItemButton.tsx +0 -24
- package/src/components/Input/Label/Label.tsx +0 -11
package/.storybook/preview.tsx
CHANGED
|
@@ -1,12 +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 {
|
|
4
|
+
import { BrowserRouter } from "react-router-dom";
|
|
5
5
|
import { useDarkMode } from "storybook-dark-mode";
|
|
6
|
+
import { MuiThemeProvider } from "../src/themes/MuiThemeProvider";
|
|
7
|
+
import { DarkColorTokens, LightColorTokens } from "../src/themes/colorTokens";
|
|
6
8
|
import { darkTheme } from "../src/themes/darkTheme";
|
|
7
9
|
import { lightTheme } from "../src/themes/lightTheme";
|
|
8
|
-
import { DarkColorTokens, LightColorTokens } from "../src/themes/colorTokens";
|
|
9
|
-
import { BrowserRouter } from "react-router-dom";
|
|
10
10
|
|
|
11
11
|
const preview: Preview = {
|
|
12
12
|
parameters: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/react-blueprint",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"main": "./export.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
@@ -9,7 +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.
|
|
12
|
+
"@storybook/addon-backgrounds": "^8.1.5",
|
|
13
13
|
"@testing-library/jest-dom": "^5.14.1",
|
|
14
14
|
"@testing-library/react": "^13.0.0",
|
|
15
15
|
"@testing-library/user-event": "^13.2.1",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"@types/react": "^18.0.0",
|
|
19
19
|
"@types/react-dom": "^18.0.0",
|
|
20
20
|
"axios": "^1.7.2",
|
|
21
|
+
"framer-motion": "^11.2.9",
|
|
21
22
|
"js-cookie": "^3.0.5",
|
|
22
23
|
"pullstate": "^1.24.0",
|
|
23
24
|
"react": "^18.3.1",
|
|
@@ -58,21 +59,21 @@
|
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
61
|
-
"@chromatic-com/storybook": "^1.
|
|
62
|
-
"@storybook/addon-essentials": "^8.1.
|
|
63
|
-
"@storybook/addon-interactions": "^8.1.
|
|
64
|
-
"@storybook/addon-links": "^8.1.
|
|
65
|
-
"@storybook/addon-mdx-gfm": "^8.1.
|
|
66
|
-
"@storybook/addon-onboarding": "^8.1.
|
|
67
|
-
"@storybook/blocks": "^8.1.
|
|
68
|
-
"@storybook/preset-create-react-app": "^8.1.
|
|
69
|
-
"@storybook/react": "^8.1.
|
|
70
|
-
"@storybook/react-webpack5": "^8.1.
|
|
71
|
-
"@storybook/test": "^8.1.
|
|
62
|
+
"@chromatic-com/storybook": "^1.5.0",
|
|
63
|
+
"@storybook/addon-essentials": "^8.1.5",
|
|
64
|
+
"@storybook/addon-interactions": "^8.1.5",
|
|
65
|
+
"@storybook/addon-links": "^8.1.5",
|
|
66
|
+
"@storybook/addon-mdx-gfm": "^8.1.5",
|
|
67
|
+
"@storybook/addon-onboarding": "^8.1.5",
|
|
68
|
+
"@storybook/blocks": "^8.1.5",
|
|
69
|
+
"@storybook/preset-create-react-app": "^8.1.5",
|
|
70
|
+
"@storybook/react": "^8.1.5",
|
|
71
|
+
"@storybook/react-webpack5": "^8.1.5",
|
|
72
|
+
"@storybook/test": "^8.1.5",
|
|
72
73
|
"@types/js-cookie": "^3.0.5",
|
|
73
74
|
"eslint-plugin-storybook": "^0.8.0",
|
|
74
75
|
"prop-types": "^15.8.1",
|
|
75
|
-
"storybook": "^8.1.
|
|
76
|
+
"storybook": "^8.1.5",
|
|
76
77
|
"webpack": "^5.91.0"
|
|
77
78
|
}
|
|
78
79
|
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { GridColDef } from "@mui/x-data-grid";
|
|
1
|
+
import { GridColDef, GridColumnGroupingModel } from "@mui/x-data-grid";
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import { DataTable } from "./DataTable"; // Make sure the path to your component is correct
|
|
4
4
|
|
|
5
5
|
const columns: GridColDef[] = [
|
|
6
|
-
{ field: "id", headerName: "ID",
|
|
7
|
-
{ field: "firstName", headerName: "First name",
|
|
8
|
-
{ field: "lastName", headerName: "Last name",
|
|
9
|
-
{ field: "age", headerName: "Age", type: "number",
|
|
10
|
-
{
|
|
11
|
-
field: "fullName",
|
|
12
|
-
headerName: "Full name",
|
|
13
|
-
description: "This column has a value getter and is not sortable.",
|
|
14
|
-
sortable: false,
|
|
15
|
-
width: 160,
|
|
16
|
-
},
|
|
6
|
+
{ field: "id", headerName: "ID", flex: 1 },
|
|
7
|
+
{ field: "firstName", headerName: "First name", flex: 3 },
|
|
8
|
+
{ field: "lastName", headerName: "Last name", flex: 3 },
|
|
9
|
+
{ field: "age", headerName: "Age", type: "number", flex: 1 },
|
|
17
10
|
];
|
|
18
11
|
|
|
19
12
|
const rows = [
|
|
@@ -26,6 +19,16 @@ const rows = [
|
|
|
26
19
|
{ id: 7, lastName: "Clifford", firstName: "Ferrara", age: 44 },
|
|
27
20
|
{ id: 8, lastName: "Frances", firstName: "Rossini", age: 36 },
|
|
28
21
|
{ id: 9, lastName: "Roxie", firstName: "Harvey", age: 65 },
|
|
22
|
+
{ id: 10, lastName: "Baratheon", firstName: "Robert", age: 40 },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const columnGroupingModel: GridColumnGroupingModel = [
|
|
26
|
+
{
|
|
27
|
+
groupId: "full_name",
|
|
28
|
+
headerName: "Full Name",
|
|
29
|
+
description: "Full Name of Character",
|
|
30
|
+
children: [{ field: "firstName" }, { field: "lastName" }],
|
|
31
|
+
},
|
|
29
32
|
];
|
|
30
33
|
|
|
31
34
|
// Define the default export with Meta type including the component type
|
|
@@ -45,17 +48,31 @@ const meta: Meta<typeof DataTable> = {
|
|
|
45
48
|
control: "number",
|
|
46
49
|
description: "Total Number of rows",
|
|
47
50
|
},
|
|
51
|
+
onPageChange: {
|
|
52
|
+
action: "onPageChange", // This will log actions in the actions panel of Storybook
|
|
53
|
+
description: "Callback function when the page changes",
|
|
54
|
+
},
|
|
55
|
+
onLimitChange: {
|
|
56
|
+
action: "onLimitChange", // This will log actions in the actions panel of Storybook
|
|
57
|
+
description: "Callback function when the limit changes",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
args: {
|
|
61
|
+
limit: 10,
|
|
62
|
+
offset: 0,
|
|
63
|
+
totalCount: 100,
|
|
64
|
+
onPageChange: (page) => {},
|
|
65
|
+
onLimitChange: (limit) => {},
|
|
66
|
+
columnGroupingModel,
|
|
67
|
+
columns,
|
|
68
|
+
rows,
|
|
48
69
|
},
|
|
49
70
|
};
|
|
50
71
|
|
|
51
72
|
export default meta;
|
|
52
73
|
const Template: StoryObj<typeof DataTable> = {
|
|
53
74
|
render: (args) => <DataTable {...args} />,
|
|
54
|
-
|
|
55
|
-
args: {
|
|
56
|
-
columns,
|
|
57
|
-
rows,
|
|
58
|
-
},
|
|
75
|
+
args: {},
|
|
59
76
|
};
|
|
60
77
|
|
|
61
78
|
export const Default: StoryObj<typeof DataTable> = {
|
|
@@ -1,25 +1,50 @@
|
|
|
1
|
-
import { Pagination } from "@mui/material";
|
|
2
1
|
import {
|
|
3
2
|
DataGrid as MuiDataGrid,
|
|
4
3
|
DataGridProps as MuiDataGridProps,
|
|
5
4
|
} from "@mui/x-data-grid";
|
|
6
5
|
import { DataGridContainer } from "../styles";
|
|
6
|
+
import { TablePagination } from "./TablePagination";
|
|
7
7
|
|
|
8
8
|
export type DataTableProps = {
|
|
9
|
-
limit
|
|
10
|
-
offset
|
|
11
|
-
totalCount
|
|
9
|
+
limit?: number;
|
|
10
|
+
offset?: number;
|
|
11
|
+
totalCount?: number;
|
|
12
|
+
onPageChange?: (page: number) => void;
|
|
13
|
+
onLimitChange?: (limit: number) => void;
|
|
12
14
|
} & MuiDataGridProps;
|
|
13
15
|
|
|
14
16
|
export const DataTable = (props: DataTableProps) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
+
const { limit, offset, totalCount, onPageChange, onLimitChange } = props;
|
|
18
|
+
|
|
17
19
|
return (
|
|
18
20
|
<DataGridContainer>
|
|
19
21
|
<MuiDataGrid
|
|
20
22
|
{...props}
|
|
21
23
|
slots={{
|
|
22
|
-
pagination: () =>
|
|
24
|
+
pagination: () => {
|
|
25
|
+
if (
|
|
26
|
+
limit === undefined ||
|
|
27
|
+
offset === undefined ||
|
|
28
|
+
totalCount === undefined ||
|
|
29
|
+
onPageChange === undefined ||
|
|
30
|
+
onLimitChange === undefined
|
|
31
|
+
) {
|
|
32
|
+
return <></>;
|
|
33
|
+
}
|
|
34
|
+
const pages = Math.ceil(totalCount / limit);
|
|
35
|
+
const currentPage = Math.ceil(offset / limit) || 1;
|
|
36
|
+
return (
|
|
37
|
+
<TablePagination
|
|
38
|
+
count={pages}
|
|
39
|
+
page={currentPage}
|
|
40
|
+
limit={limit}
|
|
41
|
+
offset={offset}
|
|
42
|
+
totalCount={totalCount}
|
|
43
|
+
onPageChange={onPageChange}
|
|
44
|
+
onLimitChange={onLimitChange}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
},
|
|
23
48
|
}}
|
|
24
49
|
/>
|
|
25
50
|
</DataGridContainer>
|
|
@@ -3,20 +3,74 @@ import {
|
|
|
3
3
|
PaginationProps as MuiPaginationProps,
|
|
4
4
|
Stack,
|
|
5
5
|
} from "@mui/material";
|
|
6
|
+
import { DropdownMenuItem } from "../../DropDownMenu/DropdownMenuItem";
|
|
6
7
|
import { Typography } from "../../Typography/Typography";
|
|
8
|
+
import { DropDownButton, DropdownMenu } from "../../export";
|
|
7
9
|
|
|
8
10
|
export type PaginationProps = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
limit: number;
|
|
12
|
+
offset: number;
|
|
11
13
|
totalCount: number;
|
|
14
|
+
onPageChange: (offset: number) => void;
|
|
15
|
+
onLimitChange: (limit: number) => void;
|
|
12
16
|
} & MuiPaginationProps;
|
|
13
17
|
|
|
14
18
|
export const TablePagination = (props: PaginationProps) => {
|
|
15
|
-
const {
|
|
19
|
+
const { limit, offset, totalCount, onPageChange, onLimitChange } = props;
|
|
20
|
+
|
|
16
21
|
return (
|
|
17
|
-
<Stack
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
<Stack
|
|
23
|
+
direction="row"
|
|
24
|
+
justifyContent="space-between"
|
|
25
|
+
alignItems="center"
|
|
26
|
+
width="100%"
|
|
27
|
+
padding="10px 30px"
|
|
28
|
+
>
|
|
29
|
+
<Typography variant="caption">{`Showing ${offset + 1} - ${offset + limit} rows of ${totalCount}`}</Typography>
|
|
30
|
+
<MuiPagination
|
|
31
|
+
{...props}
|
|
32
|
+
variant="outlined"
|
|
33
|
+
shape="rounded"
|
|
34
|
+
onChange={(e, v) => onPageChange(Number(v) * limit)}
|
|
35
|
+
/>
|
|
36
|
+
<DropdownMenu
|
|
37
|
+
anchor={({ open }) => (
|
|
38
|
+
<DropDownButton
|
|
39
|
+
loading={false}
|
|
40
|
+
onClick={open}
|
|
41
|
+
sx={{ minWidth: "130px", padding: "10px 20px", maxHeight: "32px" }}
|
|
42
|
+
>
|
|
43
|
+
{limit} / Page
|
|
44
|
+
</DropDownButton>
|
|
45
|
+
)}
|
|
46
|
+
menuListProps={{
|
|
47
|
+
sx: {
|
|
48
|
+
minWidth: "130px",
|
|
49
|
+
"& li": {
|
|
50
|
+
minHeight: "32px !important",
|
|
51
|
+
padding: "10px 20px",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
}}
|
|
55
|
+
menu={[
|
|
56
|
+
<DropdownMenuItem
|
|
57
|
+
label="20 / Page"
|
|
58
|
+
onClick={() => onLimitChange(Number(20))}
|
|
59
|
+
/>,
|
|
60
|
+
<DropdownMenuItem
|
|
61
|
+
label="50 / Page"
|
|
62
|
+
onClick={() => onLimitChange(Number(50))}
|
|
63
|
+
/>,
|
|
64
|
+
<DropdownMenuItem
|
|
65
|
+
label="100 / Page"
|
|
66
|
+
onClick={() => onLimitChange(Number(100))}
|
|
67
|
+
/>,
|
|
68
|
+
<DropdownMenuItem
|
|
69
|
+
label="200 / Page"
|
|
70
|
+
onClick={() => onLimitChange(Number(200))}
|
|
71
|
+
/>,
|
|
72
|
+
]}
|
|
73
|
+
/>
|
|
20
74
|
</Stack>
|
|
21
75
|
);
|
|
22
76
|
};
|
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
import { KeyboardArrowDown } from "@mui/icons-material";
|
|
2
|
-
import {
|
|
3
|
-
import { StyledDropDownButton } from "./styles";
|
|
2
|
+
import { Button, ButtonProps } from "../Input/Button/Button";
|
|
4
3
|
|
|
5
|
-
export const DropDownButton = ({
|
|
6
|
-
button,
|
|
7
|
-
handleClick,
|
|
8
|
-
loading,
|
|
9
|
-
}: {
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
button?: {
|
|
12
|
-
label?: string;
|
|
13
|
-
buttonProps?: ButtonProps;
|
|
14
|
-
};
|
|
15
|
-
handleClick: any;
|
|
16
|
-
}) => {
|
|
4
|
+
export const DropDownButton = (props: ButtonProps) => {
|
|
17
5
|
return (
|
|
18
|
-
<
|
|
19
|
-
onClick={handleClick}
|
|
20
|
-
variant="outlined"
|
|
21
|
-
disabled={loading}
|
|
22
|
-
endIcon={
|
|
23
|
-
loading ? <CircularProgress size="20px" /> : <KeyboardArrowDown />
|
|
24
|
-
}
|
|
25
|
-
{...button?.buttonProps}
|
|
26
|
-
>
|
|
27
|
-
{button?.label}
|
|
28
|
-
</StyledDropDownButton>
|
|
6
|
+
<Button {...props} variant="outlined" endIcon={<KeyboardArrowDown />} />
|
|
29
7
|
);
|
|
30
8
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
2
2
|
import { IconButton } from "@mui/material";
|
|
3
3
|
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
import {
|
|
4
|
+
import { Icons } from "../export";
|
|
5
5
|
import { DropDownButton } from "./DropDownButton";
|
|
6
6
|
import { DropDownIcon } from "./DropDownIcon";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { DropdownMenu, DropdownMenuProps } from "./DropDownMenu";
|
|
8
|
+
import { DropdownMenuItem } from "./DropdownMenuItem";
|
|
9
9
|
|
|
10
10
|
// Define the default export with Meta type including the component type
|
|
11
|
-
const meta: Meta<typeof
|
|
11
|
+
const meta: Meta<typeof DropdownMenu> = {
|
|
12
12
|
title: "Navigation/DropDownMenu",
|
|
13
|
-
component:
|
|
13
|
+
component: DropdownMenu,
|
|
14
14
|
tags: ["autodocs"],
|
|
15
15
|
argTypes: {
|
|
16
16
|
anchor: {
|
|
@@ -30,66 +30,69 @@ const meta: Meta<typeof DropDownMenu> = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export default meta;
|
|
33
|
-
type Story = StoryObj<typeof
|
|
33
|
+
type Story = StoryObj<typeof DropdownMenu>;
|
|
34
34
|
|
|
35
35
|
// Primary story
|
|
36
36
|
export const Primary: Story = {
|
|
37
|
-
render: (args:
|
|
37
|
+
render: (args: DropdownMenuProps) => <DropdownMenu {...args} />,
|
|
38
38
|
args: {
|
|
39
39
|
anchor: ({ open }: { open: (e: any) => void }) => (
|
|
40
40
|
<DropDownButton
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}}
|
|
45
|
-
handleClick={open}
|
|
41
|
+
variant="contained"
|
|
42
|
+
color="primary"
|
|
43
|
+
onClick={open}
|
|
46
44
|
loading={false}
|
|
47
|
-
|
|
45
|
+
>
|
|
46
|
+
Dropdown Button
|
|
47
|
+
</DropDownButton>
|
|
48
48
|
),
|
|
49
49
|
menu: [
|
|
50
|
-
<
|
|
51
|
-
icon={<HelpIcon />}
|
|
50
|
+
<DropdownMenuItem
|
|
51
|
+
icon={<Icons.HelpIcon />}
|
|
52
52
|
label={"Register"}
|
|
53
53
|
onClick={() => {
|
|
54
54
|
console.log("hi");
|
|
55
55
|
}}
|
|
56
56
|
/>,
|
|
57
57
|
|
|
58
|
-
<
|
|
58
|
+
<DropdownMenuItem
|
|
59
59
|
label={"Active Devices"}
|
|
60
60
|
onClick={() => {
|
|
61
61
|
console.log("hi");
|
|
62
62
|
}}
|
|
63
63
|
/>,
|
|
64
64
|
],
|
|
65
|
+
menuListProps: {
|
|
66
|
+
sx: { width: "20px" },
|
|
67
|
+
},
|
|
65
68
|
},
|
|
66
69
|
};
|
|
67
70
|
|
|
68
71
|
// Story with Button Loading
|
|
69
72
|
export const WithButtonLoading: Story = {
|
|
70
|
-
render: (args:
|
|
73
|
+
render: (args: DropdownMenuProps) => <DropdownMenu {...args} />,
|
|
71
74
|
args: {
|
|
72
75
|
anchor: ({ open }: { open: (e: any) => void }) => (
|
|
73
76
|
<DropDownButton
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
variant="contained"
|
|
78
|
+
color="primary"
|
|
79
|
+
onClick={open}
|
|
80
|
+
loading={false}
|
|
81
|
+
>
|
|
82
|
+
Dropdown Button
|
|
83
|
+
</DropDownButton>
|
|
81
84
|
),
|
|
82
85
|
menu: [
|
|
83
|
-
<
|
|
84
|
-
icon={<HelpIcon />}
|
|
86
|
+
<DropdownMenuItem
|
|
87
|
+
icon={<Icons.HelpIcon />}
|
|
85
88
|
label={"Register"}
|
|
86
89
|
onClick={() => {
|
|
87
90
|
window.open("/payment", "_blank");
|
|
88
91
|
}}
|
|
89
92
|
/>,
|
|
90
93
|
|
|
91
|
-
<
|
|
92
|
-
icon={<HelpIcon />}
|
|
94
|
+
<DropdownMenuItem
|
|
95
|
+
icon={<Icons.HelpIcon />}
|
|
93
96
|
label={"Register"}
|
|
94
97
|
onClick={() => {
|
|
95
98
|
console.log("hi");
|
|
@@ -101,13 +104,13 @@ export const WithButtonLoading: Story = {
|
|
|
101
104
|
|
|
102
105
|
// Story with Default Icon
|
|
103
106
|
export const WithDefaultIcon: Story = {
|
|
104
|
-
render: (args:
|
|
107
|
+
render: (args: DropdownMenuProps) => <DropdownMenu {...args} />,
|
|
105
108
|
args: {
|
|
106
109
|
anchor: ({ open }: { open: (e: any) => void }) => (
|
|
107
110
|
<DropDownIcon handleClick={open} />
|
|
108
111
|
),
|
|
109
112
|
menu: [
|
|
110
|
-
<
|
|
113
|
+
<DropdownMenuItem
|
|
111
114
|
label={"Student Payments"}
|
|
112
115
|
onClick={() => {
|
|
113
116
|
window.open("/payment", "_blank");
|
|
@@ -119,7 +122,7 @@ export const WithDefaultIcon: Story = {
|
|
|
119
122
|
|
|
120
123
|
// Story with Icon
|
|
121
124
|
export const WithIcon: Story = {
|
|
122
|
-
render: (args:
|
|
125
|
+
render: (args: DropdownMenuProps) => <DropdownMenu {...args} />,
|
|
123
126
|
args: {
|
|
124
127
|
anchor: ({ open }: { open: (e: any) => void }) => (
|
|
125
128
|
<DropDownIcon
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Divider, Menu, MenuListProps, MenuProps } from "@mui/material";
|
|
2
2
|
import { ReactNode, useState } from "react";
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export type DropdownMenuProps = {
|
|
5
5
|
anchor: (props: { open: (e: any) => void }) => ReactNode;
|
|
6
6
|
menu: ReactNode[];
|
|
7
7
|
menuProps?: Omit<MenuProps, "open">;
|
|
8
8
|
menuListProps?: MenuListProps;
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const DropdownMenu = ({
|
|
12
12
|
menuProps,
|
|
13
13
|
menu = [],
|
|
14
14
|
menuListProps,
|
|
15
15
|
anchor,
|
|
16
|
-
}:
|
|
16
|
+
}: DropdownMenuProps) => {
|
|
17
17
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
18
18
|
const [open, setOpen] = useState(false);
|
|
19
19
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ListItemIcon, MenuItemProps, SxProps } from "@mui/material";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { StyledMenuItem } from "./styles";
|
|
4
|
+
|
|
5
|
+
export type DropdownMenuItemProps = {
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
sx?: SxProps;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
} & MenuItemProps;
|
|
11
|
+
|
|
12
|
+
export const DropdownMenuItem = ({
|
|
13
|
+
icon,
|
|
14
|
+
label,
|
|
15
|
+
onClick,
|
|
16
|
+
sx = {},
|
|
17
|
+
...props
|
|
18
|
+
}: DropdownMenuItemProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<StyledMenuItem sx={sx} onClick={onClick} {...props}>
|
|
21
|
+
{icon && <ListItemIcon>{icon}</ListItemIcon>}
|
|
22
|
+
{label}
|
|
23
|
+
</StyledMenuItem>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export const StyledDropDownButton = styled(Button)(({}) => ({
|
|
4
|
-
minWidth: "180px",
|
|
5
|
-
justifyContent: "space-between",
|
|
6
|
-
}));
|
|
1
|
+
import { IconButton, MenuItem, styled } from "@mui/material";
|
|
7
2
|
|
|
8
3
|
export const StyledIconButton = styled(IconButton, {
|
|
9
4
|
shouldForwardProp: (prop) => prop !== "outlined",
|
|
@@ -19,7 +14,6 @@ export const StyledIconButton = styled(IconButton, {
|
|
|
19
14
|
export const StyledMenuItem = styled(MenuItem)(({}) => ({
|
|
20
15
|
display: "flex",
|
|
21
16
|
alignItems: "center",
|
|
22
|
-
padding: "10px 16px",
|
|
23
17
|
gap: "5px",
|
|
24
18
|
"& .MuiListItemIcon-root": {
|
|
25
19
|
minWidth: "24px",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const AppsIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
id="apps"
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
width="24"
|
|
7
|
+
height="24"
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
id="Path_15109"
|
|
12
|
+
data-name="Path 15109"
|
|
13
|
+
d="M7,0H4A4,4,0,0,0,0,4V7a4,4,0,0,0,4,4H7a4,4,0,0,0,4-4V4A4,4,0,0,0,7,0ZM9,7A2,2,0,0,1,7,9H4A2,2,0,0,1,2,7V4A2,2,0,0,1,4,2H7A2,2,0,0,1,9,4Z"
|
|
14
|
+
fill="#d4483e"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
id="Path_15110"
|
|
18
|
+
data-name="Path 15110"
|
|
19
|
+
d="M20,0H17a4,4,0,0,0-4,4V7a4,4,0,0,0,4,4h3a4,4,0,0,0,4-4V4A4,4,0,0,0,20,0Zm2,7a2,2,0,0,1-2,2H17a2,2,0,0,1-2-2V4a2,2,0,0,1,2-2h3a2,2,0,0,1,2,2Z"
|
|
20
|
+
fill="#f8d759"
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
id="Path_15111"
|
|
24
|
+
data-name="Path 15111"
|
|
25
|
+
d="M7,13H4a4,4,0,0,0-4,4v3a4,4,0,0,0,4,4H7a4,4,0,0,0,4-4V17A4,4,0,0,0,7,13Zm2,7a2,2,0,0,1-2,2H4a2,2,0,0,1-2-2V17a2,2,0,0,1,2-2H7a2,2,0,0,1,2,2Z"
|
|
26
|
+
fill="#88b053"
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
id="Path_15112"
|
|
30
|
+
data-name="Path 15112"
|
|
31
|
+
d="M20,13H17a4,4,0,0,0-4,4v3a4,4,0,0,0,4,4h3a4,4,0,0,0,4-4V17A4,4,0,0,0,20,13Zm2,7a2,2,0,0,1-2,2H17a2,2,0,0,1-2-2V17a2,2,0,0,1,2-2h3a2,2,0,0,1,2,2Z"
|
|
32
|
+
fill="#4baabe"
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const CareerIcon = () => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
const color = theme.palette.text.primary;
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
width="18.3"
|
|
10
|
+
height="20.3"
|
|
11
|
+
viewBox="0 0 20.3 20.3"
|
|
12
|
+
style={{
|
|
13
|
+
fill: color,
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
id="briefcase"
|
|
18
|
+
d="M15.833,3.333h-.917A4.174,4.174,0,0,0,10.833,0H9.167A4.174,4.174,0,0,0,5.083,3.333H4.167A4.172,4.172,0,0,0,0,7.5v8.333A4.172,4.172,0,0,0,4.167,20H15.833A4.172,4.172,0,0,0,20,15.833V7.5a4.172,4.172,0,0,0-4.167-4.167ZM9.167,1.667h1.667A2.5,2.5,0,0,1,13.18,3.333H6.82A2.5,2.5,0,0,1,9.167,1.667ZM4.167,5H15.833a2.5,2.5,0,0,1,2.5,2.5V10H1.667V7.5A2.5,2.5,0,0,1,4.167,5ZM15.833,18.333H4.167a2.5,2.5,0,0,1-2.5-2.5V11.667h7.5V12.5a.833.833,0,0,0,1.667,0v-.833h7.5v4.167A2.5,2.5,0,0,1,15.833,18.333Z"
|
|
19
|
+
transform="translate(0.15 0.15)"
|
|
20
|
+
stroke-width="0.3"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const ClogWheelIcon = () => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
const color = theme.palette.text.primary;
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
width="16.595"
|
|
10
|
+
height="20"
|
|
11
|
+
viewBox="0 0 17.995 20"
|
|
12
|
+
style={{
|
|
13
|
+
fill: color,
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<g
|
|
17
|
+
id="settings_11_"
|
|
18
|
+
data-name="settings (11)"
|
|
19
|
+
transform="translate(-1.203)"
|
|
20
|
+
>
|
|
21
|
+
<path
|
|
22
|
+
id="Path_1375"
|
|
23
|
+
data-name="Path 1375"
|
|
24
|
+
d="M11.333,8a3.333,3.333,0,1,0,3.333,3.333A3.333,3.333,0,0,0,11.333,8Zm0,5A1.667,1.667,0,1,1,13,11.333,1.667,1.667,0,0,1,11.333,13Z"
|
|
25
|
+
transform="translate(-1.133 -1.333)"
|
|
26
|
+
fill={color}
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
id="Path_1376"
|
|
30
|
+
data-name="Path 1376"
|
|
31
|
+
d="M17.945,11.583l-.37-.213a7.583,7.583,0,0,0,0-2.742l.37-.213a2.5,2.5,0,1,0-2.5-4.333l-.371.214A7.481,7.481,0,0,0,12.7,2.927V2.5a2.5,2.5,0,1,0-5,0v.427A7.481,7.481,0,0,0,5.327,4.3l-.373-.216a2.5,2.5,0,1,0-2.5,4.333l.37.213a7.583,7.583,0,0,0,0,2.742l-.37.213a2.5,2.5,0,0,0,2.5,4.333l.371-.214A7.481,7.481,0,0,0,7.7,17.072V17.5a2.5,2.5,0,1,0,5,0v-.428A7.481,7.481,0,0,0,15.074,15.7l.373.215a2.5,2.5,0,1,0,2.5-4.333ZM15.822,8.437a5.873,5.873,0,0,1,0,3.125.833.833,0,0,0,.387.944l.9.522a.834.834,0,1,1-.833,1.444l-.9-.523a.833.833,0,0,0-1.012.138,5.82,5.82,0,0,1-2.7,1.563.833.833,0,0,0-.626.807V17.5a.833.833,0,0,1-1.667,0V16.457a.833.833,0,0,0-.626-.807,5.82,5.82,0,0,1-2.7-1.566.833.833,0,0,0-1.013-.138l-.9.523a.833.833,0,1,1-.833-1.443l.9-.522a.833.833,0,0,0,.387-.944,5.873,5.873,0,0,1,0-3.125.833.833,0,0,0-.388-.941l-.9-.522a.834.834,0,0,1,.833-1.444l.9.523a.833.833,0,0,0,1.012-.134,5.82,5.82,0,0,1,2.7-1.562.833.833,0,0,0,.626-.811V2.5a.833.833,0,1,1,1.667,0V3.543a.833.833,0,0,0,.626.808,5.82,5.82,0,0,1,2.7,1.566.833.833,0,0,0,1.012.137l.9-.522a.833.833,0,1,1,.833,1.443l-.9.522a.833.833,0,0,0-.386.941Z"
|
|
32
|
+
transform="translate(0 0)"
|
|
33
|
+
fill={color}
|
|
34
|
+
/>
|
|
35
|
+
</g>
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
};
|