@sikka/hawa 0.0.9 → 0.0.12
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 +80 -0
- package/src/blocks/Account/UserSettingsForm.js +17 -0
- package/src/blocks/Account/index.js +2 -2
- package/src/blocks/AuthForms/NewPasswordForm.js +57 -85
- package/src/blocks/AuthForms/ResetPasswordForm.js +43 -42
- package/src/blocks/AuthForms/SignInForm.js +99 -98
- package/src/blocks/AuthForms/SignUpForm.js +106 -104
- package/src/blocks/Payment/ChargeWalletForm.js +40 -37
- package/src/blocks/Payment/CreditCardForm.js +49 -44
- package/src/blocks/Payment/PayWithWallet.js +16 -6
- package/src/blocks/Payment/PaymentMethod.js +0 -1
- package/src/blocks/Payment/SelectPayment.js +53 -55
- package/src/index.js +0 -1
- 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 +21 -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/LayoutStories/Box.stories.js +9 -20
- package/src/stories/UIStories/ActionButton.stories.js +1 -6
- package/src/stories/UIStories/AdaptiveButton.stories.js +1 -6
- package/src/stories/UIStories/Alert.stories.js +2 -3
- package/src/stories/UIStories/LogoButtons.stories.js +47 -64
- package/src/stories/UIStories/RadioSelector.stories.js +15 -44
- package/src/stories/UIStories/SettingsRow.stories.js +3 -16
- package/src/themes/HawaProvider.js +187 -178
- package/src/themes/QawaimTheme.js +199 -0
- package/src/ui/ActionButton.js +32 -35
- package/src/ui/AdaptiveButton.js +3 -8
- package/src/ui/HawaAlert.js +22 -24
- package/src/ui/HawaButton.js +43 -44
- package/src/ui/HawaInputLabel.js +22 -23
- package/src/ui/HawaLogoButton.js +7 -45
- package/src/ui/HawaRadio.js +18 -61
- package/src/ui/HawaSettingsRow.js +1 -27
- package/src/ui/HawaTextArea.js +1 -1
- package/src/ui/HawaTextField.js +146 -93
- package/src/ui/HawaTypography.js +19 -21
- package/src/ui/Row.js +1 -1
- package/src/ui/StyledTooltip.js +1 -1
- package/src/ui/TabPanel.js +1 -1
- 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.a9a16923.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.f8d30727.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.aa1d952a.iframe.bundle.js.LICENSE.txt → vendors~main.f8d30727.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.f8d30727.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/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,17 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
HawaTextField,
|
|
4
|
-
ActionButton,
|
|
5
|
-
HawaAlert,
|
|
6
|
-
HawaTypography,
|
|
7
|
-
HawaLogoButton
|
|
8
|
-
} from "../../ui";
|
|
9
|
-
import { Box } from "../../layout";
|
|
2
|
+
import { HawaTextField, HawaTypography, HawaLogoButton } from "../../ui";
|
|
10
3
|
import { FormProvider, useForm } from "react-hook-form";
|
|
11
|
-
|
|
12
4
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
13
5
|
import EmailIcon from "@mui/icons-material/MailOutline";
|
|
14
6
|
import PasswordIcon from "@mui/icons-material/HttpsOutlined";
|
|
7
|
+
import Container from "@mui/material/Container";
|
|
8
|
+
import Typography from "@mui/material/Typography";
|
|
9
|
+
import Button from "@mui/material/Button";
|
|
10
|
+
import Alert from "@mui/material/Alert";
|
|
11
|
+
import AlertTitle from "@mui/material/AlertTitle";
|
|
15
12
|
|
|
16
13
|
export const SignInForm = (props) => {
|
|
17
14
|
const methods = useForm();
|
|
@@ -21,110 +18,114 @@ export const SignInForm = (props) => {
|
|
|
21
18
|
} = methods;
|
|
22
19
|
|
|
23
20
|
return (
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
<Container maxWidth="xs" variant="auth">
|
|
22
|
+
{props.error && (
|
|
23
|
+
<Alert severity="error">
|
|
24
|
+
{props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
|
|
25
|
+
{props.errorText}
|
|
26
|
+
</Alert>
|
|
27
|
+
)}
|
|
28
|
+
<FormProvider {...methods}>
|
|
29
|
+
<form onSubmit={handleSubmit(props.handleSignIn)}>
|
|
30
|
+
<HawaTextField
|
|
31
|
+
fullWidth
|
|
32
|
+
type="text"
|
|
33
|
+
name="email"
|
|
34
|
+
label={props.texts.emailLabel}
|
|
35
|
+
placeholder={props.texts.emailPlaceholder}
|
|
36
|
+
startAdornment={
|
|
37
|
+
<InputAdornment position="start">
|
|
38
|
+
<EmailIcon />
|
|
39
|
+
</InputAdornment>
|
|
40
|
+
}
|
|
41
|
+
rules={{
|
|
42
|
+
required: props.texts.emailRequired,
|
|
43
|
+
pattern: {
|
|
44
|
+
value:
|
|
45
|
+
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
46
|
+
message: props.texts.emailInvalidText
|
|
40
47
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
value:
|
|
45
|
-
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
46
|
-
message: "Invalid email address"
|
|
47
|
-
}
|
|
48
|
-
}}
|
|
49
|
-
helperText={errors.email?.message}
|
|
50
|
-
/>
|
|
48
|
+
}}
|
|
49
|
+
helperText={errors.email?.message}
|
|
50
|
+
/>
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<HawaTypography
|
|
52
|
+
<HawaTextField
|
|
53
|
+
fullWidth
|
|
54
|
+
name="password"
|
|
55
|
+
placeholder={props.texts.passwordPlaceholder}
|
|
56
|
+
type="password"
|
|
57
|
+
label={props.texts.passwordLabel}
|
|
58
|
+
startAdornment={
|
|
59
|
+
<InputAdornment position="start">
|
|
60
|
+
<PasswordIcon />
|
|
61
|
+
</InputAdornment>
|
|
62
|
+
}
|
|
63
|
+
rules={{
|
|
64
|
+
required: props.texts.passwordRequired
|
|
65
|
+
}}
|
|
66
|
+
helperText={errors.password?.message}
|
|
67
|
+
/>
|
|
68
|
+
<Typography
|
|
69
|
+
style={{
|
|
70
|
+
cursor: "pointer",
|
|
71
|
+
marginTop: 5,
|
|
72
|
+
width: "max-content",
|
|
73
|
+
fontSize: 15,
|
|
74
|
+
padding: 5
|
|
75
|
+
}}
|
|
76
|
+
onClick={props.handleForgotPassword}
|
|
77
|
+
>
|
|
78
|
+
{props.texts.forgotPasswordText}
|
|
79
|
+
</Typography>
|
|
80
|
+
<Button type="submit" fullWidth variant="last">
|
|
81
|
+
{props.texts.signInText}
|
|
82
|
+
</Button>
|
|
83
|
+
</form>
|
|
84
|
+
</FormProvider>
|
|
85
|
+
<Typography
|
|
86
|
+
variant="subtitle2"
|
|
88
87
|
style={{
|
|
88
|
+
// fontSize: 15,
|
|
89
89
|
marginTop: 5,
|
|
90
|
-
// width: "max-content",
|
|
91
90
|
textAlign: "center",
|
|
92
91
|
padding: 5
|
|
93
92
|
}}
|
|
94
93
|
>
|
|
95
|
-
|
|
94
|
+
{props.texts.newUserText}{" "}
|
|
96
95
|
<span
|
|
97
|
-
onClick={
|
|
96
|
+
onClick={props.handleRouteToSignUp}
|
|
98
97
|
style={{
|
|
99
98
|
cursor: "pointer",
|
|
100
99
|
color: "blue",
|
|
101
100
|
textAlign: "center"
|
|
102
101
|
}}
|
|
103
102
|
>
|
|
104
|
-
|
|
103
|
+
{props.texts.signUpText}
|
|
105
104
|
</span>
|
|
106
|
-
</
|
|
107
|
-
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
105
|
+
</Typography>
|
|
106
|
+
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
107
|
+
{props.viaGoogle && (
|
|
108
|
+
<HawaLogoButton
|
|
109
|
+
logo="google"
|
|
110
|
+
buttonText={props.texts.googleButtonLabel}
|
|
111
|
+
onClick={props.handleGoogleSignIn}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
114
|
+
{props.viaGithub && (
|
|
115
|
+
<HawaLogoButton
|
|
116
|
+
logo="github"
|
|
117
|
+
buttonText={props.texts.githubButtonLabel}
|
|
118
|
+
onClick={props.handleGithubSignIn}
|
|
119
|
+
/>
|
|
120
|
+
)}
|
|
121
|
+
{props.viaTwitter && (
|
|
122
|
+
<HawaLogoButton
|
|
123
|
+
logo="twitter"
|
|
124
|
+
buttonText={props.texts.twitterButtonLabel}
|
|
125
|
+
onClick={props.handleTwitterSignIn}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
</Container>
|
|
129
130
|
);
|
|
130
131
|
};
|
|
@@ -1,142 +1,144 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
HawaTextField,
|
|
5
|
-
ActionButton,
|
|
6
|
-
HawaAlert,
|
|
7
|
-
HawaTypography,
|
|
8
|
-
HawaLogoButton
|
|
9
|
-
} from "../../ui";
|
|
2
|
+
import { HawaTextField, HawaLogoButton } from "../../ui";
|
|
10
3
|
import PropTypes from "prop-types";
|
|
11
4
|
import { FormProvider, useForm } from "react-hook-form";
|
|
12
|
-
|
|
13
5
|
import PersonIcon from "@mui/icons-material/PermIdentityOutlined";
|
|
14
6
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
15
7
|
import EmailIcon from "@mui/icons-material/MailOutline";
|
|
16
8
|
import PasswordIcon from "@mui/icons-material/HttpsOutlined";
|
|
9
|
+
import Container from "@mui/material/Container";
|
|
10
|
+
import Typography from "@mui/material/Typography";
|
|
11
|
+
import Button from "@mui/material/Button";
|
|
12
|
+
import Alert from "@mui/material/Alert";
|
|
13
|
+
import AlertTitle from "@mui/material/AlertTitle";
|
|
17
14
|
|
|
18
15
|
export const SignUpForm = (props) => {
|
|
19
16
|
const methods = useForm();
|
|
20
17
|
const {
|
|
21
18
|
formState: { errors },
|
|
22
|
-
handleSubmit
|
|
23
|
-
getValues,
|
|
24
|
-
register,
|
|
25
|
-
watch,
|
|
26
|
-
reset,
|
|
27
|
-
setValue
|
|
19
|
+
handleSubmit
|
|
28
20
|
} = methods;
|
|
29
21
|
|
|
30
22
|
return (
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
<Container maxWidth="xs" variant="auth">
|
|
24
|
+
{props.error && (
|
|
25
|
+
<Alert severity="error">
|
|
26
|
+
{props.errorTitle && <AlertTitle>{props.errorTitle}</AlertTitle>}
|
|
27
|
+
{props.errorText}
|
|
28
|
+
</Alert>
|
|
29
|
+
)}
|
|
30
|
+
{/* {props.error && (
|
|
34
31
|
<HawaAlert text="This is a sign in alert" severity="error" />
|
|
35
|
-
)}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/>
|
|
32
|
+
)} */}
|
|
33
|
+
<FormProvider {...methods}>
|
|
34
|
+
<form onSubmit={handleSubmit(props.handleSignUp)}>
|
|
35
|
+
<HawaTextField
|
|
36
|
+
fullWidth
|
|
37
|
+
type="text"
|
|
38
|
+
label={props.texts.fullNameLabel}
|
|
39
|
+
name="fullName"
|
|
40
|
+
placeholder={props.texts.fullNamePlaceholder}
|
|
41
|
+
inputLabel={props.texts.fullNameLabel}
|
|
42
|
+
startAdornment={
|
|
43
|
+
<InputAdornment position="start">
|
|
44
|
+
<PersonIcon />
|
|
45
|
+
</InputAdornment>
|
|
46
|
+
}
|
|
47
|
+
helperText={errors.fullName?.message}
|
|
48
|
+
/>
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
<HawaTextField
|
|
51
|
+
fullWidth
|
|
52
|
+
type="text"
|
|
53
|
+
label={props.texts.emailLabel}
|
|
54
|
+
placeholder={props.texts.emailPlaceholder}
|
|
55
|
+
name="email"
|
|
56
|
+
startAdornment={
|
|
57
|
+
<InputAdornment position="start">
|
|
58
|
+
<EmailIcon />
|
|
59
|
+
</InputAdornment>
|
|
60
|
+
}
|
|
61
|
+
rules={{
|
|
62
|
+
required: props.texts.emailRequiredText,
|
|
63
|
+
pattern: {
|
|
64
|
+
value:
|
|
65
|
+
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
66
|
+
message: props.texts.emailInvalidText
|
|
63
67
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
}}
|
|
69
|
+
helperText={errors.email?.message}
|
|
70
|
+
/>
|
|
71
|
+
<HawaTextField
|
|
72
|
+
fullWidth
|
|
73
|
+
name="password"
|
|
74
|
+
placeholder={props.texts.passwordPlaceholder}
|
|
75
|
+
type="password"
|
|
76
|
+
label={props.texts.passwordLabel}
|
|
77
|
+
startAdornment={
|
|
78
|
+
<InputAdornment position="start">
|
|
79
|
+
<PasswordIcon />
|
|
80
|
+
</InputAdornment>
|
|
81
|
+
}
|
|
82
|
+
rules={{
|
|
83
|
+
required: props.texts.passwordRequiredText,
|
|
84
|
+
minLength: {
|
|
85
|
+
value: 8,
|
|
86
|
+
message: props.texts.passwordTooShortText
|
|
83
87
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
}}
|
|
89
|
+
helperText={errors.password?.message}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<Button fullWidth variant="last" type="submit">
|
|
93
|
+
{props.texts.signUpText}
|
|
94
|
+
</Button>
|
|
95
|
+
</form>
|
|
96
|
+
</FormProvider>
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</FormProvider>
|
|
97
|
-
</Box>
|
|
98
|
-
<HawaTypography
|
|
98
|
+
<Typography
|
|
99
|
+
variant="subtitle2"
|
|
99
100
|
style={{
|
|
100
101
|
marginTop: 5,
|
|
101
|
-
// width: "max-content",
|
|
102
102
|
textAlign: "center",
|
|
103
103
|
padding: 5
|
|
104
104
|
}}
|
|
105
105
|
>
|
|
106
106
|
Existing user?{" "}
|
|
107
107
|
<span
|
|
108
|
-
onClick={
|
|
108
|
+
onClick={props.handleRouteToSignIn}
|
|
109
109
|
style={{
|
|
110
110
|
cursor: "pointer",
|
|
111
111
|
color: "blue",
|
|
112
112
|
textAlign: "center"
|
|
113
113
|
}}
|
|
114
114
|
>
|
|
115
|
-
|
|
115
|
+
{props.texts.signInText}
|
|
116
116
|
</span>
|
|
117
|
-
</
|
|
118
|
-
{
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
117
|
+
</Typography>
|
|
118
|
+
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
119
|
+
{props.viaGoogle && (
|
|
120
|
+
<HawaLogoButton
|
|
121
|
+
logo="google"
|
|
122
|
+
buttonText={props.texts.googleButtonLabel}
|
|
123
|
+
onClick={props.handleGoogleSignUp}
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
126
|
+
{props.viaGithub && (
|
|
127
|
+
<HawaLogoButton
|
|
128
|
+
logo="github"
|
|
129
|
+
buttonText={props.texts.githubButtonLabel}
|
|
130
|
+
onClick={props.handleGithubSignUp}
|
|
131
|
+
/>
|
|
132
|
+
)}
|
|
133
|
+
{props.viaTwitter && (
|
|
134
|
+
<HawaLogoButton
|
|
135
|
+
logo="twitter"
|
|
136
|
+
buttonText={props.texts.twitterButtonLabel}
|
|
137
|
+
onClick={props.handleTwitterSignUp}
|
|
138
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
</Container>
|
|
140
142
|
);
|
|
141
143
|
};
|
|
142
144
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { HawaTextField
|
|
3
|
-
import { Box } from "../../layout";
|
|
2
|
+
import { HawaTextField } from "../../ui";
|
|
4
3
|
import { FormProvider, useForm } from "react-hook-form";
|
|
4
|
+
import Container from "@mui/material/Container";
|
|
5
|
+
import Button from "@mui/material/Button";
|
|
6
|
+
import Typography from "@mui/material/Typography";
|
|
5
7
|
|
|
6
8
|
export const ChargeWalletForm = (props) => {
|
|
7
9
|
const [walletAmount, setWalletAmount] = useState(0);
|
|
@@ -12,42 +14,43 @@ export const ChargeWalletForm = (props) => {
|
|
|
12
14
|
} = methods;
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
<Container maxWidth="xs">
|
|
18
|
+
<Typography align="center" variant="h1">
|
|
19
|
+
{Number(walletAmount).toLocaleString("en") || "0"}
|
|
20
|
+
<Typography>{props.currency || "SAR"}</Typography>
|
|
21
|
+
</Typography>
|
|
22
|
+
<FormProvider {...methods}>
|
|
23
|
+
<form
|
|
24
|
+
onChange={(e) => {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
setWalletAmount(methods.getValues().amount);
|
|
27
|
+
}}
|
|
28
|
+
style={{ marginTop: 10 }}
|
|
29
|
+
onSubmit={handleSubmit(props.handleChargeWallet)}
|
|
30
|
+
>
|
|
31
|
+
<HawaTextField
|
|
32
|
+
fullWidth
|
|
33
|
+
name="amount"
|
|
34
|
+
placeholder="Enter amount"
|
|
35
|
+
type="number"
|
|
36
|
+
value={walletAmount}
|
|
37
|
+
rules={{
|
|
38
|
+
required: "Password is rquired"
|
|
28
39
|
}}
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
helperText={errors.amount?.message}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<Button
|
|
44
|
+
type="submit"
|
|
45
|
+
fullWidth
|
|
46
|
+
variant="last"
|
|
47
|
+
onClick={props.handleSignIn}
|
|
31
48
|
>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
required: "Password is rquired"
|
|
39
|
-
}}
|
|
40
|
-
helperText={errors.amount?.message}
|
|
41
|
-
/>
|
|
42
|
-
<ActionButton
|
|
43
|
-
last
|
|
44
|
-
fullWidth
|
|
45
|
-
text={"Charge Wallet"} //move this to props
|
|
46
|
-
onClick={props.handleSignIn}
|
|
47
|
-
/>
|
|
48
|
-
</form>
|
|
49
|
-
</FormProvider>
|
|
50
|
-
</Box>
|
|
51
|
-
</Box>
|
|
49
|
+
{/* {props.texts.signInText} */}
|
|
50
|
+
{"Charge Wallet"}
|
|
51
|
+
</Button>
|
|
52
|
+
</form>
|
|
53
|
+
</FormProvider>
|
|
54
|
+
</Container>
|
|
52
55
|
);
|
|
53
56
|
};
|