@campxdev/react-blueprint 0.1.15 → 0.1.16
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 -19
- 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 +38 -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
|
@@ -4,52 +4,101 @@ import { Meta } from "@storybook/react";
|
|
|
4
4
|
// Make sure your TextField import is correct
|
|
5
5
|
|
|
6
6
|
import { SingleSelect, SingleSelectProps } from "./SingleSelect";
|
|
7
|
-
|
|
7
|
+
const topFilms = [
|
|
8
|
+
{ label: "The Shawshank Redemption", value: 1994 },
|
|
9
|
+
{ label: "The Godfather", value: 1972 },
|
|
10
|
+
{ label: "The Godfather: Part II", value: 1974 },
|
|
11
|
+
{ label: "The Dark Knight", value: 2008 },
|
|
12
|
+
{ label: "12 Angry Men", value: 1957 },
|
|
13
|
+
{ label: "Schindler's List", value: 1993 },
|
|
14
|
+
{ label: "Pulp Fiction", value: 1994 },
|
|
15
|
+
{
|
|
16
|
+
label: "The Lord of the Rings: The Return of the King",
|
|
17
|
+
value: 2003,
|
|
18
|
+
},
|
|
19
|
+
{ label: "The Good, the Bad and the Ugly", value: 1966 },
|
|
20
|
+
{ label: "Fight Club", value: 1999 },
|
|
21
|
+
{
|
|
22
|
+
label: "The Lord of the Rings: The Fellowship of the Ring",
|
|
23
|
+
value: 2001,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "Star Wars: Episode V - The Empire Strikes Back",
|
|
27
|
+
value: 1980,
|
|
28
|
+
},
|
|
29
|
+
{ label: "Forrest Gump", value: 1994 },
|
|
30
|
+
{ label: "Inception", value: 2010 },
|
|
31
|
+
{
|
|
32
|
+
label: "The Lord of the Rings: The Two Towers",
|
|
33
|
+
value: 2002,
|
|
34
|
+
},
|
|
35
|
+
{ label: "One Flew Over the Cuckoo's Nest", value: 1975 },
|
|
36
|
+
{ label: "Goodfellas", value: 1990 },
|
|
37
|
+
{ label: "The Matrix", value: 1999 },
|
|
38
|
+
{ label: "Seven Samurai", value: 1954 },
|
|
39
|
+
{
|
|
40
|
+
label: "Star Wars: Episode IV - A New Hope",
|
|
41
|
+
value: 1977,
|
|
42
|
+
},
|
|
43
|
+
{ label: "City of God", value: 2002 },
|
|
44
|
+
{ label: "Se7en", value: 1995 },
|
|
45
|
+
{ label: "The Silence of the Lambs", value: 1991 },
|
|
46
|
+
{ label: "It's a Wonderful Life", value: 1946 },
|
|
47
|
+
{ label: "Life Is Beautiful", value: 1997 },
|
|
48
|
+
{ label: "The Usual Suspects", value: 1995 },
|
|
49
|
+
{ label: "Léon: The Professional", value: 1994 },
|
|
50
|
+
{ label: "Spirited Away", value: 2001 },
|
|
51
|
+
{ label: "Saving Private Ryan", value: 1998 },
|
|
52
|
+
{ label: "Once Upon a Time in the West", value: 1968 },
|
|
53
|
+
{ label: "American History X", value: 1998 },
|
|
54
|
+
{ label: "Interstellar", value: 2014 },
|
|
55
|
+
];
|
|
8
56
|
// Define the default export with Meta type including the component type
|
|
9
57
|
export default {
|
|
10
58
|
title: "Input/SingleSelect",
|
|
11
59
|
component: SingleSelect,
|
|
12
|
-
|
|
13
|
-
|
|
60
|
+
argTypes: {
|
|
61
|
+
label: {
|
|
62
|
+
control: "text",
|
|
63
|
+
description: "Label of the field",
|
|
64
|
+
},
|
|
65
|
+
required: {
|
|
66
|
+
control: "boolean",
|
|
67
|
+
description: "Required property of the field",
|
|
68
|
+
},
|
|
69
|
+
optionsApiEndPoint: {
|
|
70
|
+
control: "text",
|
|
71
|
+
description: "API end point for options",
|
|
72
|
+
},
|
|
73
|
+
useCampxAxios: {
|
|
74
|
+
control: "boolean",
|
|
75
|
+
description: "Boolean to use campx axios",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
14
78
|
} as Meta<typeof SingleSelect>;
|
|
15
79
|
|
|
16
|
-
|
|
17
|
-
export const Primary = {
|
|
18
|
-
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
19
|
-
args: {},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Disabled = {
|
|
80
|
+
export const Default = {
|
|
23
81
|
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
24
|
-
args: {
|
|
82
|
+
args: {
|
|
83
|
+
required: true,
|
|
84
|
+
label: "Single Select",
|
|
85
|
+
options: topFilms,
|
|
86
|
+
},
|
|
25
87
|
};
|
|
26
|
-
|
|
27
|
-
export const WithValue = {
|
|
28
|
-
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
29
|
-
args: {},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const InputWithPlaceholder = {
|
|
33
|
-
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
34
|
-
args: {},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const ErrorInput = {
|
|
38
|
-
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
39
|
-
args: {},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const SuccessInput = {
|
|
43
|
-
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
44
|
-
args: {},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const WarningInput = {
|
|
88
|
+
export const Primary = {
|
|
48
89
|
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
49
|
-
args: {
|
|
90
|
+
args: {
|
|
91
|
+
options: topFilms,
|
|
92
|
+
label: "Single Select",
|
|
93
|
+
required: false,
|
|
94
|
+
},
|
|
50
95
|
};
|
|
51
96
|
|
|
52
|
-
export const
|
|
97
|
+
export const WithAPIEndPoint = {
|
|
53
98
|
render: (args: SingleSelectProps) => <SingleSelect {...args} />,
|
|
54
|
-
args: {
|
|
99
|
+
args: {
|
|
100
|
+
optionsApiEndPoint: "dropdowns/classrooms",
|
|
101
|
+
label: "Select Classroom",
|
|
102
|
+
required: false,
|
|
103
|
+
},
|
|
55
104
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Box,
|
|
3
|
-
CircularProgress,
|
|
4
3
|
Autocomplete as MuiAutocomplete,
|
|
5
4
|
Paper,
|
|
6
5
|
TextField,
|
|
@@ -9,6 +8,7 @@ import axios from "axios";
|
|
|
9
8
|
import { useReducer } from "react";
|
|
10
9
|
import { campxAxios } from "../../../utils/campxAxios";
|
|
11
10
|
import { Typography } from "../../Typography/Typography";
|
|
11
|
+
import { LabelWrapper } from "../LabelWrapper/LabelWrapper";
|
|
12
12
|
import { FetchingOptionsLoader } from "../components/FetchingOptionsLoader";
|
|
13
13
|
import { OptionContainer } from "../styles";
|
|
14
14
|
|
|
@@ -20,60 +20,12 @@ function sleep(duration: number): Promise<void> {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const topFilms = [
|
|
24
|
-
{ label: "The Shawshank Redemption", value: 1994 },
|
|
25
|
-
{ label: "The Godfather", value: 1972 },
|
|
26
|
-
{ label: "The Godfather: Part II", value: 1974 },
|
|
27
|
-
{ label: "The Dark Knight", value: 2008 },
|
|
28
|
-
{ label: "12 Angry Men", value: 1957 },
|
|
29
|
-
{ label: "Schindler's List", value: 1993 },
|
|
30
|
-
{ label: "Pulp Fiction", value: 1994 },
|
|
31
|
-
{
|
|
32
|
-
label: "The Lord of the Rings: The Return of the King",
|
|
33
|
-
value: 2003,
|
|
34
|
-
},
|
|
35
|
-
{ label: "The Good, the Bad and the Ugly", value: 1966 },
|
|
36
|
-
{ label: "Fight Club", value: 1999 },
|
|
37
|
-
{
|
|
38
|
-
label: "The Lord of the Rings: The Fellowship of the Ring",
|
|
39
|
-
value: 2001,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: "Star Wars: Episode V - The Empire Strikes Back",
|
|
43
|
-
value: 1980,
|
|
44
|
-
},
|
|
45
|
-
{ label: "Forrest Gump", value: 1994 },
|
|
46
|
-
{ label: "Inception", value: 2010 },
|
|
47
|
-
{
|
|
48
|
-
label: "The Lord of the Rings: The Two Towers",
|
|
49
|
-
value: 2002,
|
|
50
|
-
},
|
|
51
|
-
{ label: "One Flew Over the Cuckoo's Nest", value: 1975 },
|
|
52
|
-
{ label: "Goodfellas", value: 1990 },
|
|
53
|
-
{ label: "The Matrix", value: 1999 },
|
|
54
|
-
{ label: "Seven Samurai", value: 1954 },
|
|
55
|
-
{
|
|
56
|
-
label: "Star Wars: Episode IV - A New Hope",
|
|
57
|
-
value: 1977,
|
|
58
|
-
},
|
|
59
|
-
{ label: "City of God", value: 2002 },
|
|
60
|
-
{ label: "Se7en", value: 1995 },
|
|
61
|
-
{ label: "The Silence of the Lambs", value: 1991 },
|
|
62
|
-
{ label: "It's a Wonderful Life", value: 1946 },
|
|
63
|
-
{ label: "Life Is Beautiful", value: 1997 },
|
|
64
|
-
{ label: "The Usual Suspects", value: 1995 },
|
|
65
|
-
{ label: "Léon: The Professional", value: 1994 },
|
|
66
|
-
{ label: "Spirited Away", value: 2001 },
|
|
67
|
-
{ label: "Saving Private Ryan", value: 1998 },
|
|
68
|
-
{ label: "Once Upon a Time in the West", value: 1968 },
|
|
69
|
-
{ label: "American History X", value: 1998 },
|
|
70
|
-
{ label: "Interstellar", value: 2014 },
|
|
71
|
-
];
|
|
72
|
-
|
|
73
23
|
export interface SingleSelectProps {
|
|
74
24
|
options?: { label: string; subLabel?: string; value: any }[];
|
|
75
25
|
optionsApiEndPoint?: string;
|
|
76
26
|
useCampxAxios: boolean;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
label?: string;
|
|
77
29
|
}
|
|
78
30
|
|
|
79
31
|
enum SingleSelectActionsTypes {
|
|
@@ -107,6 +59,13 @@ const singleSelectReducer = (
|
|
|
107
59
|
case SingleSelectActionsTypes.SET_NETWORK_ERROR: {
|
|
108
60
|
return { ...state, ...stateChanges };
|
|
109
61
|
}
|
|
62
|
+
case SingleSelectActionsTypes.SET_INTERNAL_OPTIONS: {
|
|
63
|
+
return {
|
|
64
|
+
...state,
|
|
65
|
+
internalOptions: stateChanges.internalOptions,
|
|
66
|
+
loadingInternalOptions: false,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
110
69
|
default:
|
|
111
70
|
return { ...state, ...stateChanges };
|
|
112
71
|
}
|
|
@@ -116,11 +75,13 @@ export const SingleSelect = ({
|
|
|
116
75
|
options,
|
|
117
76
|
optionsApiEndPoint,
|
|
118
77
|
useCampxAxios = true,
|
|
78
|
+
required = false,
|
|
79
|
+
label,
|
|
119
80
|
}: SingleSelectProps) => {
|
|
120
81
|
const [state, dispatch] = useReducer(singleSelectReducer, {
|
|
121
82
|
open: false,
|
|
122
83
|
loadingInternalOptions: false,
|
|
123
|
-
internalOptions: options ??
|
|
84
|
+
internalOptions: options ?? [],
|
|
124
85
|
});
|
|
125
86
|
const { open, loadingInternalOptions, internalOptions } = state;
|
|
126
87
|
|
|
@@ -138,7 +99,7 @@ export const SingleSelect = ({
|
|
|
138
99
|
const options = await internalAxios
|
|
139
100
|
.get(optionsApiEndPoint, {
|
|
140
101
|
params: {
|
|
141
|
-
limit:
|
|
102
|
+
limit: 100,
|
|
142
103
|
offset: 0,
|
|
143
104
|
},
|
|
144
105
|
})
|
|
@@ -147,7 +108,6 @@ export const SingleSelect = ({
|
|
|
147
108
|
actionType: SingleSelectActionsTypes.SET_INTERNAL_OPTIONS,
|
|
148
109
|
stateChanges: {
|
|
149
110
|
internalOptions: options,
|
|
150
|
-
loadingInternalOptions: false,
|
|
151
111
|
},
|
|
152
112
|
});
|
|
153
113
|
} catch (e) {
|
|
@@ -168,21 +128,9 @@ export const SingleSelect = ({
|
|
|
168
128
|
<MuiAutocomplete
|
|
169
129
|
open={open}
|
|
170
130
|
renderInput={(params) => (
|
|
171
|
-
<
|
|
172
|
-
{...params}
|
|
173
|
-
|
|
174
|
-
InputProps={{
|
|
175
|
-
...params.InputProps,
|
|
176
|
-
endAdornment: (
|
|
177
|
-
<>
|
|
178
|
-
{loadingInternalOptions ? (
|
|
179
|
-
<CircularProgress color="inherit" size={20} />
|
|
180
|
-
) : null}
|
|
181
|
-
{params.InputProps.endAdornment}
|
|
182
|
-
</>
|
|
183
|
-
),
|
|
184
|
-
}}
|
|
185
|
-
/>
|
|
131
|
+
<LabelWrapper label={label} required={required}>
|
|
132
|
+
<TextField {...params} />
|
|
133
|
+
</LabelWrapper>
|
|
186
134
|
)}
|
|
187
135
|
PaperComponent={(props) => (
|
|
188
136
|
<Paper {...props}>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TextField as MuiTextField,
|
|
3
3
|
TextFieldProps as MuiTextFieldProps,
|
|
4
|
-
Stack,
|
|
5
4
|
StackProps,
|
|
6
5
|
} from "@mui/material";
|
|
7
|
-
import
|
|
6
|
+
import { LabelWrapper } from "../LabelWrapper/LabelWrapper";
|
|
8
7
|
|
|
9
8
|
export type TextFieldProps = {
|
|
10
9
|
containerProps?: StackProps;
|
|
@@ -20,9 +19,14 @@ export const TextField = ({
|
|
|
20
19
|
...rest
|
|
21
20
|
}: TextFieldProps) => {
|
|
22
21
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
22
|
+
<LabelWrapper
|
|
23
|
+
label={label}
|
|
24
|
+
required={required}
|
|
25
|
+
name={name}
|
|
26
|
+
containerProps={containerProps}
|
|
27
|
+
>
|
|
25
28
|
<MuiTextField
|
|
29
|
+
required={required}
|
|
26
30
|
id={name}
|
|
27
31
|
value={value}
|
|
28
32
|
label={label}
|
|
@@ -30,6 +34,6 @@ export const TextField = ({
|
|
|
30
34
|
onChange={onChange}
|
|
31
35
|
{...rest}
|
|
32
36
|
/>
|
|
33
|
-
</
|
|
37
|
+
</LabelWrapper>
|
|
34
38
|
);
|
|
35
39
|
};
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { motion } from "framer-motion";
|
|
2
2
|
import { Spinner } from "../../Layout/Spinner/Spinner";
|
|
3
|
+
import { Typography } from "../../Typography/Typography";
|
|
4
|
+
import { FetchingOptionsLoaderContainer } from "../styles";
|
|
3
5
|
|
|
4
6
|
export const FetchingOptionsLoader = ({ loading }: { loading: boolean }) => {
|
|
5
7
|
return (
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
<motion.div
|
|
9
|
+
initial={{ display: loading ? "visible" : "none" }}
|
|
10
|
+
animate={{
|
|
11
|
+
display: loading ? "visible" : "none",
|
|
12
|
+
opacity: loading ? 1 : 0,
|
|
13
|
+
}}
|
|
14
|
+
transition={{ delay: loading ? 1 : 0 }}
|
|
15
|
+
>
|
|
16
|
+
<FetchingOptionsLoaderContainer direction="row" alignItems="center">
|
|
17
|
+
<Spinner />
|
|
18
|
+
<Typography variant="caption">Fetching Options</Typography>
|
|
19
|
+
</FetchingOptionsLoaderContainer>
|
|
20
|
+
</motion.div>
|
|
9
21
|
);
|
|
10
22
|
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { Box, styled } from "@mui/material";
|
|
1
|
+
import { Box, Stack, styled } from "@mui/material";
|
|
2
2
|
|
|
3
3
|
export const OptionContainer = styled(Box)(({ theme }) => ({
|
|
4
4
|
display: "flex",
|
|
5
5
|
flexDirection: "column",
|
|
6
|
+
borderBottom: `1px solid ${theme.palette.secondary.main}`,
|
|
7
|
+
width: "100%",
|
|
8
|
+
padding: "5px 0px",
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
export const FetchingOptionsLoaderContainer = styled(Stack)(({ theme }) => ({
|
|
12
|
+
backgroundColor: theme.palette.background.default,
|
|
13
|
+
maxHeight: "32px",
|
|
6
14
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconButton } from "@mui/material";
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DropdownMenuItem } from "../../DropDownMenu/DropdownMenuItem";
|
|
4
|
+
import { Icons } from "../../export";
|
|
5
5
|
import { AppHeader, AppHeaderProps } from "./AppHeader";
|
|
6
6
|
import { AppsMenu } from "./AppsMenu";
|
|
7
7
|
|
|
@@ -124,10 +124,10 @@ export const WithActions: Story = {
|
|
|
124
124
|
),
|
|
125
125
|
actions: [
|
|
126
126
|
<IconButton>
|
|
127
|
-
<CareerIcon />
|
|
127
|
+
<Icons.CareerIcon />
|
|
128
128
|
</IconButton>,
|
|
129
129
|
<IconButton>
|
|
130
|
-
<ExamResultIcon />
|
|
130
|
+
<Icons.ExamResultIcon />
|
|
131
131
|
</IconButton>,
|
|
132
132
|
],
|
|
133
133
|
userBoxActions: [
|
|
@@ -192,7 +192,7 @@ export const WithClogWheel: Story = {
|
|
|
192
192
|
{ label: "Action 2", onClick: () => alert("Action 2 clicked") },
|
|
193
193
|
],
|
|
194
194
|
cogWheelMenu: [
|
|
195
|
-
<
|
|
195
|
+
<DropdownMenuItem
|
|
196
196
|
label={"Student Payments"}
|
|
197
197
|
onClick={() => {
|
|
198
198
|
window.open("/payment", "_blank");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import AppsOutageIcon from "@mui/icons-material/AppsOutage";
|
|
2
2
|
import { Box, IconButton, Link, Menu, Typography, styled } from "@mui/material";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { AppsIcon } from "../../../assets/images/icons";
|
|
5
4
|
import { applications } from "../../../utils/applications";
|
|
6
5
|
import { institutionKey, urlTenantKey } from "../../../utils/constants";
|
|
6
|
+
import { Icons } from "../../export";
|
|
7
7
|
|
|
8
8
|
export const AppsMenu = ({ apps }: { apps: string[] }) => {
|
|
9
9
|
const [anchorEl, setAnchorEl] = useState<any>(null);
|
|
@@ -23,7 +23,7 @@ export const AppsMenu = ({ apps }: { apps: string[] }) => {
|
|
|
23
23
|
return (
|
|
24
24
|
<>
|
|
25
25
|
<StyledIconButton onClick={handleClick}>
|
|
26
|
-
<AppsIcon />
|
|
26
|
+
<Icons.AppsIcon />
|
|
27
27
|
</StyledIconButton>
|
|
28
28
|
<Menu
|
|
29
29
|
transitionDuration={150}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Divider, IconButton } from "@mui/material";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DropdownMenu } from "../../../DropDownMenu/DropDownMenu";
|
|
4
|
+
import { Icons } from "../../../export";
|
|
5
5
|
// import { clogWheel } from "../../../../assets/images";
|
|
6
6
|
// import DropDownButton from "../../../DropDownButton/DropDownButton";
|
|
7
7
|
|
|
@@ -17,10 +17,10 @@ const CogWheelMenu = ({ menu }: { menu: ReactNode[] }) => {
|
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
<
|
|
20
|
+
<DropdownMenu
|
|
21
21
|
anchor={({ open }) => (
|
|
22
22
|
<IconButton color="secondary" onClick={open}>
|
|
23
|
-
<ClogWheelIcon />
|
|
23
|
+
<Icons.ClogWheelIcon />
|
|
24
24
|
</IconButton>
|
|
25
25
|
)}
|
|
26
26
|
menu={menu}
|
|
@@ -2,7 +2,7 @@ import { Divider, IconButton, Stack } from "@mui/material";
|
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
// import { IMenuItemProps } from '../../../DropDownButton/DropdownMenuItem'
|
|
4
4
|
// import InstitutionsDropDown from '../../../Institutions/InstitutionsDropdown'
|
|
5
|
-
import {
|
|
5
|
+
import { Icons } from "../../../export";
|
|
6
6
|
import CogWheelMenu from "./CogWheelMenu";
|
|
7
7
|
import UserBox from "./UserBox";
|
|
8
8
|
|
|
@@ -35,7 +35,7 @@ const HeaderActions = ({
|
|
|
35
35
|
href={"https://campx.atlassian.net/servicedesk/customer/portal/2"}
|
|
36
36
|
target="_blank"
|
|
37
37
|
>
|
|
38
|
-
<HelpIcon />
|
|
38
|
+
<Icons.HelpIcon />
|
|
39
39
|
</IconButton>
|
|
40
40
|
|
|
41
41
|
{actions.map((action, index) => (
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Stack, Typography } from "@mui/material";
|
|
1
|
+
import { Stack, Typography, useTheme } from "@mui/material";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DropdownMenu } from "../../../DropDownMenu/DropDownMenu";
|
|
4
|
+
import { DropdownMenuItem } from "../../../DropDownMenu/DropdownMenuItem";
|
|
5
|
+
import { Icons } from "../../../export";
|
|
5
6
|
import { StyledAvatar, StyledTypography } from "../styles/styles";
|
|
6
7
|
// import {
|
|
7
8
|
// activeDevices,
|
|
@@ -44,15 +45,23 @@ export default function UserBox({
|
|
|
44
45
|
profileUrl?: string;
|
|
45
46
|
profileSx?: any;
|
|
46
47
|
}) {
|
|
48
|
+
const theme = useTheme();
|
|
49
|
+
|
|
47
50
|
return (
|
|
48
|
-
<
|
|
51
|
+
<DropdownMenu
|
|
49
52
|
anchor={({ open }) => (
|
|
50
53
|
<StyledAvatar src={profileUrl ?? ""} onClick={open} sx={profileSx}>
|
|
51
54
|
{getStartingLetters(fullName)}
|
|
52
55
|
</StyledAvatar>
|
|
53
56
|
)}
|
|
57
|
+
menuListProps={{
|
|
58
|
+
sx: {
|
|
59
|
+
width: "300px",
|
|
60
|
+
borderRadius: "5px",
|
|
61
|
+
},
|
|
62
|
+
}}
|
|
54
63
|
menu={[
|
|
55
|
-
<
|
|
64
|
+
<DropdownMenuItem
|
|
56
65
|
label={
|
|
57
66
|
<Stack gap={0.5}>
|
|
58
67
|
<StyledTypography variant="subtitle3">Account</StyledTypography>
|
|
@@ -67,24 +76,30 @@ export default function UserBox({
|
|
|
67
76
|
</Stack>
|
|
68
77
|
</Stack>
|
|
69
78
|
}
|
|
70
|
-
onClick={
|
|
71
|
-
throw new Error("Function not implemented.");
|
|
72
|
-
}}
|
|
79
|
+
onClick={() => alert("Action 1 clicked")}
|
|
73
80
|
/>,
|
|
74
|
-
<
|
|
81
|
+
<DropdownMenuItem
|
|
75
82
|
label={
|
|
76
83
|
<Stack gap={0.5}>
|
|
77
|
-
<Typography variant="subtitle3">
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
<Typography variant="subtitle3">Active Devices</Typography>
|
|
85
|
+
</Stack>
|
|
86
|
+
}
|
|
87
|
+
onClick={() => alert("Action 1 clicked")}
|
|
88
|
+
/>,
|
|
89
|
+
<DropdownMenuItem
|
|
90
|
+
label={
|
|
91
|
+
<Stack
|
|
92
|
+
gap={0.5}
|
|
93
|
+
direction={"row"}
|
|
94
|
+
justifyContent={"space-between"}
|
|
95
|
+
width={"100%"}
|
|
96
|
+
>
|
|
97
|
+
<Typography variant="subtitle3">Logout</Typography>
|
|
98
|
+
|
|
99
|
+
<Icons.LogoutIcon hoverColor={theme.palette.highlight.main} />
|
|
83
100
|
</Stack>
|
|
84
101
|
}
|
|
85
|
-
onClick={
|
|
86
|
-
throw new Error("Function not implemented.");
|
|
87
|
-
}}
|
|
102
|
+
onClick={() => alert("Action 1 clicked")}
|
|
88
103
|
/>,
|
|
89
104
|
]}
|
|
90
105
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button, Stack } from "@mui/material";
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { DashBoardIcon } from "../../../assets/images/icons";
|
|
4
3
|
import DialogButton from "../../Modals/DialogButton";
|
|
4
|
+
import { Icons } from "../../export";
|
|
5
5
|
import { PageContent } from "../PageContent/PageContent";
|
|
6
6
|
import { SideNavigation } from "../SideNavigation/SideNavigation";
|
|
7
7
|
import { LayoutWrapper, LayoutWrapperProps } from "./LayoutWrapper";
|
|
@@ -19,12 +19,37 @@ const meta: Meta<typeof LayoutWrapperStory> = {
|
|
|
19
19
|
title: "Layout/LayoutWrapper",
|
|
20
20
|
component: LayoutWrapperStory,
|
|
21
21
|
tags: ["autodocs"],
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
argTypes: {
|
|
23
|
+
title: {
|
|
24
|
+
control: "text",
|
|
25
|
+
description: "The title of the component",
|
|
26
|
+
type: { name: "string", required: false },
|
|
27
|
+
},
|
|
28
|
+
actionButtons: {
|
|
29
|
+
control: "object",
|
|
30
|
+
description: "Array of React nodes for action buttons",
|
|
31
|
+
// type: { name: "ReactNode[]", required: false },
|
|
32
|
+
},
|
|
33
|
+
children: {
|
|
34
|
+
control: "object",
|
|
35
|
+
description: "The content of the component",
|
|
36
|
+
},
|
|
37
|
+
sideBar: {
|
|
38
|
+
control: false,
|
|
39
|
+
description:
|
|
40
|
+
"A function that returns a ReactNode, with props for open and handleClick",
|
|
41
|
+
type: {
|
|
42
|
+
name: "function",
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
// menu: {
|
|
48
|
+
// control: "object",
|
|
49
|
+
// description:
|
|
50
|
+
// "Menu configuration object, which may include items or other menu-related settings.",
|
|
51
|
+
// },
|
|
52
|
+
},
|
|
28
53
|
};
|
|
29
54
|
|
|
30
55
|
export default meta;
|
|
@@ -39,7 +64,7 @@ export const Primary: Story = {
|
|
|
39
64
|
open={open}
|
|
40
65
|
handleDrawer={handleClick}
|
|
41
66
|
menu={[
|
|
42
|
-
{ name: "Tickets", path: "/home", icon: DashBoardIcon },
|
|
67
|
+
{ name: "Tickets", path: "/home", icon: Icons.DashBoardIcon },
|
|
43
68
|
{ name: "Item 2", path: "/item2" },
|
|
44
69
|
]}
|
|
45
70
|
/>
|
|
@@ -2,8 +2,8 @@ import { Box, IconButton, Stack, Typography } from "@mui/material";
|
|
|
2
2
|
|
|
3
3
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
4
4
|
import { ReactNode, useState } from "react";
|
|
5
|
-
import { LeftIcon, RightIcon } from "../../../assets/images/icons";
|
|
6
5
|
import { activeStore } from "../../../store/activeStore";
|
|
6
|
+
import { Icons } from "../../export";
|
|
7
7
|
import { Main, StyledLayoutContainer, StyledMainContainer } from "./styles";
|
|
8
8
|
|
|
9
9
|
export interface LayoutWrapperProps {
|
|
@@ -50,9 +50,9 @@ export const LayoutWrapper = ({
|
|
|
50
50
|
onMouseLeave={() => setIsHovered(false)}
|
|
51
51
|
>
|
|
52
52
|
{open && isHovered ? (
|
|
53
|
-
<LeftIcon />
|
|
53
|
+
<Icons.LeftIcon />
|
|
54
54
|
) : !open && isHovered ? (
|
|
55
|
-
<RightIcon />
|
|
55
|
+
<Icons.RightIcon />
|
|
56
56
|
) : (
|
|
57
57
|
<MenuIcon />
|
|
58
58
|
)}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { PageContent } from "../../export";
|
|
3
|
+
|
|
4
|
+
// Define the default export with Meta type including the component type
|
|
5
|
+
const meta: Meta<typeof PageContent> = {
|
|
6
|
+
title: "Layout/PageContent",
|
|
7
|
+
component: PageContent,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: {
|
|
11
|
+
control: "object",
|
|
12
|
+
description: "The content of the component",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof PageContent>;
|
|
19
|
+
|
|
20
|
+
// Primary story
|
|
21
|
+
export const Primary: Story = {
|
|
22
|
+
render: (args: any) => <PageContent {...args} />,
|
|
23
|
+
args: {
|
|
24
|
+
children: <>Tickets</>,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -21,6 +21,12 @@ export const StyledContainer = styled(Box)(({ theme }) => ({
|
|
|
21
21
|
marginTop: "10px",
|
|
22
22
|
}));
|
|
23
23
|
|
|
24
|
-
export const PageContent = ({
|
|
25
|
-
|
|
24
|
+
export const PageContent = ({
|
|
25
|
+
children,
|
|
26
|
+
sx,
|
|
27
|
+
}: {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
sx?: any;
|
|
30
|
+
}) => {
|
|
31
|
+
return <StyledContainer sx={sx}> {children}</StyledContainer>;
|
|
26
32
|
};
|