@campxdev/react-blueprint 0.1.27 → 0.1.28
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/package.json +1 -1
- package/src/App.tsx +1 -2
- package/src/components/DataDisplay/export.ts +1 -0
- package/src/components/Input/export.ts +5 -0
- package/src/components/Layout/Header/AppHeader.stories.tsx +3 -0
- package/src/components/Layout/Header/AppHeader.tsx +18 -8
- package/src/components/Layout/Header/HeaderActions/HeaderActions.tsx +26 -12
- package/src/components/Layout/Header/HeaderActions/UserBox.tsx +28 -33
- package/src/components/export.ts +2 -5
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from ".//DataTable/DataTable";
|
|
@@ -109,6 +109,9 @@ export const WithActions: Story = {
|
|
|
109
109
|
clientLogo: "https://via.placeholder.com/150",
|
|
110
110
|
fullName: "John Doe",
|
|
111
111
|
designation: "Head of the Department",
|
|
112
|
+
avatar:false,
|
|
113
|
+
navigationIcon:false,
|
|
114
|
+
showActiveDevices:false,
|
|
112
115
|
appsMenu: (
|
|
113
116
|
<AppsMenu
|
|
114
117
|
apps={[
|
|
@@ -26,6 +26,9 @@ export interface AppHeaderProps {
|
|
|
26
26
|
imageSx?: any;
|
|
27
27
|
headerSx?: any;
|
|
28
28
|
profileSx?: any;
|
|
29
|
+
avatar?: any;
|
|
30
|
+
navigationIcon:any;
|
|
31
|
+
showActiveDevices: any;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export const AppHeader = ({
|
|
@@ -42,6 +45,9 @@ export const AppHeader = ({
|
|
|
42
45
|
headerSx = {},
|
|
43
46
|
profileSx = {},
|
|
44
47
|
imageSx = {},
|
|
48
|
+
avatar={},
|
|
49
|
+
navigationIcon={},
|
|
50
|
+
showActiveDevices={},
|
|
45
51
|
}: AppHeaderProps) => {
|
|
46
52
|
return (
|
|
47
53
|
<StyledHeader sx={headerSx}>
|
|
@@ -55,14 +61,18 @@ export const AppHeader = ({
|
|
|
55
61
|
customHeaderActions
|
|
56
62
|
) : (
|
|
57
63
|
<HeaderActions
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
cogWheelMenu={cogWheelMenu}
|
|
65
|
+
fullName={fullName ?? ""}
|
|
66
|
+
designation={designation}
|
|
67
|
+
userBoxActions={userBoxActions}
|
|
68
|
+
profileUrl={profileUrl ?? ""}
|
|
69
|
+
actions={actions}
|
|
70
|
+
profileSx={profileSx}
|
|
71
|
+
avatar={avatar}
|
|
72
|
+
navigationIcon={navigationIcon}
|
|
73
|
+
showActiveDevices={showActiveDevices}
|
|
74
|
+
/>
|
|
75
|
+
|
|
66
76
|
)}
|
|
67
77
|
</StyledActionBox>
|
|
68
78
|
</StyledContainer>
|
|
@@ -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,19 @@ 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
|
+
)}
|
|
68
|
+
|
|
55
69
|
</Stack>
|
|
56
70
|
);
|
|
57
71
|
};
|
|
@@ -4,20 +4,6 @@ import { DropdownMenu } from "../../../Navigation/DropDownMenu/DropDownMenu";
|
|
|
4
4
|
import { DropdownMenuItem } from "../../../Navigation/DropDownMenu/DropdownMenuItem";
|
|
5
5
|
import { Icons } from "../../../export";
|
|
6
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
7
|
|
|
22
8
|
const getStartingLetters = (text: string) => {
|
|
23
9
|
if (!text) return "";
|
|
@@ -33,6 +19,9 @@ export default function UserBox({
|
|
|
33
19
|
actions,
|
|
34
20
|
profileUrl,
|
|
35
21
|
profileSx = {},
|
|
22
|
+
avatar = true, // Make avatar optional, default to true
|
|
23
|
+
navigationIcon = true, // Make navigationIcon optional, default to true
|
|
24
|
+
showActiveDevices = true, // Make active devices optional, default to true
|
|
36
25
|
}: {
|
|
37
26
|
fullName: string;
|
|
38
27
|
designation?: string;
|
|
@@ -44,6 +33,9 @@ export default function UserBox({
|
|
|
44
33
|
|
|
45
34
|
profileUrl?: string;
|
|
46
35
|
profileSx?: any;
|
|
36
|
+
avatar?: boolean; // Define avatar as optional
|
|
37
|
+
navigationIcon?: boolean; // Define navigationIcon as optional
|
|
38
|
+
showActiveDevices?: boolean; // Define active devices as optional
|
|
47
39
|
}) {
|
|
48
40
|
const theme = useTheme();
|
|
49
41
|
|
|
@@ -70,31 +62,35 @@ export default function UserBox({
|
|
|
70
62
|
alignItems={"center"}
|
|
71
63
|
justifyContent={"space-between"}
|
|
72
64
|
>
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<Stack>
|
|
79
|
-
<
|
|
80
|
-
|
|
65
|
+
{avatar && (
|
|
66
|
+
<Stack direction={"row"} gap={1}>
|
|
67
|
+
<StyledAvatar src={profileUrl ?? ""} sx={profileSx}>
|
|
68
|
+
{getStartingLetters(fullName)}
|
|
69
|
+
</StyledAvatar>
|
|
70
|
+
<Stack direction={"row"} justifyContent={"space-between"}>
|
|
71
|
+
<Stack>
|
|
72
|
+
<Typography variant="subtitle3">{fullName}</Typography>
|
|
73
|
+
<Typography variant="caption">{designation}</Typography>
|
|
74
|
+
</Stack>
|
|
81
75
|
</Stack>
|
|
82
76
|
</Stack>
|
|
83
|
-
|
|
84
|
-
<Icons.NavigationIcon />
|
|
77
|
+
)}
|
|
78
|
+
{navigationIcon && <Icons.NavigationIcon />}
|
|
85
79
|
</Stack>
|
|
86
80
|
</Stack>
|
|
87
81
|
}
|
|
88
82
|
onClick={() => alert("Action 1 clicked")}
|
|
89
83
|
/>,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
showActiveDevices && (
|
|
85
|
+
<DropdownMenuItem
|
|
86
|
+
label={
|
|
87
|
+
<Stack gap={0.5}>
|
|
88
|
+
<Typography variant="subtitle3">Active Devices</Typography>
|
|
89
|
+
</Stack>
|
|
90
|
+
}
|
|
91
|
+
onClick={() => alert("Action 1 clicked")}
|
|
92
|
+
/>
|
|
93
|
+
),
|
|
98
94
|
<DropdownMenuItem
|
|
99
95
|
label={
|
|
100
96
|
<Stack
|
|
@@ -104,7 +100,6 @@ export default function UserBox({
|
|
|
104
100
|
width={"100%"}
|
|
105
101
|
>
|
|
106
102
|
<Typography variant="subtitle3">Logout</Typography>
|
|
107
|
-
|
|
108
103
|
<Icons.LogoutIcon hoverColor={theme.palette.highlight.main} />
|
|
109
104
|
</Stack>
|
|
110
105
|
}
|
package/src/components/export.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export * from "./DataDisplay/
|
|
1
|
+
export * from "./DataDisplay/export";
|
|
2
2
|
export * from "./Icons/export";
|
|
3
|
-
export * from "./Input/
|
|
4
|
-
export * from "./Input/SingleSelect/SingleSelect";
|
|
5
|
-
export * from "./Input/Switch/Switch";
|
|
6
|
-
export * from "./Input/TextField/TextField";
|
|
3
|
+
export * from "./Input/export";
|
|
7
4
|
export * from "./Layout/Header/AppHeader";
|
|
8
5
|
export * from "./Layout/Header/AppLogo";
|
|
9
6
|
export * from "./Layout/Header/AppsMenu";
|