@sikka/hawa 0.0.31 → 0.0.34
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/README.md +0 -1
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/rollup.config.js +2 -2
- package/src/blocks/AuthForms/NewPasswordForm.js +4 -0
- package/src/blocks/AuthForms/ResetPasswordForm.js +6 -2
- package/src/blocks/AuthForms/SignUpForm.js +7 -28
- package/src/blocks/Payment/ChargeWalletForm.js +18 -8
- package/src/blocks/Payment/Confirmation.js +3 -0
- package/src/blocks/Payment/CreditCardForm.js +0 -23
- package/src/blocks/Pricing/PricingPlans.js +3 -0
- package/src/blocks/Pricing/index.js +1 -0
- package/src/blocks/index.js +4 -0
- package/src/elements/HawaPopMenu.js +6 -2
- package/src/elements/HawaPricingCard.js +18 -1
- package/src/elements/HawaRange.js +9 -4
- package/src/elements/HawaTextField.js +6 -2
- package/src/index.js +1 -3
- package/src/layout/HawaAppBar.js +37 -64
- package/src/layout/HawaAppLayout.js +32 -14
- package/src/layout/HawaPageControls.js +61 -0
- package/src/layout/index.js +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.e9b7f5c4.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.a7262b49.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.6c796c97.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.4bd34158.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.6c796c97.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.6c796c97.iframe.bundle.js.map +0 -1
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import babel from "rollup-plugin-babel";
|
|
2
1
|
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
3
|
+
import babel from "rollup-plugin-babel";
|
|
3
4
|
import external from "rollup-plugin-peer-deps-external";
|
|
4
5
|
import { terser } from "rollup-plugin-terser";
|
|
5
6
|
import postcss from "rollup-plugin-postcss";
|
|
6
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
7
7
|
|
|
8
8
|
export default [
|
|
9
9
|
{
|
|
@@ -112,5 +112,9 @@ NewPasswordForm.propTypes = {
|
|
|
112
112
|
forgotPasswordText: PropTypes.string,
|
|
113
113
|
passwordChanged: PropTypes.string
|
|
114
114
|
}),
|
|
115
|
+
/**
|
|
116
|
+
* A boolean to replace the form with a success message
|
|
117
|
+
*/
|
|
118
|
+
passwordChanged: PropTypes.bool,
|
|
115
119
|
handleNewPassword: PropTypes.func
|
|
116
120
|
};
|
|
@@ -53,7 +53,7 @@ export const ResetPasswordForm = (props) => {
|
|
|
53
53
|
</form>
|
|
54
54
|
) : (
|
|
55
55
|
<HawaTypography style={{ textAlign: "center", margin: 5 }}>
|
|
56
|
-
{props.emailSentText}
|
|
56
|
+
{props.texts.emailSentText}
|
|
57
57
|
</HawaTypography>
|
|
58
58
|
)}
|
|
59
59
|
</Container>
|
|
@@ -68,8 +68,12 @@ ResetPasswordForm.propTypes = {
|
|
|
68
68
|
emailPlaceholder: PropTypes.string,
|
|
69
69
|
emailRequiredText: PropTypes.string,
|
|
70
70
|
emailInvalidText: PropTypes.string,
|
|
71
|
+
emailSentText: PropTypes.string,
|
|
71
72
|
resetPassword: PropTypes.string
|
|
72
73
|
}),
|
|
73
|
-
|
|
74
|
+
/**
|
|
75
|
+
* a boolean to replace the form with a success message
|
|
76
|
+
*/
|
|
77
|
+
sent: PropTypes.bool,
|
|
74
78
|
handleResetPassword: PropTypes.func
|
|
75
79
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { HawaTextField, HawaLogoButton } from "../../elements";
|
|
2
|
+
import { HawaTextField, HawaLogoButton, HawaAlert } from "../../elements";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Controller, FormProvider, useForm } from "react-hook-form";
|
|
5
5
|
import PersonIcon from "@mui/icons-material/PermIdentityOutlined";
|
|
@@ -10,8 +10,6 @@ import Container from "@mui/material/Container";
|
|
|
10
10
|
import Divider from "@mui/material/Divider";
|
|
11
11
|
import Typography from "@mui/material/Typography";
|
|
12
12
|
import Button from "@mui/material/Button";
|
|
13
|
-
import Alert from "@mui/material/Alert";
|
|
14
|
-
import AlertTitle from "@mui/material/AlertTitle";
|
|
15
13
|
|
|
16
14
|
export const SignUpForm = (props) => {
|
|
17
15
|
const methods = useForm();
|
|
@@ -27,11 +25,12 @@ export const SignUpForm = (props) => {
|
|
|
27
25
|
variant="auth"
|
|
28
26
|
style={{ direction: props.lang === "ar" ? "rtl" : "ltr" }}
|
|
29
27
|
>
|
|
30
|
-
{props.
|
|
31
|
-
<
|
|
32
|
-
{props.errorTitle
|
|
33
|
-
{props.errorText}
|
|
34
|
-
|
|
28
|
+
{props.showError && (
|
|
29
|
+
<HawaAlert
|
|
30
|
+
title={props.errorTitle}
|
|
31
|
+
text={props.errorText}
|
|
32
|
+
severity="error"
|
|
33
|
+
/>
|
|
35
34
|
)}
|
|
36
35
|
|
|
37
36
|
<FormProvider {...methods}>
|
|
@@ -163,26 +162,6 @@ export const SignUpForm = (props) => {
|
|
|
163
162
|
);
|
|
164
163
|
};
|
|
165
164
|
|
|
166
|
-
// fullNameLabel: "Full Name",
|
|
167
|
-
// fullNamePlaceholder: "Fulan AlFulani",
|
|
168
|
-
// fullNameRequiredText: "Full Name is required",
|
|
169
|
-
// emailLabel: "Email",
|
|
170
|
-
// emailPlaceholder: "Enter your email",
|
|
171
|
-
// emailRequiredText: "Email is required",
|
|
172
|
-
// emailInvalidText: "Invalid email address",
|
|
173
|
-
// passwordLabel: "Password",
|
|
174
|
-
// passwordPlaceholder: "Minimum 8 characters",
|
|
175
|
-
// passwordRequiredText: "Password is required",
|
|
176
|
-
// passwordTooShortText: "Password too short",
|
|
177
|
-
// forgotPasswordText: "Forgot password?",
|
|
178
|
-
// newUserText: "New user?",
|
|
179
|
-
// signUpText: "Sign up",
|
|
180
|
-
// signInText: "Sign in",
|
|
181
|
-
// existingUserText: "Existing User?",
|
|
182
|
-
// googleButtonLabel: "Sign in with Google",
|
|
183
|
-
// githubButtonLabel: "Sign in with Github",
|
|
184
|
-
// twitterButtonLabel: "Sign in with Twitter"
|
|
185
|
-
|
|
186
165
|
SignUpForm.propTypes = {
|
|
187
166
|
/**
|
|
188
167
|
* An object of all the texts in the blocks
|
|
@@ -48,16 +48,15 @@ export const ChargeWalletForm = (props) => {
|
|
|
48
48
|
field.onChange(parseFloat(e.target.value));
|
|
49
49
|
setWalletAmount(e.target.value);
|
|
50
50
|
}}
|
|
51
|
+
helperText={errors.amount?.message}
|
|
51
52
|
/>
|
|
52
53
|
)}
|
|
54
|
+
rules={{
|
|
55
|
+
required: props.texts.amountRequired
|
|
56
|
+
}}
|
|
53
57
|
/>
|
|
54
58
|
|
|
55
|
-
<Button
|
|
56
|
-
type="submit"
|
|
57
|
-
fullWidth
|
|
58
|
-
variant="last"
|
|
59
|
-
onClick={props.handleSignIn}
|
|
60
|
-
>
|
|
59
|
+
<Button type="submit" fullWidth variant="last">
|
|
61
60
|
{props.texts.chargeWallet}
|
|
62
61
|
</Button>
|
|
63
62
|
</form>
|
|
@@ -67,9 +66,20 @@ export const ChargeWalletForm = (props) => {
|
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
ChargeWalletForm.propTypes = {
|
|
69
|
+
/**
|
|
70
|
+
* The texts object for all the texts in the block
|
|
71
|
+
*/
|
|
70
72
|
texts: PropTypes.shape({
|
|
71
73
|
amountLabel: PropTypes.string,
|
|
72
|
-
chargeWallet: PropTypes.string
|
|
74
|
+
chargeWallet: PropTypes.string,
|
|
75
|
+
amountRequired: PropTypes.string
|
|
73
76
|
}),
|
|
74
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Function called when charge wallet button is clicked
|
|
79
|
+
*/
|
|
80
|
+
handleChargeWallet: PropTypes.func,
|
|
81
|
+
/**
|
|
82
|
+
* The currency text under the amount
|
|
83
|
+
*/
|
|
84
|
+
currency: PropTypes.string
|
|
75
85
|
};
|
|
@@ -21,19 +21,12 @@ export const CreditCardForm = (props) => {
|
|
|
21
21
|
placeholder="Enter password"
|
|
22
22
|
type="tel"
|
|
23
23
|
label="Card Number"
|
|
24
|
-
// variant="unscrollable"
|
|
25
|
-
// startAdornment={
|
|
26
|
-
// <InputAdornment position="start">
|
|
27
|
-
// <PasswordIcon />
|
|
28
|
-
// </InputAdornment>
|
|
29
|
-
// }
|
|
30
24
|
rules={{
|
|
31
25
|
required: "Password is rquired"
|
|
32
26
|
}}
|
|
33
27
|
helperText={errors.password?.message}
|
|
34
28
|
/>
|
|
35
29
|
|
|
36
|
-
|
|
37
30
|
<Controller
|
|
38
31
|
control={control}
|
|
39
32
|
name="cardName"
|
|
@@ -44,11 +37,6 @@ export const CreditCardForm = (props) => {
|
|
|
44
37
|
placeholder="Enter password"
|
|
45
38
|
type="password"
|
|
46
39
|
label="Name On Card"
|
|
47
|
-
// startAdornment={
|
|
48
|
-
// <InputAdornment position="start">
|
|
49
|
-
// <PasswordIcon />
|
|
50
|
-
// </InputAdornment>
|
|
51
|
-
// }
|
|
52
40
|
rules={{
|
|
53
41
|
required: "Password is rquired"
|
|
54
42
|
}}
|
|
@@ -66,11 +54,6 @@ export const CreditCardForm = (props) => {
|
|
|
66
54
|
placeholder="Enter password"
|
|
67
55
|
type="password"
|
|
68
56
|
label="Expiry Date"
|
|
69
|
-
// startAdornment={
|
|
70
|
-
// <InputAdornment position="start">
|
|
71
|
-
// <PasswordIcon />
|
|
72
|
-
// </InputAdornment>
|
|
73
|
-
// }
|
|
74
57
|
rules={{
|
|
75
58
|
required: "Password is rquired"
|
|
76
59
|
}}
|
|
@@ -88,11 +71,6 @@ export const CreditCardForm = (props) => {
|
|
|
88
71
|
placeholder="Enter password"
|
|
89
72
|
type="password"
|
|
90
73
|
label="CCV"
|
|
91
|
-
// startAdornment={
|
|
92
|
-
// <InputAdornment position="start">
|
|
93
|
-
// <PasswordIcon />
|
|
94
|
-
// </InputAdornment>
|
|
95
|
-
// }
|
|
96
74
|
rules={{
|
|
97
75
|
required: "Password is rquired"
|
|
98
76
|
}}
|
|
@@ -107,7 +85,6 @@ export const CreditCardForm = (props) => {
|
|
|
107
85
|
variant="last"
|
|
108
86
|
onClick={props.handlePayWithCreditCard}
|
|
109
87
|
>
|
|
110
|
-
{/* {props.texts.signInText} */}
|
|
111
88
|
{"Pay with Credit Card"}
|
|
112
89
|
</Button>
|
|
113
90
|
</form>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PricingPlans";
|
|
@@ -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) => {
|
|
@@ -31,7 +34,7 @@ export const HawaPopMenu = (props) => {
|
|
|
31
34
|
{props.menuItems.map((item) => (
|
|
32
35
|
<MenuItem key={item.label} onClick={item.action}>
|
|
33
36
|
{item.icon && <item.icon />}
|
|
34
|
-
<div style={{ width: 10 }} />
|
|
37
|
+
{item.icon && <div style={{ width: 10 }} />}
|
|
35
38
|
<Typography textAlign="center">{item.label}</Typography>
|
|
36
39
|
</MenuItem>
|
|
37
40
|
))}
|
|
@@ -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({
|
|
@@ -4,6 +4,7 @@ import Button from "@mui/material/Button";
|
|
|
4
4
|
import Typography from "@mui/material/Typography";
|
|
5
5
|
import CheckIcon from "@mui/icons-material/CheckCircleOutlined";
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
|
+
import Chip from "@mui/material/Chip";
|
|
7
8
|
|
|
8
9
|
export const HawaPricingCard = (props) => {
|
|
9
10
|
let isArabic = props.lang === "ar";
|
|
@@ -24,6 +25,7 @@ export const HawaPricingCard = (props) => {
|
|
|
24
25
|
sar: isArabic ? "ريال" : "SAR"
|
|
25
26
|
};
|
|
26
27
|
let featuresMapping = isArabic ? props.features_ar : props.features;
|
|
28
|
+
let chipSpacing = isArabic ? { left: 10 } : { right: 10 };
|
|
27
29
|
return (
|
|
28
30
|
<Container
|
|
29
31
|
maxWidth="xs"
|
|
@@ -31,6 +33,19 @@ export const HawaPricingCard = (props) => {
|
|
|
31
33
|
style={{ direction: isArabic ? "rtl" : "ltr" }}
|
|
32
34
|
>
|
|
33
35
|
<Container variant="plan-header">
|
|
36
|
+
{props.discount && (
|
|
37
|
+
<Chip
|
|
38
|
+
label={props.discount}
|
|
39
|
+
variant="standard"
|
|
40
|
+
style={{
|
|
41
|
+
maxWidth: "fit-content",
|
|
42
|
+
position: "absolute",
|
|
43
|
+
bottom: 10,
|
|
44
|
+
...chipSpacing
|
|
45
|
+
}}
|
|
46
|
+
color="success"
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
34
49
|
<Typography variant="h3" fontWeight={500}>
|
|
35
50
|
{isArabic ? props.title_ar : props.title}
|
|
36
51
|
</Typography>
|
|
@@ -144,5 +159,7 @@ HawaPricingCard.propTypes = {
|
|
|
144
159
|
subtitle: PropTypes.string,
|
|
145
160
|
subtitle_ar: PropTypes.string,
|
|
146
161
|
features: PropTypes.array,
|
|
147
|
-
features_ar: PropTypes.array
|
|
162
|
+
features_ar: PropTypes.array,
|
|
163
|
+
currency: PropTypes.oneOf(["sar", "usd"]),
|
|
164
|
+
cycleText: PropTypes.oneOf(["monthly", "3-months", "6-months", "annually"])
|
|
148
165
|
};
|
|
@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
|
|
6
6
|
export const HawaRange = (props) => {
|
|
7
7
|
return (
|
|
8
|
-
<Stack spacing={2} direction="row" alignItems="center">
|
|
8
|
+
<Stack spacing={2} direction="row" alignItems="center" style={props.style}>
|
|
9
9
|
{props.startElement}
|
|
10
10
|
<Slider
|
|
11
11
|
size="small"
|
|
@@ -18,9 +18,14 @@ export const HawaRange = (props) => {
|
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
20
|
HawaRange.propTypes = {
|
|
21
|
+
/**
|
|
22
|
+
* The element at the side where the range value is 0
|
|
23
|
+
* Can be an icon
|
|
24
|
+
*/
|
|
21
25
|
startElement: PropTypes.element,
|
|
26
|
+
/**
|
|
27
|
+
* The element at the side where the range value is 100
|
|
28
|
+
*/
|
|
22
29
|
endElement: PropTypes.element,
|
|
23
|
-
|
|
24
|
-
handleChange: PropTypes.func,
|
|
25
|
-
location: PropTypes.string
|
|
30
|
+
handleChange: PropTypes.func
|
|
26
31
|
};
|
|
@@ -16,9 +16,13 @@ export const HawaTextField = (props) => {
|
|
|
16
16
|
}}
|
|
17
17
|
>
|
|
18
18
|
{props.label && <InputLabel>{props.label}</InputLabel>}
|
|
19
|
-
|
|
20
19
|
{props.helperText && (
|
|
21
|
-
<Typography
|
|
20
|
+
<Typography
|
|
21
|
+
style={{ marginBottom: !props.label && 10 }}
|
|
22
|
+
variant="validation"
|
|
23
|
+
>
|
|
24
|
+
{props.helperText}
|
|
25
|
+
</Typography>
|
|
22
26
|
)}
|
|
23
27
|
</div>
|
|
24
28
|
<Input disableUnderline {...props} />
|
package/src/index.js
CHANGED
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,8 +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
19
|
|
|
22
20
|
const drawerWidth = 240;
|
|
23
21
|
|
|
@@ -36,16 +34,16 @@ const closedMixin = (theme) => ({
|
|
|
36
34
|
duration: theme.transitions.duration.leavingScreen
|
|
37
35
|
}),
|
|
38
36
|
overflowX: "hidden",
|
|
39
|
-
width: `calc(${theme.spacing(
|
|
37
|
+
width: `calc(${theme.spacing(8)} + 1px)`,
|
|
40
38
|
[theme.breakpoints.up("sm")]: {
|
|
41
39
|
width: `calc(${theme.spacing(8)} + 1px)`
|
|
42
40
|
}
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
const DrawerHeader = styled("div")(({ theme }) => ({
|
|
43
|
+
const DrawerHeader = styled("div")(({ theme, direction }) => ({
|
|
46
44
|
display: "flex",
|
|
47
45
|
alignItems: "center",
|
|
48
|
-
justifyContent: "flex-end",
|
|
46
|
+
justifyContent: direction === "rtl" ? "flex-start" : "flex-end",
|
|
49
47
|
padding: theme.spacing(0, 1),
|
|
50
48
|
// necessary for content to be below app bar
|
|
51
49
|
...theme.mixins.toolbar
|
|
@@ -53,14 +51,16 @@ const DrawerHeader = styled("div")(({ theme }) => ({
|
|
|
53
51
|
|
|
54
52
|
const AppBar = styled(MuiAppBar, {
|
|
55
53
|
shouldForwardProp: (prop) => prop !== "open"
|
|
56
|
-
})(({ theme, open }) => ({
|
|
54
|
+
})(({ theme, open, direction }) => ({
|
|
57
55
|
zIndex: theme.zIndex.drawer + 1,
|
|
58
56
|
transition: theme.transitions.create(["width", "margin"], {
|
|
59
57
|
easing: theme.transitions.easing.sharp,
|
|
60
58
|
duration: theme.transitions.duration.leavingScreen
|
|
61
59
|
}),
|
|
60
|
+
|
|
62
61
|
...(open && {
|
|
63
|
-
marginLeft: drawerWidth,
|
|
62
|
+
marginLeft: direction === "rtl" ? 0 : drawerWidth,
|
|
63
|
+
marginRight: direction === "rtl" ? drawerWidth : 0,
|
|
64
64
|
width: `calc(100% - ${drawerWidth}px)`,
|
|
65
65
|
transition: theme.transitions.create(["width", "margin"], {
|
|
66
66
|
easing: theme.transitions.easing.sharp,
|
|
@@ -89,7 +89,7 @@ const Drawer = styled(MuiDrawer, {
|
|
|
89
89
|
export function HawaAppLayout(props) {
|
|
90
90
|
const theme = useTheme();
|
|
91
91
|
const [open, setOpen] = React.useState(true);
|
|
92
|
-
|
|
92
|
+
const isArabic = props.lang === "ar";
|
|
93
93
|
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
94
94
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
|
95
95
|
|
|
@@ -101,14 +101,23 @@ export function HawaAppLayout(props) {
|
|
|
101
101
|
const handleDrawerClose = () => setOpen(false);
|
|
102
102
|
|
|
103
103
|
return (
|
|
104
|
-
<Box sx={{ display: "flex" }}>
|
|
105
|
-
<AppBar
|
|
106
|
-
|
|
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 } }}
|
|
114
|
+
>
|
|
107
115
|
<IconButton
|
|
108
116
|
color="inherit"
|
|
109
117
|
aria-label="open drawer"
|
|
110
118
|
onClick={handleDrawerOpen}
|
|
111
119
|
edge="start"
|
|
120
|
+
s
|
|
112
121
|
sx={{
|
|
113
122
|
marginRight: 5,
|
|
114
123
|
...(open && { display: "none" })
|
|
@@ -134,7 +143,11 @@ export function HawaAppLayout(props) {
|
|
|
134
143
|
|
|
135
144
|
<Box>
|
|
136
145
|
<Tooltip title="Open settings">
|
|
137
|
-
<IconButton
|
|
146
|
+
<IconButton
|
|
147
|
+
onClick={handleOpenUserMenu}
|
|
148
|
+
sx={{ p: 0 }}
|
|
149
|
+
size="small"
|
|
150
|
+
>
|
|
138
151
|
<Avatar />
|
|
139
152
|
</IconButton>
|
|
140
153
|
</Tooltip>
|
|
@@ -147,8 +160,13 @@ export function HawaAppLayout(props) {
|
|
|
147
160
|
</div>
|
|
148
161
|
</Toolbar>
|
|
149
162
|
</AppBar>
|
|
150
|
-
<Drawer
|
|
151
|
-
|
|
163
|
+
<Drawer
|
|
164
|
+
// anchor="left"
|
|
165
|
+
|
|
166
|
+
variant="permanent"
|
|
167
|
+
open={open}
|
|
168
|
+
>
|
|
169
|
+
<DrawerHeader direction={isArabic ? "rtl" : "ltr"}>
|
|
152
170
|
{props.logo}
|
|
153
171
|
<IconButton onClick={handleDrawerClose}>
|
|
154
172
|
{theme.direction === "rtl" ? (
|