@campxdev/react-blueprint 0.1.0

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.
Files changed (122) hide show
  1. package/.storybook/main.ts +29 -0
  2. package/.storybook/preview.tsx +28 -0
  3. package/.vscode/settings.json +3 -0
  4. package/README.md +100 -0
  5. package/bitbucket-pipelines.yml +60 -0
  6. package/exports.ts +1 -0
  7. package/package.json +74 -0
  8. package/public/favicon.ico +0 -0
  9. package/public/index.html +43 -0
  10. package/public/logo192.png +0 -0
  11. package/public/logo512.png +0 -0
  12. package/public/manifest.json +25 -0
  13. package/public/robots.txt +3 -0
  14. package/src/App.css +38 -0
  15. package/src/App.test.tsx +9 -0
  16. package/src/App.tsx +12 -0
  17. package/src/assets/fonts/heebo/Heebo-Medium.ttf +0 -0
  18. package/src/assets/fonts/heebo/Heebo-SemiBold.ttf +0 -0
  19. package/src/assets/fonts/heebo/index.ts +3 -0
  20. package/src/assets/fonts/poppins/Poppins-Bold.ttf +0 -0
  21. package/src/assets/fonts/poppins/Poppins-Light.ttf +0 -0
  22. package/src/assets/fonts/poppins/Poppins-Medium.ttf +0 -0
  23. package/src/assets/fonts/poppins/Poppins-Regular.ttf +0 -0
  24. package/src/assets/fonts/poppins/Poppins-SemiBold.ttf +0 -0
  25. package/src/assets/fonts/poppins/index.ts +14 -0
  26. package/src/assets/images/admin.png +0 -0
  27. package/src/assets/images/campx_logo__full_primary.png +0 -0
  28. package/src/assets/images/collegex.png +0 -0
  29. package/src/assets/images/commutex.png +0 -0
  30. package/src/assets/images/enrollx.png +0 -0
  31. package/src/assets/images/examx.png +0 -0
  32. package/src/assets/images/hostelx copy.png +0 -0
  33. package/src/assets/images/hostelx.png +0 -0
  34. package/src/assets/images/icons.tsx +193 -0
  35. package/src/assets/images/index.ts +25 -0
  36. package/src/assets/images/payx.png +0 -0
  37. package/src/assets/images/pepolex.png +0 -0
  38. package/src/assets/images/svg/commutex_small.svg +11 -0
  39. package/src/assets/images/svg/enroll_logo.svg +9 -0
  40. package/src/assets/images/svg/exams_small.svg +12 -0
  41. package/src/assets/images/svg/help-icon.svg +8 -0
  42. package/src/assets/images/svg/hostel_small.svg +13 -0
  43. package/src/assets/images/svg/index.ts +19 -0
  44. package/src/assets/images/svg/payx_small.svg +16 -0
  45. package/src/assets/images/svg/people_small.svg +9 -0
  46. package/src/assets/images/svg/squareSmall.svg +9 -0
  47. package/src/assets/images/svg/square_small.svg +9 -0
  48. package/src/components/DropDownMenu/DropDownButton.tsx +30 -0
  49. package/src/components/DropDownMenu/DropDownIcon.tsx +31 -0
  50. package/src/components/DropDownMenu/DropDownMenu.stories.tsx +139 -0
  51. package/src/components/DropDownMenu/DropDownMenu.tsx +65 -0
  52. package/src/components/DropDownMenu/MenuItemButton.tsx +29 -0
  53. package/src/components/DropDownMenu/styles.tsx +31 -0
  54. package/src/components/Input/Button/Button.stories.tsx +62 -0
  55. package/src/components/Input/Button/Button.tsx +11 -0
  56. package/src/components/Input/Label/Label.tsx +11 -0
  57. package/src/components/Input/SingleSelect/SingleSelect.stories.tsx +55 -0
  58. package/src/components/Input/SingleSelect/SingleSelect.tsx +4 -0
  59. package/src/components/Input/Switch/Switch.stories.tsx +62 -0
  60. package/src/components/Input/Switch/Switch.tsx +11 -0
  61. package/src/components/Input/TextField/TextField.stories.tsx +135 -0
  62. package/src/components/Input/TextField/TextField.tsx +35 -0
  63. package/src/components/Layout/ComponentBackground/ComponentBackground.tsx +82 -0
  64. package/src/components/Layout/ComponentBackground/DefaultBackground.tsx +12 -0
  65. package/src/components/Layout/ComponentBackground/PaperBackground.tsx +12 -0
  66. package/src/components/Layout/Header/AppHeader.stories.tsx +209 -0
  67. package/src/components/Layout/Header/AppHeader.tsx +70 -0
  68. package/src/components/Layout/Header/AppLogo.tsx +53 -0
  69. package/src/components/Layout/Header/AppsMenu.tsx +162 -0
  70. package/src/components/Layout/Header/HeaderActions/CogWheelMenu.tsx +30 -0
  71. package/src/components/Layout/Header/HeaderActions/HeaderActions.tsx +63 -0
  72. package/src/components/Layout/Header/HeaderActions/UserBox.tsx +117 -0
  73. package/src/components/Layout/Header/styles/styles.tsx +69 -0
  74. package/src/components/Typography/Typography.stories.tsx +95 -0
  75. package/src/components/Typography/Typography.tsx +12 -0
  76. package/src/components/index.ts +1 -0
  77. package/src/contexts/Providers.tsx +6 -0
  78. package/src/index.css +13 -0
  79. package/src/index.tsx +19 -0
  80. package/src/logo.svg +1 -0
  81. package/src/react-app-env.d.ts +1 -0
  82. package/src/reportWebVitals.ts +15 -0
  83. package/src/setupTests.ts +5 -0
  84. package/src/stories/Button.stories.ts +52 -0
  85. package/src/stories/Button.tsx +48 -0
  86. package/src/stories/Configure.mdx +364 -0
  87. package/src/stories/Header.stories.ts +33 -0
  88. package/src/stories/Header.tsx +56 -0
  89. package/src/stories/Page.stories.ts +32 -0
  90. package/src/stories/Page.tsx +73 -0
  91. package/src/stories/assets/accessibility.png +0 -0
  92. package/src/stories/assets/accessibility.svg +5 -0
  93. package/src/stories/assets/addon-library.png +0 -0
  94. package/src/stories/assets/assets.png +0 -0
  95. package/src/stories/assets/avif-test-image.avif +0 -0
  96. package/src/stories/assets/context.png +0 -0
  97. package/src/stories/assets/discord.svg +15 -0
  98. package/src/stories/assets/docs.png +0 -0
  99. package/src/stories/assets/figma-plugin.png +0 -0
  100. package/src/stories/assets/github.svg +3 -0
  101. package/src/stories/assets/share.png +0 -0
  102. package/src/stories/assets/styling.png +0 -0
  103. package/src/stories/assets/testing.png +0 -0
  104. package/src/stories/assets/theming.png +0 -0
  105. package/src/stories/assets/tutorials.svg +12 -0
  106. package/src/stories/assets/youtube.svg +4 -0
  107. package/src/stories/button.css +30 -0
  108. package/src/stories/header.css +32 -0
  109. package/src/stories/page.css +69 -0
  110. package/src/themes/MuiThemeProvider.tsx +18 -0
  111. package/src/themes/colorTokens.stories.tsx +71 -0
  112. package/src/themes/colorTokens.ts +77 -0
  113. package/src/themes/commonTheme.ts +443 -0
  114. package/src/themes/customCssBaseline.ts +39 -0
  115. package/src/themes/darkTheme.ts +24 -0
  116. package/src/themes/index.ts +4 -0
  117. package/src/themes/lightTheme.ts +22 -0
  118. package/src/themes/typography.stories.tsx +79 -0
  119. package/src/utils/applications.ts +140 -0
  120. package/src/utils/constants.ts +6 -0
  121. package/src/utils/imageMap.ts +22 -0
  122. package/tsconfig.json +26 -0
@@ -0,0 +1,209 @@
1
+ import { IconButton } from "@mui/material";
2
+ import { Meta, StoryObj } from "@storybook/react";
3
+ import { CareerIcon, ExamResultIcon } from "../../../assets/images/icons";
4
+ import MenuItemButton from "../../DropDownMenu/MenuItemButton";
5
+ import AppHeader, { AppHeaderProps } from "./AppHeader";
6
+ import AppsMenu from "./AppsMenu";
7
+
8
+ // Define the default export with Meta type including the component type
9
+ const meta: Meta<typeof AppHeader> = {
10
+ title: "Layout/AppHeader",
11
+ component: AppHeader,
12
+ tags: ["autodocs"],
13
+ argTypes: {
14
+ clientLogo: {
15
+ control: "text",
16
+ description: "The logo of the client.",
17
+ },
18
+ fullName: {
19
+ control: "text",
20
+ description: "The full name of the user.",
21
+ },
22
+ profileUrl: {
23
+ control: "text",
24
+ description: "The URL of the user's profile photo.",
25
+ },
26
+ userBoxActions: {
27
+ control: "object",
28
+ description: "Actions for the user box.",
29
+ },
30
+ actions: {
31
+ control: "object",
32
+ description: "Custom actions to be displayed.",
33
+ },
34
+
35
+ containerSx: {
36
+ control: "object",
37
+ description: "Styles applied to the container.",
38
+ },
39
+ imageSx: {
40
+ control: "object",
41
+ description: "Styles applied to the client logo image.",
42
+ },
43
+ profileSx: {
44
+ control: "object",
45
+ description: "Styles applied to the profile section.",
46
+ },
47
+ headerSx: {
48
+ control: "object",
49
+ description: "Styles applied to the profile section.",
50
+ },
51
+ },
52
+ };
53
+
54
+ export default meta;
55
+ type Story = StoryObj<typeof AppHeader>;
56
+
57
+ // Primary story
58
+ export const Primary: Story = {
59
+ render: (args: AppHeaderProps) => <AppHeader {...args} />,
60
+ args: {
61
+ clientLogo: "https://via.placeholder.com/150",
62
+ fullName: "John Doe",
63
+ appsMenu: (
64
+ <AppsMenu
65
+ apps={[
66
+ "exams",
67
+ "square",
68
+ "admin",
69
+ "enroll",
70
+ "payments",
71
+ "hrms",
72
+ "hostels",
73
+ "commute_x",
74
+ ]}
75
+ />
76
+ ),
77
+ userBoxActions: [
78
+ { label: "Action 1", onClick: () => alert("Action 1 clicked") },
79
+ { label: "Action 2", onClick: () => alert("Action 2 clicked") },
80
+ ],
81
+ headerSx: {
82
+ position: "relative",
83
+ },
84
+ },
85
+ };
86
+
87
+ // Story with no apps menu
88
+ export const WithNoAppsMenu: Story = {
89
+ render: (args: AppHeaderProps) => <AppHeader {...args} />,
90
+ args: {
91
+ clientLogo: "https://via.placeholder.com/150",
92
+ fullName: "John Doe",
93
+ appsMenu: <AppsMenu apps={[]} />,
94
+ userBoxActions: [
95
+ { label: "Action 1", onClick: () => alert("Action 1 clicked") },
96
+ { label: "Action 2", onClick: () => alert("Action 2 clicked") },
97
+ ],
98
+ headerSx: {
99
+ position: "relative",
100
+ },
101
+ },
102
+ };
103
+
104
+ // Story with actions
105
+ export const WithActions: Story = {
106
+ render: (args: AppHeaderProps) => <AppHeader {...args} />,
107
+ args: {
108
+ clientLogo: "https://via.placeholder.com/150",
109
+ fullName: "John Doe",
110
+ appsMenu: (
111
+ <AppsMenu
112
+ apps={[
113
+ "exams",
114
+ "square",
115
+ "admin",
116
+ "enroll",
117
+ "payments",
118
+ "hrms",
119
+ "hostels",
120
+ "commute_x",
121
+ ]}
122
+ />
123
+ ),
124
+ actions: [
125
+ <IconButton>
126
+ <CareerIcon />
127
+ </IconButton>,
128
+ <IconButton>
129
+ <ExamResultIcon />
130
+ </IconButton>,
131
+ ],
132
+ userBoxActions: [
133
+ { label: "Action 1", onClick: () => alert("Action 1 clicked") },
134
+ { label: "Action 2", onClick: () => alert("Action 2 clicked") },
135
+ ],
136
+ headerSx: {
137
+ position: "relative",
138
+ },
139
+ },
140
+ };
141
+
142
+ // Story with custom header actions
143
+ export const WithCustomHeaderActions: Story = {
144
+ render: (args: AppHeaderProps) => <AppHeader {...args} />,
145
+ args: {
146
+ clientLogo: "https://via.placeholder.com/150",
147
+ fullName: "John Doe",
148
+ appsMenu: (
149
+ <AppsMenu
150
+ apps={[
151
+ "exams",
152
+ "square",
153
+ "admin",
154
+ "enroll",
155
+ "payments",
156
+ "hrms",
157
+ "hostels",
158
+ "commute_x",
159
+ ]}
160
+ />
161
+ ),
162
+ customHeaderActions: <div>Custom Header Actions</div>,
163
+ userBoxActions: [
164
+ { label: "Action 1", onClick: () => alert("Action 1 clicked") },
165
+ { label: "Action 2", onClick: () => alert("Action 2 clicked") },
166
+ ],
167
+ headerSx: {
168
+ position: "relative",
169
+ },
170
+ },
171
+ };
172
+
173
+ // Story with clog wheel actions
174
+ export const WithClogWheel: Story = {
175
+ render: (args: AppHeaderProps) => <AppHeader {...args} />,
176
+ args: {
177
+ clientLogo: "https://via.placeholder.com/150",
178
+ fullName: "John Doe",
179
+ appsMenu: (
180
+ <AppsMenu
181
+ apps={[
182
+ "exams",
183
+ "square",
184
+ "admin",
185
+ "enroll",
186
+ "payments",
187
+ "hrms",
188
+ "hostels",
189
+ "commute_x",
190
+ ]}
191
+ />
192
+ ),
193
+ userBoxActions: [
194
+ { label: "Action 1", onClick: () => alert("Action 1 clicked") },
195
+ { label: "Action 2", onClick: () => alert("Action 2 clicked") },
196
+ ],
197
+ cogWheelMenu: [
198
+ <MenuItemButton
199
+ label={"Student Payments"}
200
+ onClick={() => {
201
+ window.open("/payment", "_blank");
202
+ }}
203
+ />,
204
+ ],
205
+ // headerSx: {
206
+ // position: "relative",
207
+ // },
208
+ },
209
+ };
@@ -0,0 +1,70 @@
1
+ import { Stack } from "@mui/material";
2
+ import { ReactNode } from "react";
3
+ import AppLogo from "./AppLogo";
4
+ import HeaderActions from "./HeaderActions/HeaderActions";
5
+ import {
6
+ StyledActionBox,
7
+ StyledContainer,
8
+ StyledHeader,
9
+ } from "./styles/styles";
10
+
11
+ export interface AppHeaderProps {
12
+ actions?: ReactNode[];
13
+ appsMenu: ReactNode;
14
+ clientLogo: string;
15
+ cogWheelMenu?: ReactNode[];
16
+ customHeaderActions?: ReactNode;
17
+ fullName: string;
18
+ profileUrl?: string;
19
+ userBoxActions: {
20
+ label: ReactNode;
21
+ icon?: ReactNode;
22
+ onClick: any;
23
+ }[];
24
+ containerSx?: any;
25
+ imageSx?: any;
26
+ headerSx?: any;
27
+ profileSx?: any;
28
+ }
29
+
30
+ const AppHeader = ({
31
+ actions = [],
32
+ appsMenu,
33
+ clientLogo,
34
+ cogWheelMenu = [],
35
+ customHeaderActions,
36
+ fullName,
37
+ profileUrl,
38
+ userBoxActions = [],
39
+ containerSx = {},
40
+ headerSx = {},
41
+ profileSx = {},
42
+ imageSx = {},
43
+ }: AppHeaderProps) => {
44
+ return (
45
+ <StyledHeader sx={headerSx}>
46
+ <StyledContainer sx={containerSx}>
47
+ <Stack alignItems={"center"} gap={"10px"} flexDirection={"row"}>
48
+ {appsMenu}
49
+ <AppLogo clientLogo={clientLogo} imageSx={imageSx} />
50
+ </Stack>
51
+ <StyledActionBox>
52
+ {customHeaderActions ? (
53
+ customHeaderActions
54
+ ) : (
55
+ <HeaderActions
56
+ cogWheelMenu={cogWheelMenu}
57
+ fullName={fullName}
58
+ userBoxActions={userBoxActions}
59
+ profileUrl={profileUrl}
60
+ actions={actions}
61
+ profileSx={profileSx}
62
+ />
63
+ )}
64
+ </StyledActionBox>
65
+ </StyledContainer>
66
+ </StyledHeader>
67
+ );
68
+ };
69
+
70
+ export default AppHeader;
@@ -0,0 +1,53 @@
1
+ import { Divider, Typography } from "@mui/material";
2
+ import { applications } from "../../../utils/applications";
3
+ import { isDevelopment } from "../../../utils/constants";
4
+ import { imageMap } from "../../../utils/imageMap";
5
+ import {
6
+ StyledImageWrapper,
7
+ StyledLogosWrapper,
8
+ StyledRouterLink,
9
+ } from "./styles/styles";
10
+
11
+ export interface AppLogoProps {
12
+ clientLogo: string;
13
+ imageSx?: any;
14
+ }
15
+
16
+ const AppLogo = ({ clientLogo, imageSx }: AppLogoProps) => {
17
+ const originSubdomain =
18
+ window.location.host.split(".")?.slice(-3)[0] ?? "ums";
19
+ const currentApp: string =
20
+ applications.find((item) => item.domainName === originSubdomain)
21
+ ?.domainName ?? "admin";
22
+
23
+ return (
24
+ <StyledRouterLink to={"/"}>
25
+ <StyledLogosWrapper>
26
+ <StyledImageWrapper sx={imageSx}>
27
+ <img src={imageMap[currentApp]} alt="logo" />
28
+ </StyledImageWrapper>
29
+ <Divider
30
+ orientation="vertical"
31
+ variant="middle"
32
+ flexItem
33
+ sx={{ height: "20px" }}
34
+ />
35
+ <StyledImageWrapper sx={{ height: "auto" }}>
36
+ {isDevelopment ? (
37
+ <Typography variant="subtitle1">Developer</Typography>
38
+ ) : (
39
+ <img
40
+ src={clientLogo}
41
+ onError={(e: any) => {
42
+ e.target.src = imageMap.campx;
43
+ }}
44
+ alt="campx"
45
+ />
46
+ )}
47
+ </StyledImageWrapper>
48
+ </StyledLogosWrapper>
49
+ </StyledRouterLink>
50
+ );
51
+ };
52
+
53
+ export default AppLogo;
@@ -0,0 +1,162 @@
1
+ import AppsOutageIcon from "@mui/icons-material/AppsOutage";
2
+ import { Box, IconButton, Link, Menu, Typography, styled } from "@mui/material";
3
+ import { useState } from "react";
4
+ import { AppsIcon } from "../../../assets/images/icons";
5
+ import { applications } from "../../../utils/applications";
6
+ import { institutionKey, urlTenantKey } from "../../../utils/constants";
7
+
8
+ export const AppsMenu = ({ apps }: { apps: string[] }) => {
9
+ const [anchorEl, setAnchorEl] = useState<any>(null);
10
+ const open = Boolean(anchorEl);
11
+ const applicationList = applications?.filter((item) =>
12
+ apps.includes(item.key)
13
+ );
14
+
15
+ const handleClick = (event: any) => {
16
+ setAnchorEl(event.currentTarget);
17
+ };
18
+
19
+ const handleClose = () => {
20
+ setAnchorEl(null);
21
+ };
22
+
23
+ return (
24
+ <>
25
+ <StyledIconButton onClick={handleClick}>
26
+ <AppsIcon />
27
+ </StyledIconButton>
28
+
29
+ <Menu
30
+ transitionDuration={150}
31
+ elevation={2}
32
+ id="basic-menu"
33
+ anchorEl={anchorEl}
34
+ open={open}
35
+ onClose={handleClose}
36
+ anchorOrigin={{
37
+ vertical: "bottom",
38
+ horizontal: "left",
39
+ }}
40
+ transformOrigin={{
41
+ vertical: "top",
42
+ horizontal: "left",
43
+ }}
44
+ TransitionProps={{
45
+ unmountOnExit: false,
46
+ }}
47
+ sx={{
48
+ "& .MuiPaper-root": {
49
+ "&>:last-child": {
50
+ paddingBottom: "0px",
51
+ },
52
+ },
53
+ }}
54
+ >
55
+ {applicationList.length !== 0 ? (
56
+ <>
57
+ <Box sx={{ padding: "0.3rem 1rem" }}>
58
+ <Typography variant="body2">Switch to</Typography>
59
+ </Box>
60
+ <Box>
61
+ {applicationList.map((item, index) => {
62
+ return (
63
+ <Link
64
+ href={item.path + `/${urlTenantKey}/${institutionKey}`}
65
+ key={index}
66
+ >
67
+ <StyledMenuItemContainer
68
+ key={index}
69
+ onClick={() => {
70
+ window.location.href = item.path;
71
+ handleClose();
72
+ }}
73
+ >
74
+ <MenuItem item={item} />
75
+ </StyledMenuItemContainer>
76
+ </Link>
77
+ );
78
+ })}
79
+ </Box>
80
+ </>
81
+ ) : (
82
+ <StyledNoAppContainer>
83
+ <AppsOutageIcon sx={{ width: "40px", height: "40px" }} />
84
+ <Typography variant="body2">
85
+ No Application have been assigned
86
+ </Typography>
87
+ </StyledNoAppContainer>
88
+ )}
89
+ </Menu>
90
+ </>
91
+ );
92
+ };
93
+
94
+ const MenuItem = ({ item }: any) => {
95
+ return (
96
+ <StyledMenuItem>
97
+ <StyledImageBox>
98
+ <img
99
+ src={item.icon}
100
+ style={{ width: "20px", height: "20px" }}
101
+ alt="icon"
102
+ />
103
+ </StyledImageBox>
104
+ <Box>
105
+ <Typography variant="subtitle2">{item?.title}</Typography>
106
+ <Typography variant="caption">{item?.description}</Typography>
107
+ </Box>
108
+ </StyledMenuItem>
109
+ );
110
+ };
111
+
112
+ export default AppsMenu;
113
+
114
+ export const StyledIconButton = styled(IconButton)(({ theme }) => ({
115
+ padding: "18px",
116
+ backgroundColor: "black",
117
+ display: "flex",
118
+ alignItems: "center",
119
+ justifyContent: "center",
120
+ borderRadius: "0px",
121
+ height: "60px",
122
+ width: "60px",
123
+ border: `1px solid ${theme.palette.background.default}`,
124
+ }));
125
+
126
+ export const StyledMenuItemContainer = styled(Box)(({ theme }) => ({
127
+ cursor: "pointer",
128
+ padding: "5px 0px",
129
+ }));
130
+
131
+ export const StyledMenuItem = styled(Box)({
132
+ height: "68px",
133
+ width: "380px",
134
+ padding: "40px 20px",
135
+ transition: "background ease 0.3s",
136
+ "&:hover": {
137
+ background: "rgba(0, 0, 0, 0.03)",
138
+ },
139
+ display: "flex",
140
+ alignItems: "center",
141
+ gap: "20px",
142
+ });
143
+
144
+ export const StyledImageBox = styled(Box)(() => ({
145
+ height: "40px",
146
+ width: "40px",
147
+ boxShadow: "0px 5px 5px 0px rgba(48, 62, 99,0.1) ",
148
+ display: "flex",
149
+ alignItems: "center",
150
+ justifyContent: "center",
151
+ borderRadius: "5px",
152
+ }));
153
+
154
+ export const StyledNoAppContainer = styled(Box)({
155
+ width: "300px",
156
+ height: "300px",
157
+ display: "flex",
158
+ alignItems: "center",
159
+ flexDirection: "column",
160
+ justifyContent: "center",
161
+ gap: "10px",
162
+ });
@@ -0,0 +1,30 @@
1
+ import { Divider, IconButton } from "@mui/material";
2
+ import { ReactNode } from "react";
3
+ import { ClogWheelIcon } from "../../../../assets/images/icons";
4
+ import DropDownMenu from "../../../DropDownMenu/DropDownMenu";
5
+ // import { clogWheel } from "../../../../assets/images";
6
+ // import DropDownButton from "../../../DropDownButton/DropDownButton";
7
+
8
+ const CogWheelMenu = ({ menu }: { menu: ReactNode[] }) => {
9
+ return (
10
+ <>
11
+ <Divider
12
+ orientation="vertical"
13
+ variant="middle"
14
+ flexItem
15
+ sx={{ height: "20px" }}
16
+ />
17
+
18
+ <DropDownMenu
19
+ anchor={({ open }) => (
20
+ <IconButton color="secondary" onClick={open}>
21
+ <ClogWheelIcon />
22
+ </IconButton>
23
+ )}
24
+ menu={menu}
25
+ />
26
+ </>
27
+ );
28
+ };
29
+
30
+ export default CogWheelMenu;
@@ -0,0 +1,63 @@
1
+ import { Divider, IconButton, Stack } from "@mui/material";
2
+ import { ReactNode } from "react";
3
+ // import { IMenuItemProps } from '../../../DropDownButton/DropdownMenuItem'
4
+ // import InstitutionsDropDown from '../../../Institutions/InstitutionsDropdown'
5
+ import { HelpIcon } from "../../../../assets/images/icons";
6
+ import CogWheelMenu from "./CogWheelMenu";
7
+ import UserBox from "./UserBox";
8
+
9
+ export interface HeaderActionsProps {
10
+ cogWheelMenu: ReactNode[];
11
+ fullName: string;
12
+ userBoxActions: {
13
+ label: ReactNode;
14
+ icon?: ReactNode;
15
+ onClick: any;
16
+ }[];
17
+ profileUrl: string | undefined;
18
+ actions?: ReactNode[];
19
+ profileSx?: any;
20
+ }
21
+
22
+ const HeaderActions = ({
23
+ cogWheelMenu,
24
+ fullName,
25
+ userBoxActions,
26
+ profileUrl = "",
27
+ actions = [],
28
+ profileSx = {},
29
+ }: HeaderActionsProps) => {
30
+ return (
31
+ <Stack direction="row" gap={6}>
32
+ <Stack direction="row" gap={1}>
33
+ <IconButton
34
+ href={"https://campx.atlassian.net/servicedesk/customer/portal/2"}
35
+ target="_blank"
36
+ >
37
+ <HelpIcon />
38
+ </IconButton>
39
+
40
+ {actions.map((action, index) => (
41
+ <>
42
+ <Divider
43
+ orientation="vertical"
44
+ variant="middle"
45
+ flexItem
46
+ sx={{ height: "25px" }}
47
+ />
48
+ {action}
49
+ </>
50
+ ))}
51
+ {cogWheelMenu?.length ? <CogWheelMenu menu={cogWheelMenu} /> : null}
52
+ <UserBox
53
+ fullName={fullName}
54
+ actions={userBoxActions}
55
+ profileUrl={profileUrl}
56
+ profileSx={profileSx}
57
+ />
58
+ </Stack>
59
+ </Stack>
60
+ );
61
+ };
62
+
63
+ export default HeaderActions;
@@ -0,0 +1,117 @@
1
+ import { ReactNode } from "react";
2
+ import DropDownMenu from "../../../DropDownMenu/DropDownMenu";
3
+ import { StyledAvatar } from "../styles/styles";
4
+ // import {
5
+ // activeDevices,
6
+ // changePassword,
7
+ // logoutIcon,
8
+ // profile,
9
+ // } from '../../../../assets/images'
10
+
11
+ // import logout from '../../../../utils/logout'
12
+ // import ActiveDevices from '../../../ActiveDevices'
13
+ // import ChangePassword from '../../../ChangePassword'
14
+ // import DropDownButton from '../../../DropDownButton/DropDownButton'
15
+ // import { IMenuItemProps } from '../../../DropDownButton/DropdownMenuItem'
16
+ // import MyProfile from '../../../MyProfile/MyProfile'
17
+ // import { StyledAvatar } from '../styles'
18
+
19
+ const getStartingLetters = (text: string) => {
20
+ if (!text) return "";
21
+ return text
22
+ .split(" ")
23
+ ?.map((w) => w[0])
24
+ ?.join("");
25
+ };
26
+
27
+ export default function UserBox({
28
+ fullName,
29
+ actions,
30
+ profileUrl,
31
+ profileSx = {},
32
+ }: {
33
+ fullName: string;
34
+ actions: {
35
+ label: ReactNode;
36
+ icon?: ReactNode;
37
+ onClick: any;
38
+ }[];
39
+
40
+ profileUrl?: string;
41
+ profileSx?: any;
42
+ }) {
43
+ return (
44
+ <DropDownMenu
45
+ anchor={({ open }) => (
46
+ <StyledAvatar src={profileUrl ?? ""} onClick={open} sx={profileSx}>
47
+ {getStartingLetters(fullName)}
48
+ </StyledAvatar>
49
+ )}
50
+ menu={[]} // menu={
51
+ // customActions?.length
52
+ // ? customActions
53
+ // : [
54
+ // ...actions,
55
+ // {
56
+ // label: "My Profile",
57
+ // actionType: "dialog",
58
+ // icon: (
59
+ // <img style={{ marginRight: "10px" }} src={profile.default} />
60
+ // ),
61
+ // content: ({ close }) => <MyProfile close={close} />,
62
+ // dialogProps: {
63
+ // maxWidth: "xl",
64
+ // PaperProps: {
65
+ // sx: {
66
+ // padding: 0,
67
+ // },
68
+ // },
69
+ // },
70
+ // },
71
+ // {
72
+ // label: "Active Devices",
73
+ // actionType: "dialog",
74
+ // icon: (
75
+ // <img
76
+ // style={{ marginRight: "10px" }}
77
+ // src={activeDevices.default}
78
+ // />
79
+ // ),
80
+ // content: ({ close }) => <ActiveDevices close={close} />,
81
+ // contentTitle: "Active Devices",
82
+ // dialogProps: {
83
+ // maxWidth: "lg",
84
+ // PaperProps: {
85
+ // sx: {
86
+ // padding: 0,
87
+ // },
88
+ // },
89
+ // },
90
+ // },
91
+ // {
92
+ // label: "Change Password",
93
+ // actionType: "dialog",
94
+ // icon: (
95
+ // <img
96
+ // style={{ marginRight: "10px" }}
97
+ // src={changePassword.default}
98
+ // />
99
+ // ),
100
+ // content: ({ close }) => <ChangePassword close={close} />,
101
+ // contentTitle: "Change Password",
102
+ // },
103
+ // {
104
+ // label: "Logout",
105
+ // icon: (
106
+ // <img
107
+ // style={{ marginRight: "10px" }}
108
+ // src={logoutIcon.default}
109
+ // />
110
+ // ),
111
+ // onClick: logout,
112
+ // },
113
+ // ]
114
+ // }
115
+ />
116
+ );
117
+ }