@sikka/hawa 0.0.32 → 0.0.33
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/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/elements/HawaPopMenu.js +5 -1
- package/src/layout/HawaAppBar.js +37 -64
- package/src/layout/HawaAppLayout.js +31 -29
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.2511f65a.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.a7262b49.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.924b4d3c.iframe.bundle.js.LICENSE.txt → vendors~main.a7262b49.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.a7262b49.iframe.bundle.js.map +1 -0
- package/storybook-static/main.c86d0451.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.924b4d3c.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.924b4d3c.iframe.bundle.js.map +0 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
import Typography from "@mui/material/Typography";
|
|
3
|
+
import Menu from "@mui/material/Menu";
|
|
4
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
2
5
|
import PropTypes from "prop-types";
|
|
3
6
|
|
|
4
7
|
export const HawaPopMenu = (props) => {
|
|
@@ -40,6 +43,7 @@ export const HawaPopMenu = (props) => {
|
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
HawaPopMenu.propTypes = {
|
|
46
|
+
anchor: PropTypes.any,
|
|
43
47
|
handleClose: PropTypes.func,
|
|
44
48
|
menuItems: PropTypes.arrayOf(
|
|
45
49
|
PropTypes.shape({
|
package/src/layout/HawaAppBar.js
CHANGED
|
@@ -3,105 +3,62 @@ import AppBar from "@mui/material/AppBar";
|
|
|
3
3
|
import Box from "@mui/material/Box";
|
|
4
4
|
import Toolbar from "@mui/material/Toolbar";
|
|
5
5
|
import IconButton from "@mui/material/IconButton";
|
|
6
|
-
import Typography from "@mui/material/Typography";
|
|
7
|
-
import Menu from "@mui/material/Menu";
|
|
8
6
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
9
7
|
import Container from "@mui/material/Container";
|
|
10
8
|
import Avatar from "@mui/material/Avatar";
|
|
11
9
|
import Button from "@mui/material/Button";
|
|
12
10
|
import Tooltip from "@mui/material/Tooltip";
|
|
13
|
-
import MenuItem from "@mui/material/MenuItem";
|
|
14
11
|
import { useTheme } from "@mui/material";
|
|
15
12
|
import { HawaPopMenu } from "../elements/HawaPopMenu";
|
|
16
|
-
|
|
17
|
-
const pages = ["Products", "Pricing", "Blog"];
|
|
18
|
-
const settings = ["Profile", "Account", "Dashboard", "Logout"];
|
|
13
|
+
import PropTypes from "prop-types";
|
|
19
14
|
|
|
20
15
|
export const HawaAppBar = (props) => {
|
|
21
16
|
const theme = useTheme();
|
|
22
17
|
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
23
18
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
|
24
19
|
|
|
25
|
-
const handleOpenNavMenu = (event) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
setAnchorElUser(event.currentTarget);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const handleCloseNavMenu = () => {
|
|
33
|
-
setAnchorElNav(null);
|
|
34
|
-
};
|
|
20
|
+
const handleOpenNavMenu = (event) => setAnchorElNav(event.currentTarget);
|
|
21
|
+
const handleOpenUserMenu = (event) => setAnchorElUser(event.currentTarget);
|
|
22
|
+
const handleCloseNavMenu = () => setAnchorElNav(null);
|
|
23
|
+
const handleCloseUserMenu = () => setAnchorElUser(null);
|
|
35
24
|
|
|
36
|
-
const handleCloseUserMenu = () => {
|
|
37
|
-
setAnchorElUser(null);
|
|
38
|
-
};
|
|
39
25
|
console.log("theme is ", theme);
|
|
40
26
|
return (
|
|
41
27
|
<AppBar position="static" variant="appbar">
|
|
42
|
-
<Container
|
|
28
|
+
<Container variant="appbar">
|
|
43
29
|
<Toolbar disableGutters>
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
component="div"
|
|
48
|
-
sx={{ mr: 2, display: { xs: "none", md: "flex" } }}
|
|
49
|
-
>
|
|
50
|
-
LOGO
|
|
51
|
-
</Typography>
|
|
52
|
-
|
|
30
|
+
<Box sx={{ flexGrow: 1, display: { xs: "none", md: "flex" } }}>
|
|
31
|
+
{props.logo}
|
|
32
|
+
</Box>
|
|
53
33
|
<Box sx={{ flexGrow: 1, display: { xs: "flex", md: "none" } }}>
|
|
54
34
|
<IconButton
|
|
55
35
|
size="large"
|
|
56
36
|
aria-label="account of current user"
|
|
57
37
|
aria-controls="menu-appbar"
|
|
58
38
|
aria-haspopup="true"
|
|
59
|
-
onClick={
|
|
39
|
+
onClick={handleOpenNavMenu}
|
|
60
40
|
color="inherit"
|
|
61
41
|
>
|
|
62
42
|
<MenuIcon />
|
|
63
43
|
</IconButton>
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
vertical: "top",
|
|
74
|
-
horizontal: "left"
|
|
75
|
-
}}
|
|
76
|
-
open={Boolean(anchorElNav)}
|
|
77
|
-
onClose={handleCloseNavMenu}
|
|
78
|
-
sx={{
|
|
79
|
-
display: { xs: "block", md: "none" }
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
{pages.map((page) => (
|
|
83
|
-
<MenuItem key={page} onClick={handleCloseNavMenu}>
|
|
84
|
-
<Typography textAlign="center">{page}</Typography>
|
|
85
|
-
</MenuItem>
|
|
86
|
-
))}
|
|
87
|
-
</Menu>
|
|
44
|
+
<HawaPopMenu
|
|
45
|
+
anchor={anchorElNav}
|
|
46
|
+
handleClose={handleCloseNavMenu}
|
|
47
|
+
menuItems={props.pages}
|
|
48
|
+
/>
|
|
49
|
+
</Box>
|
|
50
|
+
|
|
51
|
+
<Box sx={{ flexGrow: 1, display: { xs: "flex", md: "none" } }}>
|
|
52
|
+
{props.logo}
|
|
88
53
|
</Box>
|
|
89
|
-
<Typography
|
|
90
|
-
variant="h6"
|
|
91
|
-
noWrap
|
|
92
|
-
component="div"
|
|
93
|
-
sx={{ flexGrow: 1, display: { xs: "flex", md: "none" } }}
|
|
94
|
-
>
|
|
95
|
-
LOGO
|
|
96
|
-
</Typography>
|
|
97
54
|
<Box sx={{ flexGrow: 1, display: { xs: "none", md: "flex" } }}>
|
|
98
|
-
{pages.map((page) => (
|
|
55
|
+
{props.pages.map((page) => (
|
|
99
56
|
<Button
|
|
100
57
|
key={page}
|
|
101
58
|
onClick={handleCloseNavMenu}
|
|
102
59
|
sx={{ my: 2, display: "block" }}
|
|
103
60
|
>
|
|
104
|
-
{page}
|
|
61
|
+
{page.label}
|
|
105
62
|
</Button>
|
|
106
63
|
))}
|
|
107
64
|
</Box>
|
|
@@ -123,3 +80,19 @@ export const HawaAppBar = (props) => {
|
|
|
123
80
|
</AppBar>
|
|
124
81
|
);
|
|
125
82
|
};
|
|
83
|
+
HawaAppBar.propTypes = {
|
|
84
|
+
pages: PropTypes.arrayOf(
|
|
85
|
+
PropTypes.shape({
|
|
86
|
+
icon: PropTypes.element,
|
|
87
|
+
label: PropTypes.string,
|
|
88
|
+
action: PropTypes.func
|
|
89
|
+
})
|
|
90
|
+
),
|
|
91
|
+
accountMenu: PropTypes.arrayOf(
|
|
92
|
+
PropTypes.shape({
|
|
93
|
+
icon: PropTypes.element,
|
|
94
|
+
label: PropTypes.string,
|
|
95
|
+
action: PropTypes.func
|
|
96
|
+
})
|
|
97
|
+
)
|
|
98
|
+
};
|
|
@@ -16,10 +16,6 @@ import ListItemText from "@mui/material/ListItemText";
|
|
|
16
16
|
import Avatar from "@mui/material/Avatar";
|
|
17
17
|
import Tooltip from "@mui/material/Tooltip";
|
|
18
18
|
import { HawaPopMenu } from "../elements/HawaPopMenu";
|
|
19
|
-
// use this to detect size and change things accordingly
|
|
20
|
-
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
21
|
-
import { BottomNavigation, BottomNavigationAction } from "@mui/material";
|
|
22
|
-
import { RestoreOutlined } from "@mui/icons-material";
|
|
23
19
|
|
|
24
20
|
const drawerWidth = 240;
|
|
25
21
|
|
|
@@ -44,10 +40,10 @@ const closedMixin = (theme) => ({
|
|
|
44
40
|
}
|
|
45
41
|
});
|
|
46
42
|
|
|
47
|
-
const DrawerHeader = styled("div")(({ theme }) => ({
|
|
43
|
+
const DrawerHeader = styled("div")(({ theme, direction }) => ({
|
|
48
44
|
display: "flex",
|
|
49
45
|
alignItems: "center",
|
|
50
|
-
justifyContent: "flex-end",
|
|
46
|
+
justifyContent: direction === "rtl" ? "flex-start" : "flex-end",
|
|
51
47
|
padding: theme.spacing(0, 1),
|
|
52
48
|
// necessary for content to be below app bar
|
|
53
49
|
...theme.mixins.toolbar
|
|
@@ -55,14 +51,16 @@ const DrawerHeader = styled("div")(({ theme }) => ({
|
|
|
55
51
|
|
|
56
52
|
const AppBar = styled(MuiAppBar, {
|
|
57
53
|
shouldForwardProp: (prop) => prop !== "open"
|
|
58
|
-
})(({ theme, open }) => ({
|
|
54
|
+
})(({ theme, open, direction }) => ({
|
|
59
55
|
zIndex: theme.zIndex.drawer + 1,
|
|
60
56
|
transition: theme.transitions.create(["width", "margin"], {
|
|
61
57
|
easing: theme.transitions.easing.sharp,
|
|
62
58
|
duration: theme.transitions.duration.leavingScreen
|
|
63
59
|
}),
|
|
60
|
+
|
|
64
61
|
...(open && {
|
|
65
|
-
marginLeft: drawerWidth,
|
|
62
|
+
marginLeft: direction === "rtl" ? 0 : drawerWidth,
|
|
63
|
+
marginRight: direction === "rtl" ? drawerWidth : 0,
|
|
66
64
|
width: `calc(100% - ${drawerWidth}px)`,
|
|
67
65
|
transition: theme.transitions.create(["width", "margin"], {
|
|
68
66
|
easing: theme.transitions.easing.sharp,
|
|
@@ -91,11 +89,10 @@ const Drawer = styled(MuiDrawer, {
|
|
|
91
89
|
export function HawaAppLayout(props) {
|
|
92
90
|
const theme = useTheme();
|
|
93
91
|
const [open, setOpen] = React.useState(true);
|
|
94
|
-
const
|
|
95
|
-
|
|
92
|
+
const isArabic = props.lang === "ar";
|
|
96
93
|
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
97
94
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
|
98
|
-
|
|
95
|
+
|
|
99
96
|
const handleOpenNavMenu = (event) => setAnchorElNav(event.currentTarget);
|
|
100
97
|
const handleOpenUserMenu = (event) => setAnchorElUser(event.currentTarget);
|
|
101
98
|
const handleCloseNavMenu = () => setAnchorElNav(null);
|
|
@@ -104,27 +101,23 @@ export function HawaAppLayout(props) {
|
|
|
104
101
|
const handleDrawerClose = () => setOpen(false);
|
|
105
102
|
|
|
106
103
|
return (
|
|
107
|
-
<Box sx={{ display: "flex" }}>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
<Box sx={{ display: "flex", direction: isArabic ? "rtl" : "ltr" }}>
|
|
105
|
+
<AppBar
|
|
106
|
+
variant="appbar"
|
|
107
|
+
position="fixed"
|
|
108
|
+
open={open}
|
|
109
|
+
direction={isArabic ? "rtl" : "ltr"}
|
|
110
|
+
>
|
|
111
|
+
<Toolbar
|
|
112
|
+
variant="appbar"
|
|
113
|
+
sx={{ paddingLeft: { xs: 3 }, paddingRight: { xs: 3 } }}
|
|
115
114
|
>
|
|
116
|
-
<BottomNavigationAction label="Recents" icon={<RestoreOutlined />} />
|
|
117
|
-
<BottomNavigationAction label="Favorites" icon={<RestoreOutlined />} />
|
|
118
|
-
<BottomNavigationAction label="Nearby" icon={<RestoreOutlined />} />
|
|
119
|
-
</BottomNavigation>
|
|
120
|
-
)}{" "}
|
|
121
|
-
<AppBar variant="appbar" position="fixed" open={open}>
|
|
122
|
-
<Toolbar variant="appbar">
|
|
123
115
|
<IconButton
|
|
124
116
|
color="inherit"
|
|
125
117
|
aria-label="open drawer"
|
|
126
118
|
onClick={handleDrawerOpen}
|
|
127
119
|
edge="start"
|
|
120
|
+
s
|
|
128
121
|
sx={{
|
|
129
122
|
marginRight: 5,
|
|
130
123
|
...(open && { display: "none" })
|
|
@@ -150,7 +143,11 @@ export function HawaAppLayout(props) {
|
|
|
150
143
|
|
|
151
144
|
<Box>
|
|
152
145
|
<Tooltip title="Open settings">
|
|
153
|
-
<IconButton
|
|
146
|
+
<IconButton
|
|
147
|
+
onClick={handleOpenUserMenu}
|
|
148
|
+
sx={{ p: 0 }}
|
|
149
|
+
size="small"
|
|
150
|
+
>
|
|
154
151
|
<Avatar />
|
|
155
152
|
</IconButton>
|
|
156
153
|
</Tooltip>
|
|
@@ -163,8 +160,13 @@ export function HawaAppLayout(props) {
|
|
|
163
160
|
</div>
|
|
164
161
|
</Toolbar>
|
|
165
162
|
</AppBar>
|
|
166
|
-
<Drawer
|
|
167
|
-
|
|
163
|
+
<Drawer
|
|
164
|
+
// anchor="left"
|
|
165
|
+
|
|
166
|
+
variant="permanent"
|
|
167
|
+
open={open}
|
|
168
|
+
>
|
|
169
|
+
<DrawerHeader direction={isArabic ? "rtl" : "ltr"}>
|
|
168
170
|
{props.logo}
|
|
169
171
|
<IconButton onClick={handleDrawerClose}>
|
|
170
172
|
{theme.direction === "rtl" ? (
|
|
@@ -345,4 +345,4 @@
|
|
|
345
345
|
|
|
346
346
|
|
|
347
347
|
|
|
348
|
-
window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.
|
|
348
|
+
window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.708d7ac1.iframe.bundle.js"></script><script src="vendors~main.a7262b49.iframe.bundle.js"></script><script src="main.2511f65a.iframe.bundle.js"></script></body></html>
|