@sikka/hawa 0.0.10 → 0.0.13
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 +5 -4
- package/src/blocks/Account/UserProfileForm.js +79 -0
- package/src/blocks/Account/UserSettingsForm.js +13 -0
- package/src/blocks/Account/index.js +2 -2
- package/src/blocks/AuthForms/NewPasswordForm.js +58 -86
- package/src/blocks/AuthForms/ResetPasswordForm.js +44 -43
- package/src/blocks/AuthForms/SignInForm.js +99 -103
- package/src/blocks/AuthForms/SignUpForm.js +106 -104
- package/src/blocks/Payment/ChargeWalletForm.js +40 -37
- package/src/blocks/Payment/CreditCardForm.js +50 -45
- package/src/blocks/Payment/PayWithWallet.js +17 -7
- package/src/blocks/Payment/PaymentMethod.js +0 -1
- package/src/blocks/Payment/SelectPayment.js +54 -56
- package/src/blocks/Pricing/SignInForm.js +126 -0
- package/src/elements/ActionButton.js +38 -0
- package/src/elements/AdaptiveButton.js +32 -0
- package/src/{ui → elements}/AutoCompleteField.js +0 -0
- package/src/{ui → elements}/DragDropImages.js +0 -0
- package/src/{ui → elements}/Hawa.js +0 -0
- package/src/elements/HawaAlert.js +35 -0
- package/src/elements/HawaButton.js +47 -0
- package/src/elements/HawaCard.js +77 -0
- package/src/{ui → elements}/HawaCheckbox.js +0 -0
- package/src/elements/HawaInputLabel.js +31 -0
- package/src/{ui → elements}/HawaLogoButton.js +7 -45
- package/src/elements/HawaRadio.js +32 -0
- package/src/elements/HawaSettingsRow.js +27 -0
- package/src/elements/HawaSwitch.js +6 -0
- package/src/{ui → elements}/HawaTextArea.js +1 -1
- package/src/elements/HawaTextField.js +160 -0
- package/src/elements/HawaTypography.js +26 -0
- package/src/{ui → elements}/RadioBox.js +0 -0
- package/src/{ui → elements}/Row.js +1 -1
- package/src/{ui → elements}/SelectedField.js +0 -0
- package/src/{ui → elements}/StyledTooltip.js +1 -1
- package/src/{ui → elements}/TabPanel.js +1 -1
- package/src/{ui → elements}/index.js +1 -1
- package/src/index.js +0 -2
- package/src/layout/Box.js +36 -33
- package/src/stories/BlocksStories/Account/UserProfile.stories.js +21 -0
- package/src/stories/BlocksStories/Account/UserSettings.stories.js +55 -0
- package/src/stories/BlocksStories/Auth/NewPassword.stories.js +60 -0
- package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +59 -0
- package/src/stories/BlocksStories/Auth/SignIn.stories.js +89 -0
- package/src/stories/BlocksStories/Auth/SignUp.stories.js +90 -0
- package/src/stories/BlocksStories/Payment/ChargeWallet.stories.js +30 -0
- package/src/stories/BlocksStories/Payment/PayWithCreditCard.stories.js +37 -0
- package/src/stories/BlocksStories/Payment/PayWithWallet.stories.js +17 -0
- package/src/stories/BlocksStories/Payment/PaymentSelection.stories.js +60 -0
- package/src/stories/ElementsStories/AdaptiveButton.stories.js +51 -0
- package/src/stories/{UIStories → ElementsStories}/Alert.stories.js +3 -4
- package/src/stories/{UIStories → ElementsStories}/InputLabel.stories.js +1 -1
- package/src/stories/ElementsStories/ItemCard.stories.js +18 -0
- package/src/stories/ElementsStories/LogoButtons.stories.js +73 -0
- package/src/stories/ElementsStories/PricingCard.stories.js +27 -0
- package/src/stories/ElementsStories/RadioSelector.stories.js +36 -0
- package/src/stories/ElementsStories/SettingsRow.stories.js +63 -0
- package/src/stories/{UIStories → ElementsStories}/TextField.stories.js +1 -1
- package/src/stories/LayoutStories/Box.stories.js +11 -31
- package/storybook-static/8.1bf48ea7.iframe.bundle.js +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/main.00b064cb.iframe.bundle.js +1 -0
- package/storybook-static/{runtime~main.cfefe972.iframe.bundle.js → runtime~main.f1ebae9b.iframe.bundle.js} +1 -1
- package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.aa1d952a.iframe.bundle.js.LICENSE.txt → vendors~main.5eab66d3.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js.map +1 -0
- package/src/blocks/Account/UserProfile.js +0 -65
- package/src/blocks/Account/UserSettings.js +0 -15
- package/src/stories/BlocksStories/AuthForm.stories.js +0 -105
- package/src/stories/BlocksStories/PaymentForm.stories.js +0 -86
- package/src/stories/BlocksStories/UserForm.stories.js +0 -41
- package/src/stories/HawaProvider.stories.js +0 -22
- package/src/stories/UIStories/ActionButton.stories.js +0 -46
- package/src/stories/UIStories/AdaptiveButton.stories.js +0 -81
- package/src/stories/UIStories/CheckBox.stories.js +0 -34
- package/src/stories/UIStories/LogoButtons.stories.js +0 -90
- package/src/stories/UIStories/RadioSelector.stories.js +0 -53
- package/src/stories/UIStories/SettingsRow.stories.js +0 -64
- package/src/themes/HawaProvider.js +0 -183
- package/src/ui/ActionButton.js +0 -41
- package/src/ui/AdaptiveButton.js +0 -136
- package/src/ui/HawaAlert.js +0 -37
- package/src/ui/HawaButton.js +0 -48
- package/src/ui/HawaInputLabel.js +0 -32
- package/src/ui/HawaRadio.js +0 -73
- package/src/ui/HawaSettingsRow.js +0 -71
- package/src/ui/HawaTextField.js +0 -107
- package/src/ui/HawaTypography.js +0 -28
- package/storybook-static/8.c4cb6081.iframe.bundle.js +0 -1
- package/storybook-static/main.5731dbe3.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js.map +0 -1
|
@@ -1,50 +1,12 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import { styled, darken } from "@mui/material/styles";
|
|
1
|
+
import React from "react";
|
|
2
|
+
// import { styled, darken } from "@mui/material/styles";
|
|
4
3
|
import Button from "@mui/material/Button";
|
|
5
4
|
import GitHubIcon from "@mui/icons-material/GitHub";
|
|
6
5
|
import TwitterIcon from "@mui/icons-material/Twitter";
|
|
7
6
|
import WalletIcon from "@mui/icons-material/AccountBalanceWallet";
|
|
7
|
+
import { Typography } from "@mui/material";
|
|
8
8
|
|
|
9
9
|
export const HawaLogoButton = (props) => {
|
|
10
|
-
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
11
|
-
let buttonStyle = {};
|
|
12
|
-
let currentTheme = Object.keys(hawaTheme.logoButton).find(
|
|
13
|
-
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
14
|
-
);
|
|
15
|
-
if (currentTheme) {
|
|
16
|
-
buttonStyle = {
|
|
17
|
-
...hawaTheme.logoButton[currentTheme],
|
|
18
|
-
backgroundColor: "white",
|
|
19
|
-
"&:hover": {
|
|
20
|
-
backgroundColor: darken("#ffffff", 0.1)
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
} else {
|
|
24
|
-
// Default theme
|
|
25
|
-
buttonStyle = {
|
|
26
|
-
cursor: "pointer",
|
|
27
|
-
display: "flex",
|
|
28
|
-
flexDirection: "row",
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
justifyContent: "center",
|
|
31
|
-
marginTop: 10,
|
|
32
|
-
height: 50,
|
|
33
|
-
padding: 30,
|
|
34
|
-
paddingTop: 0,
|
|
35
|
-
paddingBottom: 0,
|
|
36
|
-
border: "1px solid #ced4da",
|
|
37
|
-
backgroundColor: "white",
|
|
38
|
-
"&:hover": {
|
|
39
|
-
backgroundColor: darken("#ffffff", 0.1)
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const StyledButton = styled(Button)(({ theme }) => {
|
|
44
|
-
return {
|
|
45
|
-
...buttonStyle
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
10
|
let logoElement = "";
|
|
49
11
|
switch (props.logo?.toLowerCase()) {
|
|
50
12
|
case "google":
|
|
@@ -118,10 +80,10 @@ export const HawaLogoButton = (props) => {
|
|
|
118
80
|
break;
|
|
119
81
|
}
|
|
120
82
|
return (
|
|
121
|
-
<
|
|
83
|
+
<Button {...props} variant="withLogo">
|
|
122
84
|
{logoElement}
|
|
123
85
|
<div style={{ width: 10 }} />
|
|
124
|
-
<
|
|
86
|
+
<Typography
|
|
125
87
|
style={{
|
|
126
88
|
color: "black",
|
|
127
89
|
fontSize: 14,
|
|
@@ -132,7 +94,7 @@ export const HawaLogoButton = (props) => {
|
|
|
132
94
|
}}
|
|
133
95
|
>
|
|
134
96
|
{props.buttonText}
|
|
135
|
-
</
|
|
136
|
-
</
|
|
97
|
+
</Typography>
|
|
98
|
+
</Button>
|
|
137
99
|
);
|
|
138
100
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import Container from "@mui/material/Container";
|
|
4
|
+
|
|
5
|
+
export const HawaRadio = (props) => {
|
|
6
|
+
const [value, setValue] = useState(props.defaultValue);
|
|
7
|
+
return (
|
|
8
|
+
<Container
|
|
9
|
+
variant={props.location === "inSettings" ? "inSettings" : "panelTabs"}
|
|
10
|
+
>
|
|
11
|
+
{props.options.map((singleOption, i) => {
|
|
12
|
+
return (
|
|
13
|
+
<Button
|
|
14
|
+
key={i}
|
|
15
|
+
onClick={() => {
|
|
16
|
+
props.handleChange(singleOption.value);
|
|
17
|
+
setValue(singleOption.value);
|
|
18
|
+
}}
|
|
19
|
+
fullWidth
|
|
20
|
+
variant={
|
|
21
|
+
value?.toLowerCase() === singleOption.value?.toLowerCase()
|
|
22
|
+
? "selected"
|
|
23
|
+
: "unselected"
|
|
24
|
+
}
|
|
25
|
+
>
|
|
26
|
+
{singleOption.label}
|
|
27
|
+
</Button>
|
|
28
|
+
);
|
|
29
|
+
})}
|
|
30
|
+
</Container>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
5
|
+
import { HawaTypography } from "./HawaTypography";
|
|
6
|
+
import Container from "@mui/material/Container";
|
|
7
|
+
import { HawaTextField } from "./HawaTextField";
|
|
8
|
+
import { HawaRadio } from "./HawaRadio";
|
|
9
|
+
import { HawaSwitch } from "./HawaSwitch";
|
|
10
|
+
export const HawaSettingsRow = (props) => {
|
|
11
|
+
return (
|
|
12
|
+
<Container variant="settingsRow">
|
|
13
|
+
<HawaTypography>{props.settingsLabel}</HawaTypography>
|
|
14
|
+
{props.settingsType === "checkbox" && <Checkbox {...props} />}
|
|
15
|
+
{props.settingsType === "text" && <HawaTextField {...props} />}
|
|
16
|
+
{props.settingsType === "radio" && (
|
|
17
|
+
<HawaRadio location="inSettings" {...props} />
|
|
18
|
+
)}
|
|
19
|
+
{props.settingsType === "boolean" && <HawaSwitch {...props} />}
|
|
20
|
+
</Container>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
HawaSettingsRow.propTypes = {
|
|
25
|
+
type: PropTypes.oneOf(["text", "number", "password"]),
|
|
26
|
+
helperText: PropTypes.string
|
|
27
|
+
};
|
|
@@ -15,7 +15,7 @@ export const HawaTextArea = (props) => {
|
|
|
15
15
|
style={{
|
|
16
16
|
color: "black",
|
|
17
17
|
backgroundColor: props.bgColor || "white",
|
|
18
|
-
borderRadius: props.bdRadius || 10,
|
|
18
|
+
// borderRadius: props.bdRadius || 10,
|
|
19
19
|
borderBottom: "none",
|
|
20
20
|
border: "none",
|
|
21
21
|
width: "100%",
|
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
import Input from "@mui/material/Input";
|
|
9
|
+
import InputLabel from "@mui/material/InputLabel";
|
|
10
|
+
|
|
11
|
+
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
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<InputLabel>{props.label}</InputLabel>
|
|
94
|
+
<Input disableUnderline {...props} />
|
|
95
|
+
</>
|
|
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
|
+
);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// HawaTextField.propTypes = {
|
|
158
|
+
// type: PropTypes.oneOf(["text", "number", "password"]),
|
|
159
|
+
// helperText: PropTypes.string
|
|
160
|
+
// };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
// import { styled } from "@mui/material/styles";
|
|
3
|
+
import Typography from "@mui/material/Typography";
|
|
4
|
+
|
|
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
|
+
return <Typography {...props}>{props.children}</Typography>;
|
|
26
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ export * from "./AdaptiveButton";
|
|
|
2
2
|
export * from "./ActionButton";
|
|
3
3
|
export * from "./HawaCheckbox";
|
|
4
4
|
export * from "./HawaRadio";
|
|
5
|
-
|
|
5
|
+
export * from "./HawaCard";
|
|
6
6
|
export * from "./HawaSettingsRow";
|
|
7
7
|
export * from "./HawaLogoButton";
|
|
8
8
|
export * from "./HawaButton";
|
package/src/index.js
CHANGED
package/src/layout/Box.js
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { ThemeProvider } from "../themes/HawaProvider";
|
|
1
|
+
import React from "react";
|
|
3
2
|
|
|
4
3
|
export const Box = (props) => {
|
|
5
|
-
|
|
6
|
-
let boxStyle = {};
|
|
4
|
+
// let boxStyle = {};
|
|
7
5
|
|
|
8
|
-
let currentTheme = Object.keys(hawaTheme.layout).find(
|
|
9
|
-
|
|
10
|
-
);
|
|
11
|
-
if (currentTheme) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} else {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
6
|
+
// let currentTheme = Object.keys(hawaTheme.layout).find(
|
|
7
|
+
// (tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
8
|
+
// );
|
|
9
|
+
// if (currentTheme) {
|
|
10
|
+
// boxStyle = {
|
|
11
|
+
// display: "flex",
|
|
12
|
+
// flexDirection: props.horizontal ? "row" : "column",
|
|
13
|
+
// ...hawaTheme?.layout[currentTheme],
|
|
14
|
+
// backgroundColor: props.noColor
|
|
15
|
+
// ? "none"
|
|
16
|
+
// : hawaTheme.layout[currentTheme].backgroundColor,
|
|
17
|
+
// padding: props.noPadding ? 0 : hawaTheme?.layout[currentTheme].padding,
|
|
18
|
+
// margin: props.noMargin ? 0 : hawaTheme?.layout[currentTheme].margin,
|
|
19
|
+
// maxWidth: props.maxWidth
|
|
20
|
+
// };
|
|
21
|
+
// } else {
|
|
22
|
+
// boxStyle = {
|
|
23
|
+
// display: "flex",
|
|
24
|
+
// flexDirection: props.horizontal ? "row" : "column",
|
|
25
|
+
// color: "white",
|
|
26
|
+
// marginTop: props.last ? 10 * 2 : 0,
|
|
27
|
+
// backgroundColor: props.noColor ? "none" : "lightGrey",
|
|
28
|
+
// padding: props.noPadding ? 0 : 10,
|
|
29
|
+
// margin: props.noMargin ? 0 : 10,
|
|
30
|
+
// maxWidth: props.maxWidth,
|
|
31
|
+
// };
|
|
32
|
+
// }
|
|
36
33
|
|
|
37
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
// style={boxStyle}
|
|
37
|
+
>
|
|
38
|
+
{props.children}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
38
41
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { UserProfileForm } from "../../../blocks/Account";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Blocks/Account/User Profile",
|
|
6
|
+
component: [UserProfile],
|
|
7
|
+
argTypes: {}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const ProfileTemplate = (args) => {
|
|
11
|
+
return <UserProfileForm {...args} />;
|
|
12
|
+
};
|
|
13
|
+
export const UserProfile = ProfileTemplate.bind({});
|
|
14
|
+
UserProfile.args = {
|
|
15
|
+
viaGoogle: true,
|
|
16
|
+
viaGithub: true,
|
|
17
|
+
viaTwitter: true,
|
|
18
|
+
showError: false,
|
|
19
|
+
errorTitle: "Error",
|
|
20
|
+
errorText: "Something went wrong"
|
|
21
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { UserSettingsForm } from "../../../blocks/Account";
|
|
3
|
+
import { HawaSettingsRow } from "../../../elements";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Blocks/Account/User Settings",
|
|
7
|
+
component: UserSettingsForm,
|
|
8
|
+
argTypes: {
|
|
9
|
+
theme: {
|
|
10
|
+
options: ["primary", "secondary", "default"],
|
|
11
|
+
control: { type: "select" }
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export const UserSettings = (args) => {
|
|
16
|
+
return (
|
|
17
|
+
<UserSettingsForm {...args}>
|
|
18
|
+
<HawaSettingsRow settingsType="checkbox" settingsLabel="Hide Watermark" />
|
|
19
|
+
<HawaSettingsRow
|
|
20
|
+
settingsType="text"
|
|
21
|
+
placeholder="Your handle"
|
|
22
|
+
settingsLabel="Custom Handle"
|
|
23
|
+
/>
|
|
24
|
+
<HawaSettingsRow
|
|
25
|
+
handleChange={(e) => console.log("changing to ", e)}
|
|
26
|
+
settingsType="radio"
|
|
27
|
+
defaultValue="sar"
|
|
28
|
+
options={[
|
|
29
|
+
{ value: "sar", label: "SAR" },
|
|
30
|
+
{ value: "usd", label: "USD" }
|
|
31
|
+
]}
|
|
32
|
+
settingsLabel="Currency"
|
|
33
|
+
/>
|
|
34
|
+
<HawaSettingsRow
|
|
35
|
+
handleChange={(e) => console.log("changing to ", e)}
|
|
36
|
+
settingsType="radio"
|
|
37
|
+
defaultValue="en"
|
|
38
|
+
options={[
|
|
39
|
+
{ value: "en", label: "English" },
|
|
40
|
+
{ value: "ar", label: "Arabic" }
|
|
41
|
+
]}
|
|
42
|
+
settingsLabel="Language"
|
|
43
|
+
/>
|
|
44
|
+
<HawaSettingsRow
|
|
45
|
+
settingsType="boolean"
|
|
46
|
+
placeholder="Your handle"
|
|
47
|
+
settingsLabel="Show Analytics"
|
|
48
|
+
/>
|
|
49
|
+
</UserSettingsForm>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
UserSettings.args = {
|
|
53
|
+
theme: "primary",
|
|
54
|
+
title: "red"
|
|
55
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NewPasswordForm } from "../../../blocks/AuthForms";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Blocks/Auth/New Password",
|
|
6
|
+
component: [NewPasswordForm],
|
|
7
|
+
argTypes: {
|
|
8
|
+
|
|
9
|
+
showError: {
|
|
10
|
+
default: false,
|
|
11
|
+
control: "boolean",
|
|
12
|
+
description: "Display the error when auth fails",
|
|
13
|
+
table: { defaultValue: { summary: true } }
|
|
14
|
+
},
|
|
15
|
+
errorTitle: {
|
|
16
|
+
default: " ",
|
|
17
|
+
control: "text",
|
|
18
|
+
description: "The error text for the auth failure",
|
|
19
|
+
table: { defaultValue: { summary: "" } }
|
|
20
|
+
},
|
|
21
|
+
errorText: {
|
|
22
|
+
default: "Something went wrong",
|
|
23
|
+
control: "text",
|
|
24
|
+
description: "The error text for the auth failure",
|
|
25
|
+
table: { defaultValue: { summary: "Something went wrong" } }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const NewPasswordTemplate = (args) => {
|
|
31
|
+
return (
|
|
32
|
+
<NewPasswordForm
|
|
33
|
+
{...args}
|
|
34
|
+
texts={{
|
|
35
|
+
emailLabel: "Email",
|
|
36
|
+
emailPlaceholder: "Enter your email",
|
|
37
|
+
emailRequiredText: "Email is required",
|
|
38
|
+
passwordPlaceholder: "Enter password",
|
|
39
|
+
updatePassword: "Update Password",
|
|
40
|
+
passwordRequiredText: "Password is required",
|
|
41
|
+
passwordLabel: "Choose new password",
|
|
42
|
+
confirmPasswordPlaceholder: "Confirm password",
|
|
43
|
+
confirmPasswordLabel: "Confirm",
|
|
44
|
+
forgotPasswordText: "Forgot password?",
|
|
45
|
+
newUserText: "New user?",
|
|
46
|
+
signUpText: "Sign up",
|
|
47
|
+
signInText: "Sign in",
|
|
48
|
+
googleButtonLabel: "Sign in with Google",
|
|
49
|
+
githubButtonLabel: "Sign in with Github",
|
|
50
|
+
twitterButtonLabel: "Sign in with Twitter"
|
|
51
|
+
}}
|
|
52
|
+
error={args.showError}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
export const NewPassword = NewPasswordTemplate.bind({});
|
|
57
|
+
NewPassword.args = {
|
|
58
|
+
showError: false,
|
|
59
|
+
passwordChanged: false
|
|
60
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResetPasswordForm } from "../../../blocks/AuthForms";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Blocks/Auth/Reset Password",
|
|
6
|
+
component: [ResetPasswordForm],
|
|
7
|
+
argTypes: {
|
|
8
|
+
|
|
9
|
+
showError: {
|
|
10
|
+
default: false,
|
|
11
|
+
control: "boolean",
|
|
12
|
+
description: "Display the error when auth fails",
|
|
13
|
+
table: { defaultValue: { summary: true } }
|
|
14
|
+
},
|
|
15
|
+
errorTitle: {
|
|
16
|
+
default: " ",
|
|
17
|
+
control: "text",
|
|
18
|
+
description: "The error text for the auth failure",
|
|
19
|
+
table: { defaultValue: { summary: "" } }
|
|
20
|
+
},
|
|
21
|
+
errorText: {
|
|
22
|
+
default: "Something went wrong",
|
|
23
|
+
control: "text",
|
|
24
|
+
description: "The error text for the auth failure",
|
|
25
|
+
table: { defaultValue: { summary: "Something went wrong" } }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const ResetPasswordTemplate = (args) => {
|
|
31
|
+
return (
|
|
32
|
+
<ResetPasswordForm
|
|
33
|
+
error={args.showError}
|
|
34
|
+
texts={{
|
|
35
|
+
emailLabel: "Email",
|
|
36
|
+
emailPlaceholder: "Enter your email",
|
|
37
|
+
emailRequiredText: "Email is required",
|
|
38
|
+
emailInvalidText: "Invalid email address",
|
|
39
|
+
passwordLabel: "Password",
|
|
40
|
+
resetPassword: "Reset Password",
|
|
41
|
+
passwordRequiredText: "Password is required",
|
|
42
|
+
forgotPasswordText: "Forgot password?",
|
|
43
|
+
newUserText: "New user?",
|
|
44
|
+
signUpText: "Sign up",
|
|
45
|
+
signInText: "Sign in",
|
|
46
|
+
googleButtonLabel: "Sign in with Google",
|
|
47
|
+
githubButtonLabel: "Sign in with Github",
|
|
48
|
+
twitterButtonLabel: "Sign in with Twitter"
|
|
49
|
+
}}
|
|
50
|
+
{...args}
|
|
51
|
+
handleResetPassword={() => console.log("resetting password")}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
export const ResetPassword = ResetPasswordTemplate.bind({});
|
|
56
|
+
ResetPassword.args = {
|
|
57
|
+
showError: false,
|
|
58
|
+
sent: false
|
|
59
|
+
};
|