@sikka/hawa 0.0.14 → 0.0.17
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/.github/workflows/hawa-publish-push.yml +1 -0
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/Account/UserProfileForm.js +79 -43
- package/src/blocks/Account/UserSettingsForm.js +7 -2
- package/src/blocks/AuthForms/NewPasswordForm.js +57 -38
- package/src/blocks/AuthForms/ResetPasswordForm.js +36 -39
- package/src/blocks/AuthForms/SignInForm.js +76 -59
- package/src/blocks/AuthForms/SignUpForm.js +65 -44
- package/src/blocks/Payment/ChargeWalletForm.js +29 -20
- package/src/blocks/Pricing/PricingPlans.js +19 -9
- package/src/elements/HawaAlert.js +1 -24
- package/src/elements/HawaAppBar.js +139 -0
- package/src/elements/HawaListItem.js +21 -0
- package/src/elements/HawaPricingCard.js +40 -22
- package/src/elements/HawaTextField.js +15 -149
- package/src/elements/HawaTypography.js +0 -19
- package/src/elements/OfflineBanner.js +19 -0
- package/src/elements/index.js +3 -0
- package/src/layout/HawaAppLayout.js +246 -0
- package/src/layout/index.js +1 -0
- package/storybook-static/{0.f47eb24a4893a96ec307.manager.bundle.js → 0.42b12e88e2d7c13fc83c.manager.bundle.js} +1 -1
- package/storybook-static/{4.0fcda1281dc1961dbe94.manager.bundle.js → 4.6efb4495a449edfbd0b0.manager.bundle.js} +2 -2
- package/storybook-static/{4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt → 4.6efb4495a449edfbd0b0.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/{5.63ab4f94d50a3acf080d.manager.bundle.js → 5.fdf5c7287259585b43a3.manager.bundle.js} +1 -1
- package/storybook-static/{6.a6d45262f7e98f3f18d3.manager.bundle.js → 6.8f7b9049856bdace5643.manager.bundle.js} +2 -2
- package/storybook-static/{6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt → 6.8f7b9049856bdace5643.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/{6.704d1e8d.iframe.bundle.js → 6.f7101198.iframe.bundle.js} +0 -0
- package/storybook-static/{7.097710753af9a1c41b80.manager.bundle.js → 7.dfc01154563c92ef9ccf.manager.bundle.js} +1 -1
- package/storybook-static/{8.76c3cbf398692028e834.manager.bundle.js → 8.c1928a9f13347c159613.manager.bundle.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/main.d9e1c87c8c22202eed3c.manager.bundle.js +1 -0
- package/storybook-static/main.fb3876e0.iframe.bundle.js +1 -0
- package/storybook-static/{runtime~main.c8dac23bc753439736f0.manager.bundle.js → runtime~main.1373976137528887a7ad.manager.bundle.js} +1 -1
- package/storybook-static/{runtime~main.f1ebae9b.iframe.bundle.js → runtime~main.1430538c.iframe.bundle.js} +1 -1
- package/storybook-static/vendors~main.3f680c6a.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.5eab66d3.iframe.bundle.js.LICENSE.txt → vendors~main.3f680c6a.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.3f680c6a.iframe.bundle.js.map +1 -0
- package/storybook-static/vendors~main.41b22d5a0c6132a028f1.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.a697e07137d366f95f76.manager.bundle.js.LICENSE.txt → vendors~main.41b22d5a0c6132a028f1.manager.bundle.js.LICENSE.txt} +0 -0
- package/src/stories/BlocksStories/Account/UserProfile.stories.js +0 -21
- package/src/stories/BlocksStories/Account/UserSettings.stories.js +0 -55
- package/src/stories/BlocksStories/Auth/NewPassword.stories.js +0 -60
- package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +0 -59
- package/src/stories/BlocksStories/Auth/SignIn.stories.js +0 -89
- package/src/stories/BlocksStories/Auth/SignUp.stories.js +0 -90
- package/src/stories/BlocksStories/Payment/ChargeWallet.stories.js +0 -30
- package/src/stories/BlocksStories/Payment/PayWithCreditCard.stories.js +0 -37
- package/src/stories/BlocksStories/Payment/PayWithWallet.stories.js +0 -17
- package/src/stories/BlocksStories/Payment/PaymentSelection.stories.js +0 -60
- package/src/stories/BlocksStories/Pricing/BillingPlans.stories.js +0 -46
- package/src/stories/BlocksStories/Pricing/LandingPlans.stories.js +0 -45
- package/src/stories/ElementsStories/AdaptiveButton.stories.js +0 -51
- package/src/stories/ElementsStories/Alert.stories.js +0 -41
- package/src/stories/ElementsStories/InputLabel.stories.js +0 -13
- package/src/stories/ElementsStories/ItemCard.stories.js +0 -18
- package/src/stories/ElementsStories/LogoButtons.stories.js +0 -73
- package/src/stories/ElementsStories/PricingCard.stories.js +0 -91
- package/src/stories/ElementsStories/RadioSelector.stories.js +0 -36
- package/src/stories/ElementsStories/SettingsRow.stories.js +0 -63
- package/src/stories/ElementsStories/TextField.stories.js +0 -49
- package/src/stories/Introduction.stories.mdx +0 -229
- package/src/stories/LayoutStories/Box.stories.js +0 -36
- package/storybook-static/main.ac6e4b72b033097dad76.manager.bundle.js +0 -1
- package/storybook-static/main.e382d866.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.a697e07137d366f95f76.manager.bundle.js +0 -2
|
@@ -3,27 +3,42 @@ import Container from "@mui/material/Container";
|
|
|
3
3
|
import { Button, Typography } from "@mui/material";
|
|
4
4
|
import CheckIcon from "@mui/icons-material/CheckCircleOutlined";
|
|
5
5
|
export const HawaPricingCard = (props) => {
|
|
6
|
+
let isArabic = props.lang === "ar";
|
|
7
|
+
let cycleTextsArabic = {
|
|
8
|
+
monthly: "شهرياً",
|
|
9
|
+
"3-months": "كل 3 أشهر",
|
|
10
|
+
"6-months": "كل 6 أشهر",
|
|
11
|
+
annually: "سنوياً"
|
|
12
|
+
};
|
|
13
|
+
let cycleTextsEnglish = {
|
|
14
|
+
monthly: "Monthly",
|
|
15
|
+
"3-months": "3 Months",
|
|
16
|
+
"6-months": "6 Months",
|
|
17
|
+
annually: "Annually"
|
|
18
|
+
};
|
|
19
|
+
let currencyMapping = {
|
|
20
|
+
usd: isArabic ? "دولار" : "$",
|
|
21
|
+
sar: isArabic ? "ريال" : "SAR"
|
|
22
|
+
};
|
|
23
|
+
let featuresMapping = isArabic ? props.features_ar : props.features;
|
|
6
24
|
return (
|
|
7
25
|
<Container
|
|
8
26
|
maxWidth="xs"
|
|
9
27
|
variant={props.selectedPlan ? "selected-plan-card" : "plan-card"}
|
|
10
|
-
style={{ direction:
|
|
28
|
+
style={{ direction: isArabic ? "rtl" : "ltr" }}
|
|
11
29
|
>
|
|
12
30
|
<Container variant="plan-header">
|
|
13
31
|
<Typography variant="h3" fontWeight={500}>
|
|
14
|
-
{props.title}
|
|
32
|
+
{isArabic ? props.title_ar : props.title}
|
|
33
|
+
</Typography>
|
|
34
|
+
<Typography variant="caption">
|
|
35
|
+
{isArabic ? props.subtitle_ar : props.subtitle}
|
|
15
36
|
</Typography>
|
|
16
|
-
<Typography variant="caption">{props.subtitle}</Typography>
|
|
17
37
|
<br />
|
|
18
38
|
<Typography
|
|
19
39
|
variant="h4"
|
|
20
40
|
fontWeight={500}
|
|
21
|
-
style={{
|
|
22
|
-
display: "flex",
|
|
23
|
-
// flexDirection: "column",
|
|
24
|
-
alignItems: "center"
|
|
25
|
-
// justifyContent: props.lang === "ar" ? "" : "center"
|
|
26
|
-
}}
|
|
41
|
+
style={{ display: "flex", alignItems: "center" }}
|
|
27
42
|
>
|
|
28
43
|
{props.lang === "ar" ? (
|
|
29
44
|
<div
|
|
@@ -32,16 +47,20 @@ export const HawaPricingCard = (props) => {
|
|
|
32
47
|
display: "flex",
|
|
33
48
|
flexDirection: "column",
|
|
34
49
|
justifyContent: "center"
|
|
35
|
-
// alignItems: "center"
|
|
36
50
|
}}
|
|
37
51
|
>
|
|
38
52
|
<div style={{ display: "flex", flexDirection: "row" }}>
|
|
39
53
|
{props.price}
|
|
40
54
|
<div style={{ width: 5 }} />
|
|
41
|
-
<Typography>{props.currency}</Typography>
|
|
55
|
+
{/* <Typography>{props.currency?.toUpperCase()}</Typography> */}
|
|
56
|
+
<Typography>
|
|
57
|
+
{currencyMapping[props.currency?.toLowerCase()]}
|
|
58
|
+
</Typography>
|
|
42
59
|
</div>
|
|
43
60
|
<Typography style={{ fontSize: 14, margin: 5 }}>
|
|
44
|
-
{
|
|
61
|
+
{isArabic
|
|
62
|
+
? cycleTextsArabic[props.cycleText]
|
|
63
|
+
: cycleTextsEnglish[props.cycleText]}
|
|
45
64
|
</Typography>
|
|
46
65
|
</div>
|
|
47
66
|
) : (
|
|
@@ -51,32 +70,30 @@ export const HawaPricingCard = (props) => {
|
|
|
51
70
|
display: "flex",
|
|
52
71
|
flexDirection: "column",
|
|
53
72
|
justifyContent: "center"
|
|
54
|
-
// alignItems: "center"
|
|
55
73
|
}}
|
|
56
74
|
>
|
|
57
75
|
<div style={{ display: "flex", flexDirection: "row" }}>
|
|
58
|
-
<Typography>
|
|
76
|
+
<Typography>
|
|
77
|
+
{currencyMapping[props.currency?.toLowerCase()]}
|
|
78
|
+
</Typography>
|
|
79
|
+
{/* <Typography>{props.currency?.toUpperCase()}</Typography> */}
|
|
59
80
|
<div style={{ width: 5 }} />
|
|
60
81
|
{props.price}
|
|
61
82
|
</div>
|
|
62
83
|
<Typography style={{ fontSize: 14, margin: 5 }}>
|
|
63
|
-
{props.
|
|
84
|
+
{props.lang === "ar"
|
|
85
|
+
? cycleTextsArabic[props.cycleText]
|
|
86
|
+
: cycleTextsEnglish[props.cycleText]}
|
|
64
87
|
</Typography>
|
|
65
88
|
</div>
|
|
66
89
|
)}
|
|
67
|
-
{/* {props.lang === "ar" ? null : (
|
|
68
|
-
<Typography style={{ fontSize: 14, margin: 5 }}>
|
|
69
|
-
{" / "}
|
|
70
|
-
{props.cycleText}
|
|
71
|
-
</Typography>
|
|
72
|
-
)} */}
|
|
73
90
|
</Typography>
|
|
74
91
|
</Container>
|
|
75
92
|
|
|
76
93
|
<div
|
|
77
94
|
style={{ padding: 20, color: props.selectedPlan ? "white" : "black" }}
|
|
78
95
|
>
|
|
79
|
-
{
|
|
96
|
+
{featuresMapping?.map((feature) => {
|
|
80
97
|
return (
|
|
81
98
|
<div
|
|
82
99
|
style={{
|
|
@@ -105,6 +122,7 @@ export const HawaPricingCard = (props) => {
|
|
|
105
122
|
})}
|
|
106
123
|
</div>
|
|
107
124
|
<Button
|
|
125
|
+
onClick={props.selectPlan}
|
|
108
126
|
variant={props.selectedPlan ? "outlined" : "contained"}
|
|
109
127
|
style={{ margin: 20 }}
|
|
110
128
|
>
|
|
@@ -1,160 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
// import InputBase from "@mui/material/InputBase";
|
|
3
|
-
// import Typography from "@mui/material/Typography";
|
|
4
|
-
// import { styled } from "@mui/material/styles";
|
|
5
|
-
// import PropTypes from "prop-types";
|
|
6
|
-
// import { HawaInputLabel } from "./HawaInputLabel";
|
|
7
|
-
// import { Controller, useFormContext } from "react-hook-form";
|
|
8
2
|
import Input from "@mui/material/Input";
|
|
9
3
|
import InputLabel from "@mui/material/InputLabel";
|
|
4
|
+
import { Typography } from "@mui/material";
|
|
10
5
|
|
|
11
6
|
export const HawaTextField = (props) => {
|
|
12
|
-
// const { control, register } = useFormContext();
|
|
13
|
-
|
|
14
|
-
// const currentTheme = Object.keys(hawaTheme.inputFields).find(
|
|
15
|
-
// (tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
16
|
-
// );
|
|
17
|
-
// let textFieldStyle = {};
|
|
18
|
-
|
|
19
|
-
// if (currentTheme) {
|
|
20
|
-
// textFieldStyle = {
|
|
21
|
-
// ...hawaTheme.inputFields[currentTheme],
|
|
22
|
-
// margin: props.last ? 0 : hawaTheme.inputFields[currentTheme].margin,
|
|
23
|
-
// marginTop: props.last
|
|
24
|
-
// ? hawaTheme.inputFields[currentTheme].margin * 2
|
|
25
|
-
// : 0,
|
|
26
|
-
// };
|
|
27
|
-
// } else {
|
|
28
|
-
// textFieldStyle = {
|
|
29
|
-
// backgroundColor: "white"
|
|
30
|
-
// };
|
|
31
|
-
// }
|
|
32
|
-
|
|
33
|
-
// const StyledTextField = styled(InputBase)(({ theme }) => {
|
|
34
|
-
// return {
|
|
35
|
-
// // "& .MuiInputBase-input": {
|
|
36
|
-
// // // border: "1px solid #ced4da",
|
|
37
|
-
// // fontSize: 16,
|
|
38
|
-
// // // padding: "10px 12px",
|
|
39
|
-
// // marginBottom: props.helperText ? 5 : 0,
|
|
40
|
-
// // // paddingLeft: 10,
|
|
41
|
-
// // // paddingRight: 10,
|
|
42
|
-
// // ...textFieldStyle
|
|
43
|
-
// // },
|
|
44
|
-
// // "& .MuiInputBase-root": {
|
|
45
|
-
// // border: "1px solid #ced4da",
|
|
46
|
-
// // fontSize: 16,
|
|
47
|
-
// // // width: "auto",
|
|
48
|
-
// // // padding: "10px 12px",
|
|
49
|
-
// // marginBottom: props.helperText ? 5 : 0,
|
|
50
|
-
// // // paddingLeft: 10,
|
|
51
|
-
// // // paddingRight: 10,
|
|
52
|
-
|
|
53
|
-
// // // ...textFieldStyle,
|
|
54
|
-
// // backgroundColor: "blue"
|
|
55
|
-
// // // "&:focus": {
|
|
56
|
-
// // // borderColor: "red",
|
|
57
|
-
// // // borderWidth: 1,
|
|
58
|
-
// // // outline: "1px solid black",
|
|
59
|
-
// // // backgroundColor: "red"
|
|
60
|
-
// // // }
|
|
61
|
-
// // // "& input:valid + fieldset": {
|
|
62
|
-
// // // borderColor: "green",
|
|
63
|
-
// // // borderWidth: 2
|
|
64
|
-
// // // },
|
|
65
|
-
// // // "& input:invalid + fieldset": {
|
|
66
|
-
// // // borderColor: "red",
|
|
67
|
-
// // // borderWidth: 2
|
|
68
|
-
// // // },
|
|
69
|
-
// // // "& input:valid:focus + fieldset": {
|
|
70
|
-
// // // borderLeftWidth: 6,
|
|
71
|
-
// // // padding: "4px !important" // override inline-style
|
|
72
|
-
// // // }
|
|
73
|
-
// // },
|
|
74
|
-
|
|
75
|
-
// // "&:hover": {
|
|
76
|
-
// // borderColor: "red",
|
|
77
|
-
// // borderWidth: 1,
|
|
78
|
-
// // outline: "1px solid black"
|
|
79
|
-
// // },
|
|
80
|
-
|
|
81
|
-
// // paddingLeft: 10,
|
|
82
|
-
// // paddingRight: 10,
|
|
83
|
-
// // border: "none"
|
|
84
|
-
|
|
85
|
-
// // position: "relative",
|
|
86
|
-
// // backgroundColor: "green"
|
|
87
|
-
// ...textFieldStyle
|
|
88
|
-
// };
|
|
89
|
-
// });
|
|
90
|
-
|
|
91
7
|
return (
|
|
92
8
|
<>
|
|
93
|
-
<
|
|
9
|
+
<div
|
|
10
|
+
style={{
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "row",
|
|
13
|
+
justifyContent: "space-between",
|
|
14
|
+
alignItems: "center"
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<InputLabel>{props.label}</InputLabel>
|
|
18
|
+
|
|
19
|
+
{props.helperText && (
|
|
20
|
+
<Typography variant="validation">{props.helperText}</Typography>
|
|
21
|
+
)}
|
|
22
|
+
</div>
|
|
94
23
|
<Input disableUnderline {...props} />
|
|
95
24
|
</>
|
|
96
|
-
// <FormControl variant="hawa" style={{ marginTop: 10 }}>
|
|
97
|
-
|
|
98
|
-
// </FormControl>
|
|
99
|
-
// <TextField
|
|
100
|
-
// fullWidth
|
|
101
|
-
// type="text"
|
|
102
|
-
// // inputProps={{
|
|
103
|
-
// // shrink: true
|
|
104
|
-
// // }}
|
|
105
|
-
// // InputProps={{
|
|
106
|
-
// // disableUnderline: true,
|
|
107
|
-
// // shrink: true
|
|
108
|
-
// // }}
|
|
109
|
-
// InputLabelProps={{
|
|
110
|
-
// shrink: true
|
|
111
|
-
// }}
|
|
112
|
-
// {...props}
|
|
113
|
-
// />
|
|
114
|
-
// <Controller
|
|
115
|
-
// render={({ field }) => (
|
|
116
|
-
// <>
|
|
117
|
-
// {props.inputLabel && <InputLabel label={props.inputLabel} />}
|
|
118
|
-
|
|
119
|
-
// <TextField
|
|
120
|
-
// fullWidth={true}
|
|
121
|
-
// // helperText={props.helperText}
|
|
122
|
-
// type={props.type ?? "text"}
|
|
123
|
-
// // placeholder={props.placeholder}
|
|
124
|
-
// // inputProps={
|
|
125
|
-
// // props.type === "number"
|
|
126
|
-
// // ? {
|
|
127
|
-
// // inputMode: "numeric",
|
|
128
|
-
// // min: "0",
|
|
129
|
-
// // max: "9999999",
|
|
130
|
-
// // step: "0.01"
|
|
131
|
-
// // }
|
|
132
|
-
// // : {}
|
|
133
|
-
// // }
|
|
134
|
-
|
|
135
|
-
// defaultValue={props.defaultValue && ""}
|
|
136
|
-
// value={props.value && ""}
|
|
137
|
-
// {...props}
|
|
138
|
-
// // {...field}
|
|
139
|
-
// {...register(props.name)}
|
|
140
|
-
// />
|
|
141
|
-
// <Typography
|
|
142
|
-
// variant="caption"
|
|
143
|
-
// style={{ margin: 5, marginBottom: 0, color: "red" }}
|
|
144
|
-
// >
|
|
145
|
-
// {props.helperText}
|
|
146
|
-
// </Typography>
|
|
147
|
-
// </>
|
|
148
|
-
// )}
|
|
149
|
-
// name={props.name}
|
|
150
|
-
// rules={props.rules}
|
|
151
|
-
// control={control}
|
|
152
|
-
// shouldUnregister={props.shouldUnregister}
|
|
153
|
-
// />
|
|
154
25
|
);
|
|
155
26
|
};
|
|
156
|
-
|
|
157
|
-
// HawaTextField.propTypes = {
|
|
158
|
-
// type: PropTypes.oneOf(["text", "number", "password"]),
|
|
159
|
-
// helperText: PropTypes.string
|
|
160
|
-
// };
|
|
@@ -3,24 +3,5 @@ import React from "react";
|
|
|
3
3
|
import Typography from "@mui/material/Typography";
|
|
4
4
|
|
|
5
5
|
export const HawaTypography = (props) => {
|
|
6
|
-
// const currentTheme = Object.keys(hawaTheme.typography).find(
|
|
7
|
-
// (tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
8
|
-
// );
|
|
9
|
-
// let typographyStyle = {};
|
|
10
|
-
|
|
11
|
-
// if (currentTheme) {
|
|
12
|
-
// typographyStyle = { ...hawaTheme.typography[currentTheme] };
|
|
13
|
-
// } else {
|
|
14
|
-
// typographyStyle = {
|
|
15
|
-
// color: "black"
|
|
16
|
-
// };
|
|
17
|
-
// }
|
|
18
|
-
|
|
19
|
-
// const StyledTypography = styled(Typography)(({ theme }) => {
|
|
20
|
-
// return {
|
|
21
|
-
// ...typographyStyle
|
|
22
|
-
// };
|
|
23
|
-
// });
|
|
24
|
-
|
|
25
6
|
return <Typography {...props}>{props.children}</Typography>;
|
|
26
7
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Snackbar from "@mui/material/Snackbar";
|
|
3
|
+
import AlertTitle from "@mui/material/AlertTitle";
|
|
4
|
+
import Alert from "@mui/material/Alert";
|
|
5
|
+
|
|
6
|
+
export const OfflineBanner = (props) => {
|
|
7
|
+
return (
|
|
8
|
+
<Snackbar
|
|
9
|
+
style={{ outline: "1px solid red" }}
|
|
10
|
+
open={props.open}
|
|
11
|
+
onClose={props.handleClose}
|
|
12
|
+
>
|
|
13
|
+
<Alert icon={false} severity={"error"}>
|
|
14
|
+
{props.title && <AlertTitle>{props.title}</AlertTitle>}
|
|
15
|
+
{props.text}
|
|
16
|
+
</Alert>
|
|
17
|
+
</Snackbar>
|
|
18
|
+
);
|
|
19
|
+
};
|
package/src/elements/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from "./AdaptiveButton";
|
|
2
2
|
export * from "./ActionButton";
|
|
3
|
+
export * from "./HawaListItem";
|
|
4
|
+
export * from "./HawaAppBar";
|
|
3
5
|
export * from "./HawaCheckbox";
|
|
4
6
|
export * from "./HawaRadio";
|
|
5
7
|
export * from "./HawaPricingCard";
|
|
@@ -10,3 +12,4 @@ export * from "./HawaTextField";
|
|
|
10
12
|
export * from "./HawaInputLabel";
|
|
11
13
|
export * from "./HawaTypography";
|
|
12
14
|
export * from "./HawaAlert";
|
|
15
|
+
export * from "./OfflineBanner";
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { styled, useTheme } from "@mui/material/styles";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import MuiDrawer from "@mui/material/Drawer";
|
|
5
|
+
import MuiAppBar from "@mui/material/AppBar";
|
|
6
|
+
import Toolbar from "@mui/material/Toolbar";
|
|
7
|
+
import List from "@mui/material/List";
|
|
8
|
+
// import CssBaseline from "@mui/material/CssBaseline";
|
|
9
|
+
import Typography from "@mui/material/Typography";
|
|
10
|
+
import Divider from "@mui/material/Divider";
|
|
11
|
+
import IconButton from "@mui/material/IconButton";
|
|
12
|
+
import MenuIcon from "@mui/icons-material/Menu";
|
|
13
|
+
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
14
|
+
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
15
|
+
import ListItemButton from "@mui/material/ListItemButton";
|
|
16
|
+
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
17
|
+
import ListItemText from "@mui/material/ListItemText";
|
|
18
|
+
import InboxIcon from "@mui/icons-material/MoveToInbox";
|
|
19
|
+
import MailIcon from "@mui/icons-material/Mail";
|
|
20
|
+
import { HawaListItem } from "../elements";
|
|
21
|
+
import Menu from "@mui/material/Menu";
|
|
22
|
+
import Container from "@mui/material/Container";
|
|
23
|
+
import Avatar from "@mui/material/Avatar";
|
|
24
|
+
import Button from "@mui/material/Button";
|
|
25
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
26
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
27
|
+
|
|
28
|
+
const drawerWidth = 240;
|
|
29
|
+
|
|
30
|
+
const openedMixin = (theme) => ({
|
|
31
|
+
width: drawerWidth,
|
|
32
|
+
transition: theme.transitions.create("width", {
|
|
33
|
+
easing: theme.transitions.easing.sharp,
|
|
34
|
+
duration: theme.transitions.duration.enteringScreen
|
|
35
|
+
}),
|
|
36
|
+
overflowX: "hidden"
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const closedMixin = (theme) => ({
|
|
40
|
+
transition: theme.transitions.create("width", {
|
|
41
|
+
easing: theme.transitions.easing.sharp,
|
|
42
|
+
duration: theme.transitions.duration.leavingScreen
|
|
43
|
+
}),
|
|
44
|
+
overflowX: "hidden",
|
|
45
|
+
width: `calc(${theme.spacing(7)} + 1px)`,
|
|
46
|
+
[theme.breakpoints.up("sm")]: {
|
|
47
|
+
width: `calc(${theme.spacing(8)} + 1px)`
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const DrawerHeader = styled("div")(({ theme }) => ({
|
|
52
|
+
display: "flex",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
justifyContent: "flex-end",
|
|
55
|
+
padding: theme.spacing(0, 1),
|
|
56
|
+
// necessary for content to be below app bar
|
|
57
|
+
...theme.mixins.toolbar
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
const AppBar = styled(MuiAppBar, {
|
|
61
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
62
|
+
})(({ theme, open }) => ({
|
|
63
|
+
zIndex: theme.zIndex.drawer + 1,
|
|
64
|
+
transition: theme.transitions.create(["width", "margin"], {
|
|
65
|
+
easing: theme.transitions.easing.sharp,
|
|
66
|
+
duration: theme.transitions.duration.leavingScreen
|
|
67
|
+
}),
|
|
68
|
+
...(open && {
|
|
69
|
+
marginLeft: drawerWidth,
|
|
70
|
+
width: `calc(100% - ${drawerWidth}px)`,
|
|
71
|
+
transition: theme.transitions.create(["width", "margin"], {
|
|
72
|
+
easing: theme.transitions.easing.sharp,
|
|
73
|
+
duration: theme.transitions.duration.enteringScreen
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
const Drawer = styled(MuiDrawer, {
|
|
79
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
80
|
+
})(({ theme, open }) => ({
|
|
81
|
+
width: drawerWidth,
|
|
82
|
+
flexShrink: 0,
|
|
83
|
+
whiteSpace: "nowrap",
|
|
84
|
+
boxSizing: "border-box",
|
|
85
|
+
...(open && {
|
|
86
|
+
...openedMixin(theme),
|
|
87
|
+
"& .MuiDrawer-paper": openedMixin(theme)
|
|
88
|
+
}),
|
|
89
|
+
...(!open && {
|
|
90
|
+
...closedMixin(theme),
|
|
91
|
+
"& .MuiDrawer-paper": closedMixin(theme)
|
|
92
|
+
})
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
export function HawaAppLayout(props) {
|
|
96
|
+
const theme = useTheme();
|
|
97
|
+
const [open, setOpen] = React.useState(true);
|
|
98
|
+
|
|
99
|
+
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
100
|
+
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
|
101
|
+
|
|
102
|
+
const handleOpenNavMenu = (event) => {
|
|
103
|
+
setAnchorElNav(event.currentTarget);
|
|
104
|
+
};
|
|
105
|
+
const handleOpenUserMenu = (event) => {
|
|
106
|
+
setAnchorElUser(event.currentTarget);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const handleCloseNavMenu = () => {
|
|
110
|
+
setAnchorElNav(null);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const handleCloseUserMenu = () => {
|
|
114
|
+
setAnchorElUser(null);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const handleDrawerOpen = () => {
|
|
118
|
+
setOpen(true);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const handleDrawerClose = () => {
|
|
122
|
+
setOpen(false);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<Box sx={{ display: "flex" }}>
|
|
127
|
+
{/* <CssBaseline /> */}
|
|
128
|
+
<AppBar variant="appbar" position="fixed" open={open}>
|
|
129
|
+
<Toolbar variant="appbar">
|
|
130
|
+
<IconButton
|
|
131
|
+
color="inherit"
|
|
132
|
+
aria-label="open drawer"
|
|
133
|
+
onClick={handleDrawerOpen}
|
|
134
|
+
edge="start"
|
|
135
|
+
sx={{
|
|
136
|
+
marginRight: 5,
|
|
137
|
+
...(open && { display: "none" })
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
<MenuIcon />
|
|
141
|
+
</IconButton>
|
|
142
|
+
|
|
143
|
+
<div
|
|
144
|
+
style={{
|
|
145
|
+
// backgroundColor: "red",
|
|
146
|
+
display: "flex",
|
|
147
|
+
flexDirection: "row",
|
|
148
|
+
justifyContent: "space-between",
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
width: "100%",
|
|
151
|
+
margin: 0
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
<Typography variant="h6" noWrap component="div">
|
|
155
|
+
Page name here
|
|
156
|
+
</Typography>
|
|
157
|
+
|
|
158
|
+
<Box>
|
|
159
|
+
<Tooltip title="Open settings">
|
|
160
|
+
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
|
|
161
|
+
<Avatar alt="Remy Sharp" src="/static/images/avatar/2.jpg" />
|
|
162
|
+
</IconButton>
|
|
163
|
+
</Tooltip>
|
|
164
|
+
<Menu
|
|
165
|
+
sx={{ mt: "45px" }}
|
|
166
|
+
id="menu-appbar"
|
|
167
|
+
anchorEl={anchorElUser}
|
|
168
|
+
anchorOrigin={{
|
|
169
|
+
vertical: "top",
|
|
170
|
+
horizontal: "right"
|
|
171
|
+
}}
|
|
172
|
+
keepMounted
|
|
173
|
+
transformOrigin={{
|
|
174
|
+
vertical: "top",
|
|
175
|
+
horizontal: "right"
|
|
176
|
+
}}
|
|
177
|
+
open={Boolean(anchorElUser)}
|
|
178
|
+
onClose={handleCloseUserMenu}
|
|
179
|
+
>
|
|
180
|
+
{[2, 3, 4].map((setting) => (
|
|
181
|
+
<MenuItem key={setting} onClick={handleCloseUserMenu}>
|
|
182
|
+
<Typography textAlign="center">{setting}</Typography>
|
|
183
|
+
</MenuItem>
|
|
184
|
+
))}
|
|
185
|
+
</Menu>
|
|
186
|
+
</Box>
|
|
187
|
+
</div>
|
|
188
|
+
</Toolbar>
|
|
189
|
+
</AppBar>
|
|
190
|
+
<Drawer variant="permanent" open={open}>
|
|
191
|
+
<DrawerHeader>
|
|
192
|
+
{props.logo}
|
|
193
|
+
<IconButton onClick={handleDrawerClose}>
|
|
194
|
+
{theme.direction === "rtl" ? (
|
|
195
|
+
<ChevronRightIcon />
|
|
196
|
+
) : (
|
|
197
|
+
<ChevronLeftIcon />
|
|
198
|
+
)}
|
|
199
|
+
</IconButton>
|
|
200
|
+
</DrawerHeader>
|
|
201
|
+
<Divider />
|
|
202
|
+
<List>
|
|
203
|
+
{props.pages.map((t) => {
|
|
204
|
+
return (
|
|
205
|
+
<HawaListItem
|
|
206
|
+
open={open}
|
|
207
|
+
text={t.text}
|
|
208
|
+
selected={props.pageName.toLowerCase() === t.text}
|
|
209
|
+
// icon={<ChevronLeftIcon />}
|
|
210
|
+
icon={t.icon}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
})}
|
|
214
|
+
</List>
|
|
215
|
+
<Divider />
|
|
216
|
+
<List>
|
|
217
|
+
{["All mail", "Trash", "Spam"].map((text, index) => (
|
|
218
|
+
<ListItemButton
|
|
219
|
+
key={text}
|
|
220
|
+
sx={{
|
|
221
|
+
minHeight: 48,
|
|
222
|
+
justifyContent: open ? "initial" : "center",
|
|
223
|
+
px: 2.5
|
|
224
|
+
}}
|
|
225
|
+
>
|
|
226
|
+
<ListItemIcon
|
|
227
|
+
sx={{
|
|
228
|
+
minWidth: 0,
|
|
229
|
+
mr: open ? 3 : "auto",
|
|
230
|
+
justifyContent: "center"
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
|
234
|
+
</ListItemIcon>
|
|
235
|
+
<ListItemText primary={text} sx={{ opacity: open ? 1 : 0 }} />
|
|
236
|
+
</ListItemButton>
|
|
237
|
+
))}
|
|
238
|
+
</List>
|
|
239
|
+
</Drawer>
|
|
240
|
+
<Box sx={{ flexGrow: 1, p: 3 }}>
|
|
241
|
+
<DrawerHeader />
|
|
242
|
+
{props.children}
|
|
243
|
+
</Box>
|
|
244
|
+
</Box>
|
|
245
|
+
);
|
|
246
|
+
}
|
package/src/layout/index.js
CHANGED