@sikka/hawa 0.0.13 → 0.0.16
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/blocks/Account/UserProfileForm.js +79 -43
- 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 +57 -0
- package/src/elements/HawaAlert.js +1 -1
- package/src/elements/HawaAppBar.js +139 -0
- package/src/elements/HawaListItem.js +21 -0
- package/src/elements/HawaPricingCard.js +133 -0
- package/src/elements/HawaRadio.js +1 -3
- package/src/elements/HawaTextField.js +15 -149
- package/src/elements/index.js +3 -1
- package/src/layout/HawaAppLayout.js +246 -0
- package/src/layout/index.js +1 -0
- package/src/stories/BlocksStories/Account/UserProfile.stories.js +25 -1
- package/src/stories/BlocksStories/Auth/NewPassword.stories.js +2 -1
- package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +1 -2
- package/src/stories/BlocksStories/Auth/SignIn.stories.js +9 -1
- package/src/stories/BlocksStories/Auth/SignUp.stories.js +8 -0
- package/src/stories/BlocksStories/Payment/ChargeWallet.stories.js +6 -1
- package/src/stories/BlocksStories/Pricing/BillingPlans.stories.js +63 -0
- package/src/stories/BlocksStories/Pricing/LandingPlans.stories.js +63 -0
- package/src/stories/ElementsStories/PricingCard.stories.js +76 -12
- package/src/stories/LayoutStories/AppBar.stories.js +29 -0
- package/src/stories/LayoutStories/AppLayout.stories.js +52 -0
- package/src/styles.css +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/main.66955578.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.b4186832.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.5eab66d3.iframe.bundle.js.LICENSE.txt → vendors~main.b4186832.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.b4186832.iframe.bundle.js.map +1 -0
- package/src/blocks/Pricing/SignInForm.js +0 -126
- package/src/elements/HawaCard.js +0 -77
- package/storybook-static/main.00b064cb.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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Container from "@mui/material/Container";
|
|
3
|
+
import { Button, Typography } from "@mui/material";
|
|
4
|
+
import CheckIcon from "@mui/icons-material/CheckCircleOutlined";
|
|
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;
|
|
24
|
+
return (
|
|
25
|
+
<Container
|
|
26
|
+
maxWidth="xs"
|
|
27
|
+
variant={props.selectedPlan ? "selected-plan-card" : "plan-card"}
|
|
28
|
+
style={{ direction: isArabic ? "rtl" : "ltr" }}
|
|
29
|
+
>
|
|
30
|
+
<Container variant="plan-header">
|
|
31
|
+
<Typography variant="h3" fontWeight={500}>
|
|
32
|
+
{isArabic ? props.title_ar : props.title}
|
|
33
|
+
</Typography>
|
|
34
|
+
<Typography variant="caption">
|
|
35
|
+
{isArabic ? props.subtitle_ar : props.subtitle}
|
|
36
|
+
</Typography>
|
|
37
|
+
<br />
|
|
38
|
+
<Typography
|
|
39
|
+
variant="h4"
|
|
40
|
+
fontWeight={500}
|
|
41
|
+
style={{ display: "flex", alignItems: "center" }}
|
|
42
|
+
>
|
|
43
|
+
{props.lang === "ar" ? (
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
width: "100%",
|
|
47
|
+
display: "flex",
|
|
48
|
+
flexDirection: "column",
|
|
49
|
+
justifyContent: "center"
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<div style={{ display: "flex", flexDirection: "row" }}>
|
|
53
|
+
{props.price}
|
|
54
|
+
<div style={{ width: 5 }} />
|
|
55
|
+
{/* <Typography>{props.currency?.toUpperCase()}</Typography> */}
|
|
56
|
+
<Typography>
|
|
57
|
+
{currencyMapping[props.currency?.toLowerCase()]}
|
|
58
|
+
</Typography>
|
|
59
|
+
</div>
|
|
60
|
+
<Typography style={{ fontSize: 14, margin: 5 }}>
|
|
61
|
+
{isArabic
|
|
62
|
+
? cycleTextsArabic[props.cycleText]
|
|
63
|
+
: cycleTextsEnglish[props.cycleText]}
|
|
64
|
+
</Typography>
|
|
65
|
+
</div>
|
|
66
|
+
) : (
|
|
67
|
+
<div
|
|
68
|
+
style={{
|
|
69
|
+
width: "100%",
|
|
70
|
+
display: "flex",
|
|
71
|
+
flexDirection: "column",
|
|
72
|
+
justifyContent: "center"
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<div style={{ display: "flex", flexDirection: "row" }}>
|
|
76
|
+
<Typography>
|
|
77
|
+
{currencyMapping[props.currency?.toLowerCase()]}
|
|
78
|
+
</Typography>
|
|
79
|
+
{/* <Typography>{props.currency?.toUpperCase()}</Typography> */}
|
|
80
|
+
<div style={{ width: 5 }} />
|
|
81
|
+
{props.price}
|
|
82
|
+
</div>
|
|
83
|
+
<Typography style={{ fontSize: 14, margin: 5 }}>
|
|
84
|
+
{props.lang === "ar"
|
|
85
|
+
? cycleTextsArabic[props.cycleText]
|
|
86
|
+
: cycleTextsEnglish[props.cycleText]}
|
|
87
|
+
</Typography>
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
</Typography>
|
|
91
|
+
</Container>
|
|
92
|
+
|
|
93
|
+
<div
|
|
94
|
+
style={{ padding: 20, color: props.selectedPlan ? "white" : "black" }}
|
|
95
|
+
>
|
|
96
|
+
{featuresMapping?.map((feature) => {
|
|
97
|
+
return (
|
|
98
|
+
<div
|
|
99
|
+
style={{
|
|
100
|
+
display: "flex",
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
justifyContent: "flex-start",
|
|
104
|
+
marginTop: 10,
|
|
105
|
+
width: "100%"
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
style={{
|
|
110
|
+
display: "flex",
|
|
111
|
+
flexDirection: "row",
|
|
112
|
+
justifyContent: "flex-end",
|
|
113
|
+
width: "10%"
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<CheckIcon fontSize="small" />
|
|
117
|
+
</div>
|
|
118
|
+
<div style={{ width: 10 }} />
|
|
119
|
+
<Typography variant="subtitle2">{feature}</Typography>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
<Button
|
|
125
|
+
onClick={props.selectPlan}
|
|
126
|
+
variant={props.selectedPlan ? "outlined" : "contained"}
|
|
127
|
+
style={{ margin: 20 }}
|
|
128
|
+
>
|
|
129
|
+
{props.buttonText}
|
|
130
|
+
</Button>
|
|
131
|
+
</Container>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
@@ -5,9 +5,7 @@ import Container from "@mui/material/Container";
|
|
|
5
5
|
export const HawaRadio = (props) => {
|
|
6
6
|
const [value, setValue] = useState(props.defaultValue);
|
|
7
7
|
return (
|
|
8
|
-
<Container
|
|
9
|
-
variant={props.location === "inSettings" ? "inSettings" : "panelTabs"}
|
|
10
|
-
>
|
|
8
|
+
<Container variant={props.location || "panelTabs"}>
|
|
11
9
|
{props.options.map((singleOption, i) => {
|
|
12
10
|
return (
|
|
13
11
|
<Button
|
|
@@ -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
|
-
// };
|
package/src/elements/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
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
|
-
export * from "./
|
|
7
|
+
export * from "./HawaPricingCard";
|
|
6
8
|
export * from "./HawaSettingsRow";
|
|
7
9
|
export * from "./HawaLogoButton";
|
|
8
10
|
export * from "./HawaButton";
|
|
@@ -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
|
@@ -8,7 +8,31 @@ export default {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const ProfileTemplate = (args) => {
|
|
11
|
-
return
|
|
11
|
+
return (
|
|
12
|
+
<UserProfileForm
|
|
13
|
+
{...args}
|
|
14
|
+
handleUpdateProfile={(e) => console.log("updating profile", e)}
|
|
15
|
+
texts={{
|
|
16
|
+
fullNameLabel: "Full Name",
|
|
17
|
+
fullNamePlaceholder: "Fulan AlFulani",
|
|
18
|
+
fullNameRequiredText: "Full Name is required",
|
|
19
|
+
emailLabel: "Email",
|
|
20
|
+
emailPlaceholder: "Enter your email",
|
|
21
|
+
emailRequiredText: "Email is required",
|
|
22
|
+
emailInvalidText: "Invalid email address",
|
|
23
|
+
passwordPlaceholder: "Minimum 8 characters",
|
|
24
|
+
passwordRequiredText: "Password is required",
|
|
25
|
+
passwordTooShortText: "Password too short",
|
|
26
|
+
|
|
27
|
+
updatePassword: "Update Password",
|
|
28
|
+
passwordLabel: "Choose new password",
|
|
29
|
+
confirmPasswordPlaceholder: "Confirm password",
|
|
30
|
+
confirmPasswordLabel: "Confirm",
|
|
31
|
+
confirmPasswordRequiredText: "Confirmation is required",
|
|
32
|
+
passwordMatchError: "Password doesn't match"
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
12
36
|
};
|
|
13
37
|
export const UserProfile = ProfileTemplate.bind({});
|
|
14
38
|
UserProfile.args = {
|
|
@@ -5,7 +5,6 @@ export default {
|
|
|
5
5
|
title: "Blocks/Auth/New Password",
|
|
6
6
|
component: [NewPasswordForm],
|
|
7
7
|
argTypes: {
|
|
8
|
-
|
|
9
8
|
showError: {
|
|
10
9
|
default: false,
|
|
11
10
|
control: "boolean",
|
|
@@ -41,6 +40,8 @@ const NewPasswordTemplate = (args) => {
|
|
|
41
40
|
passwordLabel: "Choose new password",
|
|
42
41
|
confirmPasswordPlaceholder: "Confirm password",
|
|
43
42
|
confirmPasswordLabel: "Confirm",
|
|
43
|
+
confirmPasswordRequiredText: "Confirmation is required",
|
|
44
|
+
passwordMatchError: "Password doesn't match",
|
|
44
45
|
forgotPasswordText: "Forgot password?",
|
|
45
46
|
newUserText: "New user?",
|
|
46
47
|
signUpText: "Sign up",
|
|
@@ -5,7 +5,6 @@ export default {
|
|
|
5
5
|
title: "Blocks/Auth/Reset Password",
|
|
6
6
|
component: [ResetPasswordForm],
|
|
7
7
|
argTypes: {
|
|
8
|
-
|
|
9
8
|
showError: {
|
|
10
9
|
default: false,
|
|
11
10
|
control: "boolean",
|
|
@@ -48,7 +47,7 @@ const ResetPasswordTemplate = (args) => {
|
|
|
48
47
|
twitterButtonLabel: "Sign in with Twitter"
|
|
49
48
|
}}
|
|
50
49
|
{...args}
|
|
51
|
-
handleResetPassword={() => console.log("resetting password")}
|
|
50
|
+
handleResetPassword={(e) => console.log("resetting password,", e)}
|
|
52
51
|
/>
|
|
53
52
|
);
|
|
54
53
|
};
|
|
@@ -5,6 +5,13 @@ export default {
|
|
|
5
5
|
title: "Blocks/Auth/Sign In",
|
|
6
6
|
component: [SignInForm],
|
|
7
7
|
argTypes: {
|
|
8
|
+
lang: {
|
|
9
|
+
default: true,
|
|
10
|
+
control: "select",
|
|
11
|
+
options: ["ar", "en"],
|
|
12
|
+
description: "The language of the form",
|
|
13
|
+
table: { defaultValue: { summary: "en" } }
|
|
14
|
+
},
|
|
8
15
|
viaGoogle: {
|
|
9
16
|
default: true,
|
|
10
17
|
control: "boolean",
|
|
@@ -85,5 +92,6 @@ SignIn.args = {
|
|
|
85
92
|
viaTwitter: true,
|
|
86
93
|
showError: false,
|
|
87
94
|
errorTitle: "Error",
|
|
88
|
-
errorText: "Something went wrong"
|
|
95
|
+
errorText: "Something went wrong",
|
|
96
|
+
lang: "ar"
|
|
89
97
|
};
|