@sikka/hawa 0.0.35 → 0.0.38

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 (71) hide show
  1. package/.github/workflows/hawa-publish-push.yml +2 -1
  2. package/README.md +11 -0
  3. package/es/index.es.js +1 -1
  4. package/lib/index.js +1 -1
  5. package/package.json +10 -9
  6. package/src/elements/DragDropImages.js +55 -72
  7. package/src/elements/HawaSelectInput.js +30 -0
  8. package/src/elements/HawaSnackbar.js +35 -3
  9. package/src/elements/PinInput.js +141 -0
  10. package/src/index.js +1 -0
  11. package/src/layout/HawaAppLayout.js +197 -173
  12. package/src/layout/HawaAppLayout2.js +260 -0
  13. package/src/styles.css +4 -0
  14. package/src/styles.scss +3 -1
  15. package/src/theme/HawaTheme.js +921 -0
  16. package/src/theme/index.js +2 -0
  17. package/src/util.js +11 -1
  18. package/storybook-static/0.a2c13f8ca8477800b11f.manager.bundle.js +2 -0
  19. package/storybook-static/{0.0d994c92.iframe.bundle.js.LICENSE.txt → 0.a2c13f8ca8477800b11f.manager.bundle.js.LICENSE.txt} +0 -0
  20. package/storybook-static/0.d94b248f.iframe.bundle.js +3 -0
  21. package/storybook-static/{4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt → 0.d94b248f.iframe.bundle.js.LICENSE.txt} +0 -0
  22. package/storybook-static/0.d94b248f.iframe.bundle.js.map +1 -0
  23. package/storybook-static/1.37f89487.iframe.bundle.js +1 -0
  24. package/storybook-static/1.d522251f2377f7751924.manager.bundle.js +1 -0
  25. package/storybook-static/{2.430bf1e3.iframe.bundle.js → 2.89943a03.iframe.bundle.js} +1 -1
  26. package/storybook-static/5.a331b0a36ded1c541923.manager.bundle.js +2 -0
  27. package/storybook-static/5.a331b0a36ded1c541923.manager.bundle.js.LICENSE.txt +31 -0
  28. package/storybook-static/6.3a1fb0c3.iframe.bundle.js +3 -0
  29. package/storybook-static/6.3a1fb0c3.iframe.bundle.js.LICENSE.txt +31 -0
  30. package/storybook-static/6.3a1fb0c3.iframe.bundle.js.map +1 -0
  31. package/storybook-static/6.aee6c4935c69d480fc0d.manager.bundle.js +1 -0
  32. package/storybook-static/7.5b8a4de4b5fa42d8de02.manager.bundle.js +1 -0
  33. package/storybook-static/7.f33530b1.iframe.bundle.js +1 -0
  34. package/storybook-static/8.a3dec9c37e8951a17939.manager.bundle.js +2 -0
  35. package/storybook-static/{6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt → 8.a3dec9c37e8951a17939.manager.bundle.js.LICENSE.txt} +0 -0
  36. package/storybook-static/8.b569e86b.iframe.bundle.js +1 -0
  37. package/storybook-static/{8.76c3cbf398692028e834.manager.bundle.js → 9.d04fdaada645cd23cb4b.manager.bundle.js} +1 -1
  38. package/storybook-static/9.f9db5c90.iframe.bundle.js +3 -0
  39. package/storybook-static/{7.9ce807e3.iframe.bundle.js.LICENSE.txt → 9.f9db5c90.iframe.bundle.js.LICENSE.txt} +0 -0
  40. package/storybook-static/9.f9db5c90.iframe.bundle.js.map +1 -0
  41. package/storybook-static/iframe.html +19 -3
  42. package/storybook-static/index.html +2 -2
  43. package/storybook-static/main.2a7fa838.iframe.bundle.js +1 -0
  44. package/storybook-static/main.750dea0e0e515fd26844.manager.bundle.js +1 -0
  45. package/storybook-static/project.json +1 -0
  46. package/storybook-static/runtime~main.1bd817501fb34a0cb56b.manager.bundle.js +1 -0
  47. package/storybook-static/runtime~main.9be73be4.iframe.bundle.js +1 -0
  48. package/storybook-static/vendors~main.826e89a1.iframe.bundle.js +76 -0
  49. package/storybook-static/{vendors~main.07e1611f.iframe.bundle.js.LICENSE.txt → vendors~main.826e89a1.iframe.bundle.js.LICENSE.txt} +15 -0
  50. package/storybook-static/vendors~main.826e89a1.iframe.bundle.js.map +1 -0
  51. package/storybook-static/vendors~main.ed8bc18573e141ab3b26.manager.bundle.js +2 -0
  52. package/storybook-static/{vendors~main.11281b487bf96f5ff19e.manager.bundle.js.LICENSE.txt → vendors~main.ed8bc18573e141ab3b26.manager.bundle.js.LICENSE.txt} +18 -18
  53. package/storybook-static/0.0d994c92.iframe.bundle.js +0 -3
  54. package/storybook-static/0.0d994c92.iframe.bundle.js.map +0 -1
  55. package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +0 -1
  56. package/storybook-static/1.aabc3f3a.iframe.bundle.js +0 -1
  57. package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +0 -2
  58. package/storybook-static/5.63ab4f94d50a3acf080d.manager.bundle.js +0 -1
  59. package/storybook-static/6.13a534cb.iframe.bundle.js +0 -1
  60. package/storybook-static/6.a6d45262f7e98f3f18d3.manager.bundle.js +0 -2
  61. package/storybook-static/7.097710753af9a1c41b80.manager.bundle.js +0 -1
  62. package/storybook-static/7.9ce807e3.iframe.bundle.js +0 -3
  63. package/storybook-static/7.9ce807e3.iframe.bundle.js.map +0 -1
  64. package/storybook-static/8.1bf48ea7.iframe.bundle.js +0 -1
  65. package/storybook-static/main.6eab4ef6.iframe.bundle.js +0 -1
  66. package/storybook-static/main.9d5968bcf15d21f5487c.manager.bundle.js +0 -1
  67. package/storybook-static/runtime~main.708d7ac1.iframe.bundle.js +0 -1
  68. package/storybook-static/runtime~main.c8dac23bc753439736f0.manager.bundle.js +0 -1
  69. package/storybook-static/vendors~main.07e1611f.iframe.bundle.js +0 -76
  70. package/storybook-static/vendors~main.07e1611f.iframe.bundle.js.map +0 -1
  71. package/storybook-static/vendors~main.11281b487bf96f5ff19e.manager.bundle.js +0 -2
@@ -0,0 +1,30 @@
1
+ import Select from "react-select";
2
+ import Creatable from "react-select/creatable";
3
+
4
+ export default function HawaSelectInput(props) {
5
+ return (
6
+ <>
7
+ {!props.isCreatable && (
8
+ <Select
9
+ options={props.options}
10
+ isClearable={props.isClearable}
11
+ isMulti={props.isMulti}
12
+ isSearchable={props.isSearchable}
13
+ onChange={(newValue, action) => props.onChange(newValue, action)}
14
+ />
15
+ )}
16
+ {props.isCreatable && (
17
+ <Creatable
18
+ options={props.options}
19
+ isClearable={props.isClearable}
20
+ isMulti={props.isMulti}
21
+ isSearchable={props.isSearchable}
22
+ onChange={(newValue, action) => props.onChange(newValue, action)}
23
+ onInputChange={(newValue, action) =>
24
+ props.onInputChange(newValue, action)
25
+ }
26
+ />
27
+ )}
28
+ </>
29
+ );
30
+ }
@@ -1,12 +1,44 @@
1
- import React from "react";
1
+ import React, { useEffect, useState } from "react";
2
2
  import Snackbar from "@mui/material/Snackbar";
3
3
  import AlertTitle from "@mui/material/AlertTitle";
4
4
  import Alert from "@mui/material/Alert";
5
+ import { IconButton } from "@mui/material";
6
+ import CloseIcon from "@mui/icons-material/Close";
5
7
 
6
8
  export const HawaSnackbar = (props) => {
9
+ const [position, setPosition] = useState({ vertical: "", horizontal: "" });
10
+
11
+ useEffect(() => {
12
+ if (props.position) {
13
+ const p = props.position.split("-");
14
+ setPosition({ vertical: p[0], horizontal: p[1] });
15
+ }
16
+ }, [props.position]);
17
+
7
18
  return (
8
- <Snackbar open={props.open} onClose={props.handleClose}>
9
- <Alert icon={false} severity={props.severity}>
19
+ <Snackbar
20
+ open={props.open}
21
+ autoHideDuration={props.autoHide ? props.duration : null}
22
+ onClose={props.handleClose}
23
+ anchorOrigin={position}
24
+ action={
25
+ <>
26
+ <IconButton
27
+ aria-label="close"
28
+ style={{ color: "black" }}
29
+ sx={{ p: 0.5 }}
30
+ onClick={props.handleClose}
31
+ >
32
+ <CloseIcon />
33
+ </IconButton>
34
+ </>
35
+ }
36
+ >
37
+ <Alert
38
+ icon={false}
39
+ severity={props.severity}
40
+ onClose={props.isClosable ? props.handleClose : null}
41
+ >
10
42
  {props.title && <AlertTitle>{props.title}</AlertTitle>}
11
43
  {props.text}
12
44
  </Alert>
@@ -0,0 +1,141 @@
1
+ import {
2
+ Input,
3
+ makeStyles,
4
+ TextField,
5
+ InputLabel,
6
+ Typography,
7
+ Stack
8
+ } from "@mui/material";
9
+ import { object } from "prop-types";
10
+ import React, { useEffect, useState } from "react";
11
+ import { replaceAt } from "../util";
12
+
13
+ export const HawaPinInput = ({
14
+ children,
15
+ type,
16
+ defaultValue,
17
+ onChange,
18
+ onComplete,
19
+ ...props
20
+ }) => {
21
+ const [value, setValue] = useState(
22
+ defaultValue ? defaultValue.split("") : []
23
+ );
24
+ const [pinLength, setPinLength] = useState(0);
25
+
26
+ useEffect(() => {
27
+ let length = 0;
28
+ React.Children.map(children, (child) => {
29
+ if (
30
+ React.isValidElement(child) &&
31
+ child.type?.displayName &&
32
+ child.type?.displayName === "HawaPinInputField"
33
+ ) {
34
+ length++;
35
+ }
36
+ });
37
+ setPinLength(length);
38
+ }, []);
39
+
40
+ const childrenWithProps = React.Children.map(children, (child, index) => {
41
+ if (React.isValidElement(child)) {
42
+ if (
43
+ child.type?.displayName &&
44
+ child.type?.displayName === "HawaPinInputField" &&
45
+ defaultValue &&
46
+ defaultValue[index]
47
+ ) {
48
+ return React.cloneElement(child, {
49
+ type,
50
+ defaultValue: defaultValue[index],
51
+ index: index,
52
+ setValue: setValue,
53
+ value: value,
54
+ onChangeAction: (currentValue) => onChange(currentValue),
55
+ onCompleteAction: (finalValue) => onComplete(finalValue),
56
+ pinLength: pinLength
57
+ });
58
+ }
59
+ return React.cloneElement(child, {
60
+ type,
61
+ setValue: setValue,
62
+ value: value,
63
+ index: index,
64
+ onChangeAction: (currentValue) => onChange(currentValue),
65
+ onCompleteAction: (finalValue) => onComplete(finalValue),
66
+ pinLength: pinLength
67
+ });
68
+ }
69
+ return child;
70
+ });
71
+
72
+ useEffect(() => {
73
+ if (value.length === pinLength) {
74
+ onComplete(value);
75
+ }
76
+ }, [value]);
77
+
78
+ return (
79
+ <div style={props.inForm && { width: "100%" }}>
80
+ <div style={{ width: props.fullWidth ? "100%" : "fit-content" }}>
81
+ <div
82
+ style={{
83
+ display: "flex",
84
+ flexDirection: "row",
85
+ justifyContent: "space-between",
86
+ alignItems: "center"
87
+ }}
88
+ >
89
+ {props.label && <InputLabel>{props.label}</InputLabel>}
90
+ {props.helperText && (
91
+ <Typography
92
+ style={{ marginBottom: !props.label && 10 }}
93
+ variant="validation"
94
+ >
95
+ {props.helperText}
96
+ </Typography>
97
+ )}
98
+ </div>
99
+ <Stack
100
+ direction={"row"}
101
+ spacing={2}
102
+ justifyContent="center"
103
+ alignItems={"center"}
104
+ >
105
+ {childrenWithProps}
106
+ </Stack>
107
+ </div>
108
+ </div>
109
+ );
110
+ };
111
+
112
+ export const HawaPinInputField = (props) => {
113
+ return (
114
+ <Input
115
+ type={props.type && props.type == "alphanumeric" ? "text" : "number"}
116
+ id={"pinInput" + props.index}
117
+ defaultValue={props.defaultValue || ""}
118
+ variant="pin"
119
+ disableUnderline
120
+ inputProps={{ maxLength: 1 }}
121
+ onChange={(e) => {
122
+ let newValue = props.value;
123
+ newValue[props.index] = e.target.value;
124
+ props.setValue(newValue);
125
+ props.onChangeAction(newValue.toString().replaceAll(",", ""));
126
+ if (
127
+ parseInt(e.target.attributes["maxlength"].value) >= 1 &&
128
+ e.target.value != ""
129
+ ) {
130
+ let i = document.getElementById("pinInput" + (props.index + 1));
131
+ if (i) {
132
+ i.focus();
133
+ }
134
+ }
135
+ if (props.value.length === props.pinLength) {
136
+ props.onCompleteAction(props.value.toString().replaceAll(",", ""));
137
+ }
138
+ }}
139
+ />
140
+ );
141
+ };
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./blocks";
2
2
  export * from "./elements";
3
3
  export * from "./layout";
4
+ export * from "./theme";
@@ -1,7 +1,8 @@
1
- import React from "react";
1
+ import * as React from "react";
2
2
  import { styled, useTheme } from "@mui/material/styles";
3
3
  import Box from "@mui/material/Box";
4
- import MuiDrawer from "@mui/material/Drawer";
4
+ import Drawer from "@mui/material/Drawer";
5
+ import CssBaseline from "@mui/material/CssBaseline";
5
6
  import MuiAppBar from "@mui/material/AppBar";
6
7
  import Toolbar from "@mui/material/Toolbar";
7
8
  import List from "@mui/material/List";
@@ -11,211 +12,234 @@ import IconButton from "@mui/material/IconButton";
11
12
  import MenuIcon from "@mui/icons-material/Menu";
12
13
  import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
13
14
  import ChevronRightIcon from "@mui/icons-material/ChevronRight";
14
- import ListItemButton from "@mui/material/ListItemButton";
15
+ import ListItem from "@mui/material/ListItem";
16
+ import ListItemIcon from "@mui/material/ListItemIcon";
15
17
  import ListItemText from "@mui/material/ListItemText";
16
- import Avatar from "@mui/material/Avatar";
17
- import Tooltip from "@mui/material/Tooltip";
18
- import { HawaPopMenu } from "../elements/HawaPopMenu";
18
+ import InboxIcon from "@mui/icons-material/MoveToInbox";
19
+ import MailIcon from "@mui/icons-material/Mail";
19
20
 
20
21
  const drawerWidth = 240;
21
22
 
22
- const openedMixin = (theme) => ({
23
- width: drawerWidth,
24
- transition: theme.transitions.create("width", {
25
- easing: theme.transitions.easing.sharp,
26
- duration: theme.transitions.duration.enteringScreen
27
- }),
28
- overflowX: "hidden"
29
- });
30
-
31
- const closedMixin = (theme) => ({
32
- transition: theme.transitions.create("width", {
33
- easing: theme.transitions.easing.sharp,
34
- duration: theme.transitions.duration.leavingScreen
35
- }),
36
- overflowX: "hidden",
37
- width: `calc(${theme.spacing(8)} + 1px)`,
38
- [theme.breakpoints.up("sm")]: {
39
- width: `calc(${theme.spacing(8)} + 1px)`
40
- }
41
- });
42
-
43
- const DrawerHeader = styled("div")(({ theme, direction }) => ({
44
- display: "flex",
45
- alignItems: "center",
46
- justifyContent: direction === "rtl" ? "flex-start" : "flex-end",
47
- padding: theme.spacing(0, 1),
48
- // necessary for content to be below app bar
49
- ...theme.mixins.toolbar
50
- }));
23
+ const Main = styled("main", { shouldForwardProp: (prop) => prop !== "open" })(
24
+ ({ theme, open, direction }) => ({
25
+ flexGrow: 1,
26
+ padding: theme.spacing(3),
27
+ transition: theme.transitions.create("margin", {
28
+ easing: theme.transitions.easing.sharp,
29
+ duration: theme.transitions.duration.leavingScreen
30
+ }),
31
+ marginLeft: direction === "rtl" ? 0 : `-${drawerWidth}px`,
32
+ marginRight: direction === "rtl" ? `-${drawerWidth}px` : 0,
33
+ ...(open && {
34
+ transition: theme.transitions.create("margin", {
35
+ easing: theme.transitions.easing.easeOut,
36
+ duration: theme.transitions.duration.enteringScreen
37
+ }),
38
+ marginLeft: direction === "ltr" && 0,
39
+ marginRight: direction === "rtl" && 0
40
+ })
41
+ })
42
+ );
51
43
 
52
44
  const AppBar = styled(MuiAppBar, {
53
45
  shouldForwardProp: (prop) => prop !== "open"
54
46
  })(({ theme, open, direction }) => ({
55
- zIndex: theme.zIndex.drawer + 1,
56
- transition: theme.transitions.create(["width", "margin"], {
47
+ transition: theme.transitions.create(["margin", "width"], {
57
48
  easing: theme.transitions.easing.sharp,
58
49
  duration: theme.transitions.duration.leavingScreen
59
50
  }),
60
-
61
51
  ...(open && {
62
- marginLeft: direction === "rtl" ? 0 : drawerWidth,
63
- marginRight: direction === "rtl" ? drawerWidth : 0,
64
52
  width: `calc(100% - ${drawerWidth}px)`,
65
- transition: theme.transitions.create(["width", "margin"], {
66
- easing: theme.transitions.easing.sharp,
53
+ marginLeft: direction === "rtl" ? 0 : `${drawerWidth}px`,
54
+ marginRight: direction === "rtl" ? `${drawerWidth}px` : 0,
55
+ // marginLeft: `${drawerWidth}px`,
56
+ transition: theme.transitions.create(["margin", "width"], {
57
+ easing: theme.transitions.easing.easeOut,
67
58
  duration: theme.transitions.duration.enteringScreen
68
59
  })
69
60
  })
70
61
  }));
71
62
 
72
- const Drawer = styled(MuiDrawer, {
73
- shouldForwardProp: (prop) => prop !== "open"
74
- })(({ theme, open }) => ({
75
- width: drawerWidth,
76
- flexShrink: 0,
77
- whiteSpace: "nowrap",
78
- boxSizing: "border-box",
79
- ...(open && {
80
- ...openedMixin(theme),
81
- "& .MuiDrawer-paper": openedMixin(theme)
82
- }),
83
- ...(!open && {
84
- ...closedMixin(theme),
85
- "& .MuiDrawer-paper": closedMixin(theme)
86
- })
63
+ const DrawerHeader = styled("div")(({ theme }) => ({
64
+ display: "flex",
65
+ alignItems: "center",
66
+ padding: theme.spacing(0, 1),
67
+ // necessary for content to be below app bar
68
+ ...theme.mixins.toolbar,
69
+ justifyContent: "flex-end"
87
70
  }));
88
71
 
89
- export function HawaAppLayout(props) {
72
+ export const HawaAppLayout = (props) => {
90
73
  const theme = useTheme();
91
- const [open, setOpen] = React.useState(true);
74
+ const [open, setOpen] = React.useState(false);
92
75
  const isArabic = props.lang === "ar";
93
- const [anchorElNav, setAnchorElNav] = React.useState(null);
94
- const [anchorElUser, setAnchorElUser] = React.useState(null);
76
+ const handleDrawerOpen = () => {
77
+ setOpen(true);
78
+ };
95
79
 
96
- const handleOpenNavMenu = (event) => setAnchorElNav(event.currentTarget);
97
- const handleOpenUserMenu = (event) => setAnchorElUser(event.currentTarget);
98
- const handleCloseNavMenu = () => setAnchorElNav(null);
99
- const handleCloseUserMenu = () => setAnchorElUser(null);
100
- const handleDrawerOpen = () => setOpen(true);
101
- const handleDrawerClose = () => setOpen(false);
80
+ const handleDrawerClose = () => {
81
+ setOpen(false);
82
+ };
102
83
 
103
84
  return (
104
- <Box sx={{ display: "flex", direction: isArabic ? "rtl" : "ltr" }}>
85
+ <Box sx={{ display: "flex" }}>
86
+ <CssBaseline />
105
87
  <AppBar
106
- variant="appbar"
107
88
  position="fixed"
108
89
  open={open}
109
90
  direction={isArabic ? "rtl" : "ltr"}
91
+ style={{
92
+ alignItems: isArabic ? "flex-end" : "flex-start",
93
+ justifyContent: "center"
94
+ }}
110
95
  >
111
- <Toolbar
112
- variant="appbar"
113
- sx={{ paddingLeft: { xs: 3 }, paddingRight: { xs: 3 } }}
114
- >
115
- <IconButton
116
- color="inherit"
117
- aria-label="open drawer"
118
- onClick={handleDrawerOpen}
119
- edge="start"
120
- s
96
+ <Toolbar>
97
+ {isArabic ? (
98
+ <>
99
+ <Typography variant="h6" noWrap component="div">
100
+ Persistent drawer
101
+ </Typography>
102
+ <IconButton
103
+ color="inherit"
104
+ aria-label="open drawer"
105
+ onClick={handleDrawerOpen}
106
+ edge={isArabic ? "end" : "start"}
107
+ sx={{ mr: 2, ...(open && { display: "none" }) }}
108
+ >
109
+ <MenuIcon />
110
+ </IconButton>
111
+ </>
112
+ ) : (
113
+ <>
114
+ <IconButton
115
+ color="inherit"
116
+ aria-label="open drawer"
117
+ onClick={handleDrawerOpen}
118
+ edge={isArabic ? "end" : "start"}
119
+ sx={{
120
+ marginRight: isArabic ? 0 : 2,
121
+ marginLeft: isArabic ? 2 : 0,
122
+ ...(open && { display: "none" })
123
+ }}
124
+ >
125
+ <MenuIcon />
126
+ </IconButton>
127
+ <Typography variant="h6" noWrap component="div">
128
+ Persistent drawer
129
+ </Typography>
130
+ </>
131
+ )}
132
+ </Toolbar>
133
+ </AppBar>
134
+ {!isArabic ? (
135
+ <>
136
+ <Drawer
121
137
  sx={{
122
- marginRight: 5,
123
- ...(open && { display: "none" })
138
+ width: drawerWidth,
139
+ flexShrink: 0,
140
+ "& .MuiDrawer-paper": {
141
+ width: drawerWidth,
142
+ boxSizing: "border-box"
143
+ }
124
144
  }}
145
+ variant="persistent"
146
+ anchor={isArabic ? "right" : "left"}
147
+ open={open}
125
148
  >
126
- <MenuIcon />
127
- </IconButton>
128
-
129
- <div
130
- style={{
131
- // backgroundColor: "red",
132
- display: "flex",
133
- flexDirection: "row",
134
- justifyContent: "space-between",
135
- alignItems: "center",
136
- width: "100%",
137
- margin: 0
149
+ <DrawerHeader>
150
+ <IconButton onClick={handleDrawerClose}>
151
+ {theme.direction === "ltr" ? (
152
+ <ChevronLeftIcon />
153
+ ) : (
154
+ <ChevronRightIcon />
155
+ )}
156
+ </IconButton>
157
+ </DrawerHeader>
158
+ <Divider />
159
+ <List>
160
+ {["Inbox", "Starred", "Send email", "Drafts"].map(
161
+ (text, index) => (
162
+ <ListItem button key={text}>
163
+ <ListItemIcon>
164
+ {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
165
+ </ListItemIcon>
166
+ <ListItemText primary={text} />
167
+ </ListItem>
168
+ )
169
+ )}
170
+ </List>
171
+ <Divider />
172
+ <List>
173
+ {["All mail", "Trash", "Spam"].map((text, index) => (
174
+ <ListItem button key={text}>
175
+ <ListItemIcon>
176
+ {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
177
+ </ListItemIcon>
178
+ <ListItemText primary={text} />
179
+ </ListItem>
180
+ ))}
181
+ </List>
182
+ </Drawer>
183
+ <Main open={open} direction={isArabic ? "rtl" : "ltr"}>
184
+ <DrawerHeader />
185
+ {props.children}
186
+ </Main>
187
+ </>
188
+ ) : (
189
+ <>
190
+ <Main open={open} direction={isArabic ? "rtl" : "ltr"}>
191
+ <DrawerHeader />
192
+ {props.children}
193
+ </Main>
194
+ <Drawer
195
+ sx={{
196
+ width: drawerWidth,
197
+ flexShrink: 0,
198
+ "& .MuiDrawer-paper": {
199
+ width: drawerWidth,
200
+ boxSizing: "border-box"
201
+ }
138
202
  }}
203
+ variant="persistent"
204
+ anchor={isArabic ? "right" : "left"}
205
+ open={open}
139
206
  >
140
- <Typography variant="h6" noWrap component="div">
141
- {props.pageTitle}
142
- </Typography>
143
-
144
- <Box>
145
- <Tooltip title="Open settings">
146
- <IconButton
147
- onClick={handleOpenUserMenu}
148
- sx={{ p: 0 }}
149
- size="small"
150
- >
151
- <Avatar />
152
- </IconButton>
153
- </Tooltip>
154
- <HawaPopMenu
155
- menuItems={props.accountMenu}
156
- anchor={anchorElUser}
157
- handleClose={handleCloseUserMenu}
158
- />
159
- </Box>
160
- </div>
161
- </Toolbar>
162
- </AppBar>
163
- <Drawer
164
- // anchor="left"
165
-
166
- variant="permanent"
167
- open={open}
168
- >
169
- <DrawerHeader direction={isArabic ? "rtl" : "ltr"}>
170
- {props.logo}
171
- <IconButton onClick={handleDrawerClose}>
172
- {theme.direction === "rtl" ? (
173
- <ChevronRightIcon />
174
- ) : (
175
- <ChevronLeftIcon />
176
- )}
177
- </IconButton>
178
- </DrawerHeader>
179
- <Divider />
180
- <List>
181
- {props.pages.map((p, jk) => {
182
- return (
183
- <Tooltip
184
- title={p.text}
185
- key={jk}
186
- placement={"right"}
187
- arrow={true}
188
- PopperProps={{ style: { opacity: open ? 0 : 1 } }}
189
- >
190
- <ListItemButton
191
- variant={
192
- props.pageName?.toLowerCase() === p.slug?.toLowerCase() &&
193
- "clicked"
194
- }
195
- onClick={p.action}
196
- key={p.text}
197
- sx={{
198
- minHeight: 48,
199
- justifyContent: open ? "initial" : "center",
200
- px: 2.5
201
- }}
202
- >
203
- <p.icon />
204
- <div style={{ width: 20 }} />
205
- <ListItemText
206
- primary={p.text}
207
- sx={{ opacity: open ? 1 : 0 }}
208
- />
209
- </ListItemButton>
210
- </Tooltip>
211
- );
212
- })}
213
- </List>
214
- </Drawer>
215
- <Box sx={{ flexGrow: 1, p: 3 }}>
216
- <DrawerHeader />
217
- {props.children}
218
- </Box>
207
+ <DrawerHeader>
208
+ <IconButton onClick={handleDrawerClose}>
209
+ {theme.direction === "ltr" ? (
210
+ <ChevronLeftIcon />
211
+ ) : (
212
+ <ChevronRightIcon />
213
+ )}
214
+ </IconButton>
215
+ </DrawerHeader>
216
+ <Divider />
217
+ <List>
218
+ {["Inbox", "Starred", "Send email", "Drafts"].map(
219
+ (text, index) => (
220
+ <ListItem button key={text}>
221
+ <ListItemIcon>
222
+ {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
223
+ </ListItemIcon>
224
+ <ListItemText primary={text} />
225
+ </ListItem>
226
+ )
227
+ )}
228
+ </List>
229
+ <Divider />
230
+ <List>
231
+ {["All mail", "Trash", "Spam"].map((text, index) => (
232
+ <ListItem button key={text}>
233
+ <ListItemIcon>
234
+ {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
235
+ </ListItemIcon>
236
+ <ListItemText primary={text} />
237
+ </ListItem>
238
+ ))}
239
+ </List>
240
+ </Drawer>
241
+ </>
242
+ )}
219
243
  </Box>
220
244
  );
221
- }
245
+ };