@campxdev/react-blueprint 0.1.27 → 0.1.29
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 +0 -1
- package/.storybook/preview.tsx +10 -5
- package/.vscode/settings.json +3 -0
- package/package.json +1 -1
- package/src/App.tsx +4 -5
- package/src/components/Assets/Icons/IconComponents/AdministratorIcon.tsx +26 -0
- package/src/components/Assets/Icons/IconComponents/CampxIcon.tsx +25 -0
- package/src/components/{Icons/export.ts → Assets/Icons/Icons.tsx} +4 -0
- package/src/components/Assets/export.ts +1 -0
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +3 -1
- package/src/components/DataDisplay/export.ts +2 -0
- package/src/components/Feedback/Tooltip/Tooltip.tsx +4 -6
- package/src/components/Input/LabelWrapper/LabelWrapper.tsx +1 -1
- package/src/components/Input/SingleCheckBox/SIngleCheckBox.tsx +1 -1
- package/src/components/Input/SingleSelect/SingleSelect.tsx +0 -1
- package/src/components/Input/export.ts +5 -0
- package/src/components/Layout/AppHeader/AppHeader.tsx +55 -0
- package/src/components/Layout/{Header/HeaderActions → AppHeader/AppHeaderActions}/HeaderActions.tsx +25 -12
- package/src/components/Layout/{Header/HeaderActions → AppHeader/AppHeaderActions}/UserBox.tsx +33 -39
- package/src/components/Layout/AppHeader/styles/styles.tsx +37 -0
- package/src/components/Navigation/exports.ts +15 -0
- package/src/components/export.ts +7 -13
- package/src/{components/Icons → stories/Assets}/Icons.stories.tsx +11 -1
- package/src/{components/DataDisplay/Avatar → stories/DataDisplay}/CircularAvatar.stories.tsx +4 -1
- package/src/{components/DataDisplay/DataTable → stories/DataDisplay}/DataTable.stories.tsx +2 -1
- package/src/{components/DataDisplay/SidePanel → stories/DataDisplay}/SidePanel.stories.tsx +4 -1
- package/src/{components/DataDisplay/Avatar → stories/DataDisplay}/SquareAvatar.stories.tsx +4 -1
- package/src/{themes → stories/DesignSystem}/colorTokens.stories.tsx +7 -11
- package/src/{themes → stories/DesignSystem}/typography.stories.tsx +2 -1
- package/src/{components/Feedback/Spinner → stories/Feedback}/Spinner.stories.tsx +1 -2
- package/src/{components/Feedback/Tooltip → stories/Feedback}/Tooltip.stories.tsx +8 -4
- package/src/{components/Input/Button → stories/Input}/Button.stories.tsx +1 -2
- package/src/{components/Input/Chips → stories/Input}/Chips.stories.tsx +1 -1
- package/src/{components/Input/MultiCheckBox → stories/Input}/MultiCheckBox.stories.tsx +4 -1
- package/src/{components/Input/OtpInput → stories/Input}/OtpInput.stories.tsx +3 -2
- package/src/{components/Input/RadioGroup → stories/Input}/RadioGroup.stories.tsx +4 -1
- package/src/{components/Input/SearchBar → stories/Input}/SearchBar.stories.tsx +1 -1
- package/src/{components/Input/SingleCheckBox → stories/Input}/SingleCheckBox.stories.tsx +4 -2
- package/src/{components/Input/SingleSelect → stories/Input}/SingleSelect.stories.tsx +4 -1
- package/src/{components/Input/Switch → stories/Input}/Switch.stories.tsx +1 -2
- package/src/{components/Input/TextField → stories/Input}/TextField.stories.tsx +20 -6
- package/src/stories/Layout/AppHeader.stories.tsx +68 -0
- package/src/{components/Layout/LayoutWrapper → stories/Layout}/LayoutWrapper.stories.tsx +8 -5
- package/src/{components/Layout/PageContent → stories/Layout}/PageContent.stories.tsx +1 -1
- package/src/{components/Layout/SideNavigation → stories/Layout}/SideNavigation.stories.tsx +2 -2
- package/src/{components/Navigation/DialogButton → stories/Navigation}/DialogButton.stories.tsx +3 -1
- package/src/{components/Navigation/DropDownMenu → stories/Navigation}/DropDownMenu.stories.tsx +8 -5
- package/src/{components/Navigation/TabsContainer → stories/Navigation}/TabsContainer.stories.tsx +5 -2
- package/src/themes/colorTokens/colorPalette.tsx +48 -0
- package/src/themes/colorTokens/darkColorTokens.tsx +42 -0
- package/src/themes/colorTokens/lightColorTokens.ts +42 -0
- package/src/themes/commonTheme.ts +15 -18
- package/src/themes/darkTheme.ts +4 -12
- package/src/themes/lightTheme.ts +2 -11
- package/types/theme.d.ts +22 -12
- package/src/components/Icons/Icons.tsx +0 -14
- package/src/components/Layout/Header/AppHeader.stories.tsx +0 -207
- package/src/components/Layout/Header/AppHeader.tsx +0 -71
- package/src/components/Layout/Header/AppLogo.tsx +0 -51
- package/src/components/Layout/Header/styles/styles.tsx +0 -69
- package/src/themes/colorTokens.ts +0 -77
- /package/src/components/{Icons → Assets/Icons}/IconComponents/ActiveDevicesIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/AppsIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/BulbIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/CareerIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/CheckedCheckBoxIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/CheckedRadioIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/ClogWheelIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/CrossIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/DashBoardIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/DeviceIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/ExamResultIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/ExportIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/FilterIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/HelpIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/HomeIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/InfoIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/InstitutionsIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/LeftIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/LocationIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/LogoutIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/NavigationIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/NotificationIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/ProductFeaturesIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/ProfileIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/RightIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/TicketsIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/UncheckCheckBoxIcon.tsx +0 -0
- /package/src/components/{Icons → Assets/Icons}/IconComponents/UncheckedRadioIcon.tsx +0 -0
- /package/src/components/Layout/{Header/HeaderActions → AppHeader/AppHeaderActions}/CogWheelMenu.tsx +0 -0
- /package/src/components/Layout/{Header → AppHeader}/AppsMenu.tsx +0 -0
package/.storybook/main.ts
CHANGED
package/.storybook/preview.tsx
CHANGED
|
@@ -4,7 +4,9 @@ import React from "react";
|
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
5
|
import { useDarkMode } from "storybook-dark-mode";
|
|
6
6
|
import { MuiThemeProvider } from "../src/themes/MuiThemeProvider";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { DarkColorTokens } from "../src/themes/colorTokens/darkColorTokens";
|
|
9
|
+
import { LightColorTokens } from "../src/themes/colorTokens/lightColorTokens";
|
|
8
10
|
import { darkTheme } from "../src/themes/darkTheme";
|
|
9
11
|
import { lightTheme } from "../src/themes/lightTheme";
|
|
10
12
|
|
|
@@ -19,10 +21,13 @@ const preview: Preview = {
|
|
|
19
21
|
backgrounds: {
|
|
20
22
|
default: "light", // name of the default background to use
|
|
21
23
|
values: [
|
|
22
|
-
{ name: "light", value: LightColorTokens.
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
{ name: "light", value: LightColorTokens.surface.defaultBackground },
|
|
25
|
+
{
|
|
26
|
+
name: "light paper",
|
|
27
|
+
value: LightColorTokens.surface.paperBackground,
|
|
28
|
+
},
|
|
29
|
+
{ name: "dark", value: DarkColorTokens.surface.defaultBackground },
|
|
30
|
+
{ name: "dark paper", value: DarkColorTokens.surface.paperBackground },
|
|
26
31
|
],
|
|
27
32
|
},
|
|
28
33
|
},
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -5,12 +5,11 @@ import Providers from "./contexts/Providers";
|
|
|
5
5
|
function App() {
|
|
6
6
|
return (
|
|
7
7
|
<Providers>
|
|
8
|
-
{/* <AppHeader clientLogo={""} fullName={""} userBoxActions={[]} /> */}
|
|
9
8
|
<AppHeader
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
clientName="Anurag University"
|
|
10
|
+
actions={[<p>asdjflsf</p>]}
|
|
11
|
+
appsMenu={<AppsMenu apps={["exams", "square", "admin"]} />}
|
|
12
|
+
userFullName="Srikanth Yellapragada"
|
|
14
13
|
/>
|
|
15
14
|
</Providers>
|
|
16
15
|
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const AdministratorIcon = () => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
const color = theme.palette.text.primary;
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<svg
|
|
9
|
+
width="30"
|
|
10
|
+
height="30"
|
|
11
|
+
viewBox="0 0 30 30"
|
|
12
|
+
style={{ fill: color }}
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
d="M15.0008 28.2871C14.1809 28.3018 13.3712 28.1037 12.6508 27.7121L5.77578 23.7501C2.97578 21.8621 2.80078 21.5751 2.80078 18.6121V11.3871C2.80078 8.42409 2.96378 8.13709 5.71378 6.27509L12.6388 2.27509C13.363 1.89929 14.1669 1.70313 14.9828 1.70312C15.7987 1.70312 16.6026 1.89929 17.3268 2.27509L24.2268 6.25009C27.0268 8.13809 27.2018 8.42509 27.2018 11.3871V18.6031C27.2018 21.5651 27.0398 21.8531 24.2888 23.7161L17.3638 27.7161C16.6378 28.105 15.8243 28.3016 15.0008 28.2871ZM15.0008 3.58709C14.5152 3.57053 14.0334 3.6779 13.6008 3.89909L6.72578 7.87509C4.68878 9.25009 4.68778 9.25009 4.68778 11.3871V18.6031C4.68778 20.7411 4.68778 20.7411 6.77478 22.1531L13.6008 26.0871C14.0399 26.297 14.5205 26.406 15.0073 26.406C15.494 26.406 15.9746 26.297 16.4138 26.0871L23.2888 22.1121C25.3138 20.7371 25.3138 20.7371 25.3138 18.5991V11.3871C25.3138 9.24909 25.3138 9.25009 23.2268 7.83709L16.4008 3.90309C15.9685 3.68052 15.4867 3.57176 15.0008 3.58709Z"
|
|
17
|
+
fill="#121212"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
d="M15.0015 19.6875C14.0742 19.6877 13.1677 19.4129 12.3966 18.8979C11.6255 18.3828 11.0245 17.6507 10.6695 16.794C10.3146 15.9373 10.2217 14.9947 10.4025 14.0852C10.5834 13.1757 11.0299 12.3403 11.6856 11.6846C12.3413 11.0289 13.1767 10.5824 14.0862 10.4016C14.9956 10.2207 15.9383 10.3136 16.795 10.6686C17.6516 11.0235 18.3838 11.6245 18.8988 12.3956C19.4139 13.1667 19.6887 14.0732 19.6885 15.0005C19.688 16.2434 19.194 17.4353 18.3151 18.3141C17.4363 19.193 16.2444 19.687 15.0015 19.6875ZM15.0015 12.1875C14.4451 12.1873 13.9011 12.3521 13.4384 12.6611C12.9757 12.9701 12.615 13.4094 12.4019 13.9233C12.1889 14.4373 12.133 15.003 12.2414 15.5487C12.3499 16.0944 12.6177 16.5958 13.0111 16.9893C13.4044 17.3828 13.9056 17.6508 14.4513 17.7594C14.997 17.868 15.5627 17.8124 16.0768 17.5995C16.5908 17.3866 17.0302 17.0261 17.3394 16.5634C17.6485 16.1008 17.8135 15.5569 17.8135 15.0005C17.8124 14.255 17.5159 13.5402 16.9888 13.013C16.4617 12.4857 15.7471 12.1888 15.0015 12.1875Z"
|
|
21
|
+
fill="#121212"
|
|
22
|
+
/>
|
|
23
|
+
</svg>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const CampxIcon = () => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
|
|
6
|
+
const color = theme.palette.mode === "dark" ? "white" : "blue";
|
|
7
|
+
console.log(color);
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
width="32"
|
|
12
|
+
height="32"
|
|
13
|
+
viewBox="0 5 101.234 104.906"
|
|
14
|
+
style={{
|
|
15
|
+
fill: color,
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<path
|
|
19
|
+
id="Subtraction_130"
|
|
20
|
+
data-name="Subtraction 130"
|
|
21
|
+
d="M100.772,104.906H76.085L61.518,84.856l12.7-17.476,27.02,37.19-.463.336Zm-75.622,0H.463L0,104.57,37.92,52.377,0,.185.254,0H25.26L50.617,34.9l.005-.007,12.7,17.475-.005.007.018.024-12.7,17.476-.017-.024L25.15,104.906ZM74.112,37.516h0L61.415,20.04,75.975,0H100.98l.254.185L74.112,37.516Z"
|
|
22
|
+
/>
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -14,6 +14,7 @@ import { HomeIcon } from "./IconComponents/HomeIcon";
|
|
|
14
14
|
import { InfoIcon } from "./IconComponents/InfoIcon";
|
|
15
15
|
|
|
16
16
|
import { BulbIcon } from "./IconComponents/BulbIcon";
|
|
17
|
+
import { CampxIcon } from "./IconComponents/CampxIcon";
|
|
17
18
|
import { CrossIcon } from "./IconComponents/CrossIcon";
|
|
18
19
|
import { InstitutionsIcon } from "./IconComponents/InstitutionsIcon";
|
|
19
20
|
import { LeftIcon } from "./IconComponents/LeftIcon";
|
|
@@ -27,6 +28,7 @@ import { RightIcon } from "./IconComponents/RightIcon";
|
|
|
27
28
|
import { TicketsIcon } from "./IconComponents/TicketsIcon";
|
|
28
29
|
import { UnCheckedCheckboxIcon } from "./IconComponents/UncheckCheckBoxIcon";
|
|
29
30
|
import { UnCheckedRadioIcon } from "./IconComponents/UncheckedRadioIcon";
|
|
31
|
+
import { AdministratorIcon } from "./IconComponents/AdministratorIcon";
|
|
30
32
|
export const Icons = {
|
|
31
33
|
AppsIcon,
|
|
32
34
|
CareerIcon,
|
|
@@ -56,4 +58,6 @@ export const Icons = {
|
|
|
56
58
|
DeviceIcon,
|
|
57
59
|
CrossIcon,
|
|
58
60
|
ProductFeaturesIcon,
|
|
61
|
+
CampxIcon,
|
|
62
|
+
AdministratorIcon,
|
|
59
63
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Icons/Icons";
|
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
Stack,
|
|
5
5
|
} from "@mui/material";
|
|
6
6
|
import { DropdownMenuItem } from "../../Navigation/DropDownMenu/DropdownMenuItem";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { DropDownButton } from "../../Navigation/DropDownMenu/DropDownButton";
|
|
9
|
+
import { DropdownMenu } from "../../Navigation/DropDownMenu/DropDownMenu";
|
|
8
10
|
import { Typography } from "../Typography/Typography";
|
|
9
11
|
|
|
10
12
|
export type PaginationProps = {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
IconButton,
|
|
3
3
|
Tooltip as MuiTooltip,
|
|
4
4
|
TooltipProps as MuiTooltipProps,
|
|
5
|
-
|
|
6
|
-
Button,
|
|
5
|
+
Stack,
|
|
7
6
|
} from "@mui/material";
|
|
8
|
-
import {
|
|
7
|
+
import { Children, ReactElement } from "react";
|
|
8
|
+
import { BulbIcon } from "../../Assets/Icons/IconComponents/BulbIcon";
|
|
9
9
|
import { Typography } from "../../DataDisplay/Typography/Typography";
|
|
10
|
-
import { InfoIcon } from "../../Icons/IconComponents/InfoIcon";
|
|
11
|
-
import { Children, ReactElement, useState } from "react";
|
|
12
10
|
|
|
13
11
|
export type TooltipProps = {
|
|
14
12
|
children: ReactElement | string;
|
|
@@ -21,7 +21,7 @@ export const LabelWrapper = ({
|
|
|
21
21
|
<Typography htmlFor={name} component="label" variant="label1">
|
|
22
22
|
{label}
|
|
23
23
|
{required && (
|
|
24
|
-
<span style={{ color: `${theme.palette.
|
|
24
|
+
<span style={{ color: `${theme.palette.tertiary.main}` }}>
|
|
25
25
|
{" *"}
|
|
26
26
|
</span>
|
|
27
27
|
)}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Box, Divider, IconButton, Stack } from "@mui/material";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { StyledHeader } from "./styles/styles";
|
|
4
|
+
import { CampxIcon } from "../../Assets/Icons/IconComponents/CampxIcon";
|
|
5
|
+
import { Typography } from "../../DataDisplay/Typography/Typography";
|
|
6
|
+
import UserBox from "./AppHeaderActions/UserBox";
|
|
7
|
+
import { HelpIcon } from "../../Assets/Icons/IconComponents/HelpIcon";
|
|
8
|
+
import { AdministratorIcon } from "../../Assets/Icons/IconComponents/AdministratorIcon";
|
|
9
|
+
import { TicketsIcon } from "../../Assets/Icons/IconComponents/TicketsIcon";
|
|
10
|
+
import { StyledIconButton } from "../../Navigation/DropDownMenu/styles";
|
|
11
|
+
|
|
12
|
+
export interface AppHeaderProps {
|
|
13
|
+
actions?: ReactNode[];
|
|
14
|
+
appsMenu?: ReactNode;
|
|
15
|
+
clientLogoUrl?: string;
|
|
16
|
+
clientName: string;
|
|
17
|
+
userFullName: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const AppHeader = ({
|
|
21
|
+
actions = [],
|
|
22
|
+
appsMenu,
|
|
23
|
+
clientLogoUrl,
|
|
24
|
+
clientName,
|
|
25
|
+
userFullName,
|
|
26
|
+
}: AppHeaderProps) => {
|
|
27
|
+
return (
|
|
28
|
+
<StyledHeader>
|
|
29
|
+
<Stack
|
|
30
|
+
flexDirection={"row"}
|
|
31
|
+
alignItems={"center"}
|
|
32
|
+
gap={"20px"}
|
|
33
|
+
divider={<Divider orientation="vertical" flexItem />}
|
|
34
|
+
>
|
|
35
|
+
{appsMenu && (
|
|
36
|
+
<Stack alignItems={"center"} gap={"12px"} flexDirection={"row"}>
|
|
37
|
+
{appsMenu}
|
|
38
|
+
</Stack>
|
|
39
|
+
)}
|
|
40
|
+
<CampxIcon />
|
|
41
|
+
<Typography variant={"subtitle2"}>{clientName}</Typography>
|
|
42
|
+
</Stack>
|
|
43
|
+
<Stack alignItems={"center"} gap={"12px"} flexDirection={"row"}>
|
|
44
|
+
<StyledIconButton
|
|
45
|
+
onClick={() => {
|
|
46
|
+
alert("help button clicked");
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<HelpIcon />
|
|
50
|
+
</StyledIconButton>
|
|
51
|
+
<UserBox fullName={userFullName} actions={[]} />
|
|
52
|
+
</Stack>
|
|
53
|
+
</StyledHeader>
|
|
54
|
+
);
|
|
55
|
+
};
|
package/src/components/Layout/{Header/HeaderActions → AppHeader/AppHeaderActions}/HeaderActions.tsx
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// HeaderActions.tsx
|
|
2
|
+
|
|
1
3
|
import { Divider, Stack } from "@mui/material";
|
|
2
4
|
import { ReactNode } from "react";
|
|
3
5
|
import CogWheelMenu from "./CogWheelMenu";
|
|
@@ -5,26 +7,32 @@ import UserBox from "./UserBox";
|
|
|
5
7
|
|
|
6
8
|
export interface HeaderActionsProps {
|
|
7
9
|
cogWheelMenu: ReactNode[];
|
|
8
|
-
fullName
|
|
10
|
+
fullName?: string;
|
|
9
11
|
designation?: string;
|
|
10
|
-
userBoxActions
|
|
12
|
+
userBoxActions?: {
|
|
11
13
|
label: ReactNode;
|
|
12
14
|
icon?: ReactNode;
|
|
13
15
|
onClick: any;
|
|
14
16
|
}[];
|
|
15
|
-
profileUrl
|
|
17
|
+
profileUrl?: string;
|
|
16
18
|
actions?: ReactNode[];
|
|
17
|
-
profileSx?: any;
|
|
19
|
+
profileSx?: any;
|
|
20
|
+
avatar?: any;
|
|
21
|
+
navigationIcon: any;
|
|
22
|
+
showActiveDevices: any;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
const HeaderActions = ({
|
|
21
26
|
cogWheelMenu,
|
|
22
27
|
fullName,
|
|
23
28
|
designation,
|
|
24
|
-
userBoxActions,
|
|
29
|
+
userBoxActions = [],
|
|
25
30
|
profileUrl = "",
|
|
26
31
|
actions = [],
|
|
27
32
|
profileSx = {},
|
|
33
|
+
avatar = {},
|
|
34
|
+
navigationIcon = {},
|
|
35
|
+
showActiveDevices = {},
|
|
28
36
|
}: HeaderActionsProps) => {
|
|
29
37
|
return (
|
|
30
38
|
<Stack direction="row" gap={1} alignItems="center">
|
|
@@ -45,13 +53,18 @@ const HeaderActions = ({
|
|
|
45
53
|
{cogWheelMenu?.length ? <CogWheelMenu menu={cogWheelMenu} /> : null}
|
|
46
54
|
|
|
47
55
|
{/* Render UserBox */}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
{fullName && (
|
|
57
|
+
<UserBox
|
|
58
|
+
fullName={fullName}
|
|
59
|
+
designation={designation}
|
|
60
|
+
actions={userBoxActions}
|
|
61
|
+
profileUrl={profileUrl}
|
|
62
|
+
profileSx={profileSx}
|
|
63
|
+
avatar={avatar}
|
|
64
|
+
navigationIcon={navigationIcon}
|
|
65
|
+
showActiveDevices={showActiveDevices}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
55
68
|
</Stack>
|
|
56
69
|
);
|
|
57
70
|
};
|
package/src/components/Layout/{Header/HeaderActions → AppHeader/AppHeaderActions}/UserBox.tsx
RENAMED
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import { Stack, Typography, useTheme } from "@mui/material";
|
|
1
|
+
import { Avatar, Stack, Typography, useTheme } from "@mui/material";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { DropdownMenu } from "../../../Navigation/DropDownMenu/DropDownMenu";
|
|
4
4
|
import { DropdownMenuItem } from "../../../Navigation/DropDownMenu/DropdownMenuItem";
|
|
5
5
|
import { Icons } from "../../../export";
|
|
6
|
-
import { StyledAvatar, StyledTypography } from "../styles/styles";
|
|
7
|
-
// import {
|
|
8
|
-
// activeDevices,
|
|
9
|
-
// changePassword,
|
|
10
|
-
// logoutIcon,
|
|
11
|
-
// profile,
|
|
12
|
-
// } from '../../../../assets/images'
|
|
13
|
-
|
|
14
|
-
// import logout from '../../../../utils/logout'
|
|
15
|
-
// import ActiveDevices from '../../../ActiveDevices'
|
|
16
|
-
// import ChangePassword from '../../../ChangePassword'
|
|
17
|
-
// import DropDownButton from '../../../DropDownButton/DropDownButton'
|
|
18
|
-
// import { IMenuItemProps } from '../../../DropDownButton/DropdownMenuItem'
|
|
19
|
-
// import MyProfile from '../../../MyProfile/MyProfile'
|
|
20
|
-
// import { StyledAvatar } from '../styles'
|
|
21
6
|
|
|
22
7
|
const getStartingLetters = (text: string) => {
|
|
23
8
|
if (!text) return "";
|
|
@@ -33,6 +18,9 @@ export default function UserBox({
|
|
|
33
18
|
actions,
|
|
34
19
|
profileUrl,
|
|
35
20
|
profileSx = {},
|
|
21
|
+
avatar = true, // Make avatar optional, default to true
|
|
22
|
+
navigationIcon = true, // Make navigationIcon optional, default to true
|
|
23
|
+
showActiveDevices = true, // Make active devices optional, default to true
|
|
36
24
|
}: {
|
|
37
25
|
fullName: string;
|
|
38
26
|
designation?: string;
|
|
@@ -44,15 +32,18 @@ export default function UserBox({
|
|
|
44
32
|
|
|
45
33
|
profileUrl?: string;
|
|
46
34
|
profileSx?: any;
|
|
35
|
+
avatar?: boolean; // Define avatar as optional
|
|
36
|
+
navigationIcon?: boolean; // Define navigationIcon as optional
|
|
37
|
+
showActiveDevices?: boolean; // Define active devices as optional
|
|
47
38
|
}) {
|
|
48
39
|
const theme = useTheme();
|
|
49
40
|
|
|
50
41
|
return (
|
|
51
42
|
<DropdownMenu
|
|
52
43
|
anchor={({ open }) => (
|
|
53
|
-
<
|
|
44
|
+
<Avatar src={profileUrl ?? ""} onClick={open} sx={profileSx}>
|
|
54
45
|
{getStartingLetters(fullName)}
|
|
55
|
-
</
|
|
46
|
+
</Avatar>
|
|
56
47
|
)}
|
|
57
48
|
menuListProps={{
|
|
58
49
|
sx: {
|
|
@@ -64,37 +55,41 @@ export default function UserBox({
|
|
|
64
55
|
<DropdownMenuItem
|
|
65
56
|
label={
|
|
66
57
|
<Stack gap={0.5} sx={{ width: "100%" }}>
|
|
67
|
-
<
|
|
58
|
+
<Typography variant="subtitle3">Account</Typography>
|
|
68
59
|
<Stack
|
|
69
60
|
direction={"row"}
|
|
70
61
|
alignItems={"center"}
|
|
71
62
|
justifyContent={"space-between"}
|
|
72
63
|
>
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<Stack>
|
|
79
|
-
<
|
|
80
|
-
|
|
64
|
+
{avatar && (
|
|
65
|
+
<Stack direction={"row"} gap={1}>
|
|
66
|
+
<Avatar src={profileUrl ?? ""} sx={profileSx}>
|
|
67
|
+
{getStartingLetters(fullName)}
|
|
68
|
+
</Avatar>
|
|
69
|
+
<Stack direction={"row"} justifyContent={"space-between"}>
|
|
70
|
+
<Stack>
|
|
71
|
+
<Typography variant="subtitle3">{fullName}</Typography>
|
|
72
|
+
<Typography variant="caption">{designation}</Typography>
|
|
73
|
+
</Stack>
|
|
81
74
|
</Stack>
|
|
82
75
|
</Stack>
|
|
83
|
-
|
|
84
|
-
<Icons.NavigationIcon />
|
|
76
|
+
)}
|
|
77
|
+
{navigationIcon && <Icons.NavigationIcon />}
|
|
85
78
|
</Stack>
|
|
86
79
|
</Stack>
|
|
87
80
|
}
|
|
88
81
|
onClick={() => alert("Action 1 clicked")}
|
|
89
82
|
/>,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
83
|
+
showActiveDevices && (
|
|
84
|
+
<DropdownMenuItem
|
|
85
|
+
label={
|
|
86
|
+
<Stack gap={0.5}>
|
|
87
|
+
<Typography variant="subtitle3">Active Devices</Typography>
|
|
88
|
+
</Stack>
|
|
89
|
+
}
|
|
90
|
+
onClick={() => alert("Action 1 clicked")}
|
|
91
|
+
/>
|
|
92
|
+
),
|
|
98
93
|
<DropdownMenuItem
|
|
99
94
|
label={
|
|
100
95
|
<Stack
|
|
@@ -104,8 +99,7 @@ export default function UserBox({
|
|
|
104
99
|
width={"100%"}
|
|
105
100
|
>
|
|
106
101
|
<Typography variant="subtitle3">Logout</Typography>
|
|
107
|
-
|
|
108
|
-
<Icons.LogoutIcon hoverColor={theme.palette.highlight.main} />
|
|
102
|
+
<Icons.LogoutIcon hoverColor={theme.palette.tertiary.main} />
|
|
109
103
|
</Stack>
|
|
110
104
|
}
|
|
111
105
|
onClick={() => alert("Action 1 clicked")}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Box, styled } from "@mui/material";
|
|
2
|
+
import { Link } from "react-router-dom";
|
|
3
|
+
|
|
4
|
+
export const StyledHeader = styled("header")(({ theme }) => ({
|
|
5
|
+
display: "flex",
|
|
6
|
+
flexDirection: "row",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
width: "100%",
|
|
9
|
+
position: "fixed",
|
|
10
|
+
top: 0,
|
|
11
|
+
height: "60px",
|
|
12
|
+
backgroundColor: theme.palette.background.paper,
|
|
13
|
+
justifyContent: "space-between",
|
|
14
|
+
padding: "0 32px",
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
export const StyledActionBox = styled(Box)(({ theme }) => ({
|
|
18
|
+
marginRight: "20px",
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
gap: "14px",
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export const StyledRouterLink = styled(Link)(() => ({
|
|
25
|
+
textDecoration: "none",
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
export const StyledImageWrapper = styled(Box)(() => ({
|
|
29
|
+
width: "auto",
|
|
30
|
+
height: "22px",
|
|
31
|
+
display: "flex",
|
|
32
|
+
img: {
|
|
33
|
+
width: "100%",
|
|
34
|
+
height: "25px",
|
|
35
|
+
objectFit: "contain",
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CustomDialog } from "./DialogButton/DialogButton";
|
|
2
|
+
import { DropDownButton } from "./DropDownMenu/DropDownButton";
|
|
3
|
+
import { DropdownMenu } from "./DropDownMenu/DropDownMenu";
|
|
4
|
+
import { DropDownIcon } from "./DropDownMenu/DropDownIcon";
|
|
5
|
+
import { DropdownMenuItem } from "./DropDownMenu/DropdownMenuItem";
|
|
6
|
+
import { TabsContainer } from "./TabsContainer/TabsContainer";
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
CustomDialog,
|
|
10
|
+
DropDownButton,
|
|
11
|
+
DropdownMenu,
|
|
12
|
+
DropDownIcon,
|
|
13
|
+
DropdownMenuItem,
|
|
14
|
+
TabsContainer,
|
|
15
|
+
};
|
package/src/components/export.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./Input/
|
|
4
|
-
export * from "./
|
|
5
|
-
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./Layout/Header/AppHeader";
|
|
8
|
-
export * from "./Layout/Header/AppLogo";
|
|
9
|
-
export * from "./Layout/Header/AppsMenu";
|
|
1
|
+
export * from "./Assets/export";
|
|
2
|
+
export * from "./DataDisplay/export";
|
|
3
|
+
export * from "./Input/export";
|
|
4
|
+
export * from "./Layout/AppHeader/AppHeader";
|
|
5
|
+
|
|
6
|
+
export * from "./Layout/AppHeader/AppsMenu";
|
|
10
7
|
export * from "./Layout/LayoutWrapper/LayoutWrapper";
|
|
11
8
|
export * from "./Layout/PageContent/PageContent";
|
|
12
9
|
export * from "./Layout/SideNavigation/SideNavigation";
|
|
13
|
-
export * from "./Navigation/
|
|
14
|
-
export * from "./Navigation/DropDownMenu/DropDownIcon";
|
|
15
|
-
export * from "./Navigation/DropDownMenu/DropDownMenu";
|
|
16
|
-
export * from "./Navigation/DropDownMenu/DropdownMenuItem";
|
|
10
|
+
export * from "./Navigation/exports";
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
// Import React and other necessary elements
|
|
2
|
+
import { Stack } from "@mui/material";
|
|
2
3
|
import { Meta, StoryObj } from "@storybook/react/*";
|
|
4
|
+
import { Icons } from "../../components/Assets/Icons/Icons";
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
const IconsStory = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Stack gap={2} direction={"row"}>
|
|
9
|
+
{Object.values(Icons).map((Icon) => (
|
|
10
|
+
<Icon />
|
|
11
|
+
))}
|
|
12
|
+
</Stack>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
5
15
|
|
|
6
16
|
export default {
|
|
7
17
|
title: "Assets/Icons",
|
package/src/{components/DataDisplay/Avatar → stories/DataDisplay}/CircularAvatar.stories.tsx
RENAMED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Import React and other necessary elements
|
|
2
2
|
|
|
3
3
|
import { Meta } from "@storybook/react";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CircularAvatar,
|
|
6
|
+
CircularAvatarProps,
|
|
7
|
+
} from "../../components/DataDisplay/Avatar/Avatar";
|
|
5
8
|
|
|
6
9
|
// Define the default export with Meta type including the component type
|
|
7
10
|
export default {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GridColDef, GridColumnGroupingModel } from "@mui/x-data-grid";
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { DataTable } from "
|
|
3
|
+
import { DataTable } from "../../components/DataDisplay/DataTable/DataTable";
|
|
4
|
+
// Make sure the path to your component is correct
|
|
4
5
|
|
|
5
6
|
const columns: GridColDef[] = [
|
|
6
7
|
{ field: "id", headerName: "ID", flex: 1 },
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Import React and other necessary elements
|
|
2
2
|
|
|
3
3
|
import { Meta } from "@storybook/react";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
SquareAvatar,
|
|
6
|
+
SquareAvatarProps,
|
|
7
|
+
} from "../../components/DataDisplay/Avatar/Avatar";
|
|
5
8
|
|
|
6
9
|
// Define the default export with Meta type including the component type
|
|
7
10
|
export default {
|