@sikka/hawa 0.0.4 → 0.0.7

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.
Files changed (123) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +9 -8
  4. package/src/blocks/Account/UserProfile.js +61 -11
  5. package/src/blocks/Account/UserSettings.js +11 -11
  6. package/src/blocks/AuthForms/NewPasswordForm.js +85 -11
  7. package/src/blocks/AuthForms/ResetPasswordForm.js +47 -8
  8. package/src/blocks/AuthForms/SignInForm.js +91 -13
  9. package/src/blocks/AuthForms/SignUpForm.js +119 -12
  10. package/src/blocks/Payment/ChargeWalletForm.js +53 -0
  11. package/src/blocks/Payment/CreditCardForm.js +60 -0
  12. package/src/blocks/Payment/Form/CForm.js +10 -8
  13. package/src/blocks/Payment/Gateway/Wallet.js +5 -5
  14. package/src/blocks/Payment/PayWithWallet.js +14 -0
  15. package/src/blocks/Payment/PaymentMethod.js +2 -2
  16. package/src/blocks/Payment/SelectPayment.js +76 -0
  17. package/src/blocks/Payment/index.js +18 -0
  18. package/src/index.js +3 -1
  19. package/src/layout/Box.js +31 -18
  20. package/src/stories/BlocksStories/AuthForm.stories.js +103 -0
  21. package/src/stories/BlocksStories/PaymentForm.stories.js +86 -0
  22. package/src/stories/BlocksStories/UserForm.stories.js +41 -0
  23. package/src/stories/GlobalVariables.stories.js +33 -90
  24. package/src/stories/HawaProvider.stories.js +0 -1
  25. package/src/stories/Introduction.stories.js +132 -110
  26. package/src/stories/LayoutStories/Box.stories.js +56 -0
  27. package/src/stories/UIStories/ActionButton.stories.js +53 -0
  28. package/src/stories/{AdaptiveButton.stories.js → UIStories/AdaptiveButton.stories.js} +3 -3
  29. package/src/stories/UIStories/Alert.stories.js +42 -0
  30. package/src/stories/{CheckBox.stories.js → UIStories/CheckBox.stories.js} +3 -4
  31. package/src/stories/UIStories/InputLabel.stories.js +13 -0
  32. package/src/stories/UIStories/RadioSelector.stories.js +53 -0
  33. package/src/stories/UIStories/SettingsRow.stories.js +64 -0
  34. package/src/stories/{TextField.stories.js → UIStories/TextField.stories.js} +4 -5
  35. package/src/themes/HawaProvider.js +151 -18
  36. package/src/ui/ActionButton.js +38 -10
  37. package/src/ui/AdaptiveButton.js +29 -29
  38. package/src/ui/ApplePayButton.js +26 -0
  39. package/src/ui/AutoCompleteField.js +0 -1
  40. package/src/ui/DragDropImages.js +2 -2
  41. package/src/ui/GithubButton.js +24 -0
  42. package/src/ui/GoogleButton.js +23 -0
  43. package/src/ui/GooglePayButton.js +26 -0
  44. package/src/ui/HawaAlert.js +37 -0
  45. package/src/ui/HawaButton.js +48 -0
  46. package/src/ui/{Checkbox.js → HawaCheckbox.js} +3 -3
  47. package/src/ui/HawaInputLabel.js +32 -0
  48. package/src/ui/HawaLogoButton.js +43 -0
  49. package/src/ui/HawaRadio.js +73 -0
  50. package/src/ui/HawaSettingsRow.js +71 -0
  51. package/src/ui/{TextArea.js → HawaTextArea.js} +2 -2
  52. package/src/ui/HawaTextField.js +110 -0
  53. package/src/ui/HawaTypography.js +29 -0
  54. package/src/ui/MadaButton.js +26 -0
  55. package/src/ui/PayPalButton.js +26 -0
  56. package/src/ui/RadioBox.js +2 -2
  57. package/src/ui/STCPayButton.js +26 -0
  58. package/src/ui/SelectedField.js +4 -4
  59. package/src/ui/StyledTooltip.js +1 -1
  60. package/src/ui/TabPanel.js +1 -1
  61. package/src/ui/TwitterButton.js +27 -0
  62. package/src/ui/VisaMasterButton.js +26 -0
  63. package/src/ui/WalletButton.js +24 -0
  64. package/src/ui/index.js +23 -11
  65. package/storybook-static/0.0d994c92.iframe.bundle.js +3 -0
  66. package/storybook-static/{1.4e43f671.iframe.bundle.js.LICENSE.txt → 0.0d994c92.iframe.bundle.js.LICENSE.txt} +0 -0
  67. package/storybook-static/0.0d994c92.iframe.bundle.js.map +1 -0
  68. package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +1 -0
  69. package/storybook-static/1.aabc3f3a.iframe.bundle.js +1 -0
  70. package/storybook-static/{3.c1dc7159.iframe.bundle.js → 2.430bf1e3.iframe.bundle.js} +1 -1
  71. package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +2 -0
  72. package/storybook-static/{4.8c311a6b48cad9f29317.manager.bundle.js.LICENSE.txt → 4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt} +0 -0
  73. package/storybook-static/{5.88fe62ee92ff5ca67829.manager.bundle.js → 5.63ab4f94d50a3acf080d.manager.bundle.js} +1 -1
  74. package/storybook-static/{7.69d2e532.iframe.bundle.js → 6.704d1e8d.iframe.bundle.js} +1 -1
  75. package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js → 6.a6d45262f7e98f3f18d3.manager.bundle.js} +2 -2
  76. package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js.LICENSE.txt → 6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt} +0 -0
  77. package/storybook-static/{7.5ec31f3702b08ab0b71c.manager.bundle.js → 7.097710753af9a1c41b80.manager.bundle.js} +1 -1
  78. package/storybook-static/{8.68cd1217.iframe.bundle.js → 7.9ce807e3.iframe.bundle.js} +3 -3
  79. package/storybook-static/{8.68cd1217.iframe.bundle.js.LICENSE.txt → 7.9ce807e3.iframe.bundle.js.LICENSE.txt} +0 -0
  80. package/storybook-static/7.9ce807e3.iframe.bundle.js.map +1 -0
  81. package/storybook-static/{8.5ce13be7612bd3a6b864.manager.bundle.js → 8.76c3cbf398692028e834.manager.bundle.js} +1 -1
  82. package/storybook-static/{9.488e3969.iframe.bundle.js → 8.c4cb6081.iframe.bundle.js} +1 -1
  83. package/storybook-static/iframe.html +1 -1
  84. package/storybook-static/index.html +1 -1
  85. package/storybook-static/main.ac6e4b72b033097dad76.manager.bundle.js +1 -0
  86. package/storybook-static/main.b7ffaed0.iframe.bundle.js +1 -0
  87. package/storybook-static/{runtime~main.cc29f4c2175f187a3707.manager.bundle.js → runtime~main.c8dac23bc753439736f0.manager.bundle.js} +1 -1
  88. package/storybook-static/runtime~main.cfefe972.iframe.bundle.js +1 -0
  89. package/storybook-static/vendors~main.8ebae370.iframe.bundle.js +76 -0
  90. package/storybook-static/{vendors~main.d144d840.iframe.bundle.js.LICENSE.txt → vendors~main.8ebae370.iframe.bundle.js.LICENSE.txt} +3 -30
  91. package/storybook-static/vendors~main.8ebae370.iframe.bundle.js.map +1 -0
  92. package/storybook-static/vendors~main.a697e07137d366f95f76.manager.bundle.js +2 -0
  93. package/storybook-static/{vendors~main.f228d62e92b69563cefb.manager.bundle.js.LICENSE.txt → vendors~main.a697e07137d366f95f76.manager.bundle.js.LICENSE.txt} +0 -0
  94. package/src/blocks/AuthForms/viaFacebook.js +0 -0
  95. package/src/blocks/AuthForms/viaGithub.js +0 -0
  96. package/src/blocks/AuthForms/viaGoogle.js +0 -0
  97. package/src/blocks/AuthForms/viaTwitter.js +0 -0
  98. package/src/blocks/index.js +0 -13
  99. package/src/stories/ActionButton.stories.js +0 -49
  100. package/src/stories/Alert.stories.js +0 -41
  101. package/src/stories/AuthForm.stories.js +0 -79
  102. package/src/stories/Box.stories.js +0 -64
  103. package/src/stories/InputLabel.stories.js +0 -92
  104. package/src/stories/RadioSelector.stories.js +0 -69
  105. package/src/stories/UserAccount.stories.js +0 -46
  106. package/src/ui/RadioSelector.js +0 -51
  107. package/src/ui/StyledAlert.js +0 -30
  108. package/src/ui/StyledInputLabel.js +0 -19
  109. package/src/ui/TextField.js +0 -62
  110. package/storybook-static/0.d3bc3395610cf5d3ee94.manager.bundle.js +0 -1
  111. package/storybook-static/0.dd3d47f5.iframe.bundle.js +0 -1
  112. package/storybook-static/1.4e43f671.iframe.bundle.js +0 -3
  113. package/storybook-static/1.4e43f671.iframe.bundle.js.map +0 -1
  114. package/storybook-static/2.9a757207.iframe.bundle.js +0 -1
  115. package/storybook-static/4.8c311a6b48cad9f29317.manager.bundle.js +0 -2
  116. package/storybook-static/8.68cd1217.iframe.bundle.js.map +0 -1
  117. package/storybook-static/main.65cb2769.iframe.bundle.js +0 -1
  118. package/storybook-static/main.7e391cf7bf72b0d18ea5.manager.bundle.js +0 -1
  119. package/storybook-static/runtime~main.6e2e1544.iframe.bundle.js +0 -1
  120. package/storybook-static/vendors~main.d144d840.iframe.bundle.js +0 -3
  121. package/storybook-static/vendors~main.d144d840.iframe.bundle.js.map +0 -1
  122. package/storybook-static/vendors~main.f228d62e92b69563cefb.manager.bundle.js +0 -2
  123. package/yarn-error.log +0 -10910
@@ -1,15 +1,15 @@
1
1
  import React from "react";
2
- import { StyledTextField, ActionButton } from "../../ui";
3
- import { Box } from '../../layout'
2
+ import { HawaTextField, ActionButton } from "../../ui";
3
+ import { Box } from "../../layout";
4
4
 
5
5
  export const UserSettings = (props) => {
6
- return (
7
- <Box maxWidth={400}>
8
- <StyledTextField type="text" inputLabel="First Name" />
9
- <StyledTextField type="text" inputLabel="Last Name" />
10
- <StyledTextField type="email" inputLabel="Email" />
11
- <StyledTextField type="password" inputLabel="Password" />
12
- <ActionButton last text="Update Account" />
13
- </Box>
14
- );
6
+ return (
7
+ <Box maxWidth={400}>
8
+ <HawaTextField type="text" inputLabel="First Name" />
9
+ <HawaTextField type="text" inputLabel="Last Name" />
10
+ <HawaTextField type="email" inputLabel="Email" />
11
+ <HawaTextField type="password" inputLabel="Password" />
12
+ <ActionButton last text="Update Account" />
13
+ </Box>
14
+ );
15
15
  };
@@ -1,17 +1,91 @@
1
- import React, { useContext } from "react";
1
+ import React, { useState } from "react";
2
2
  import { Box } from "../../layout";
3
- import { ThemeProvider } from "../../themes/HawaProvider";
4
- import { StyledTextField, StyledInputLabel } from "../../ui";
3
+ import { ActionButton, HawaTextField, HawaAlert } from "../../ui";
4
+ import { FormProvider, useForm } from "react-hook-form";
5
+ import InputAdornment from "@mui/material/InputAdornment";
6
+ import PasswordIcon from "@mui/icons-material/HttpsOutlined";
7
+
5
8
  export const NewPasswordForm = (props) => {
6
- const theme = useContext(ThemeProvider);
7
- return (
8
- <Box maxWidth={400} >
9
+ const [newPassword, setNewPassword] = useState("");
10
+ const [confirmNewPassword, setConfirmNewPassword] = useState("");
11
+ const [error, setError] = useState(false);
12
+ const [errorMessage, setErrorMessage] = useState("");
13
+ const [loading, setLoading] = useState(true);
9
14
 
10
- <StyledInputLabel label="Password" />
11
- <StyledTextField type="password" />
12
- <StyledInputLabel label="Confirm Password" />
13
- <StyledTextField type="password" />
14
- {props.children}
15
+ const methods = useForm();
16
+ const {
17
+ formState: { errors },
18
+ handleSubmit,
19
+ getValues,
20
+ register,
21
+ watch,
22
+ reset,
23
+ setValue
24
+ } = methods;
25
+
26
+ const handleNewPassword = (e) => {
27
+ e.preventDefault();
28
+ console.log("submitting fom", e.target);
29
+ // setLoading(true);
30
+ // e.preventDefault();
31
+ // if (newPassword == "" || confirmNewPassword == "") {
32
+ // setLoading(false);
33
+ // return;
34
+ // }
35
+ // if (newPassword != confirmNewPassword) {
36
+ // setError(true);
37
+ // setLoading(false);
38
+ // // setErrorMessage(t("password-no-match"));
39
+ // return;
40
+ // }
41
+ // if (newPassword == confirmNewPassword) {
42
+ // //mutation to reset password here
43
+ // }
44
+ };
45
+ return (
46
+ <Box maxWidth={400} noColor noMargin noPadding>
47
+ <Box noMargin>
48
+ {props.error && (
49
+ <HawaAlert text="This is a new password alert" severity="error" />
50
+ )}
51
+ <FormProvider {...methods}>
52
+ <form onSubmit={handleSubmit(props.handleNewPassword)}>
53
+ <HawaTextField
54
+ name="password"
55
+ type="password"
56
+ inputLabel="Choose new password"
57
+ placeholder="Enter password"
58
+ onChange={(e) => setNewPassword(e.target.value)}
59
+ value={newPassword}
60
+ startAdornment={
61
+ <InputAdornment position="start">
62
+ <PasswordIcon />
63
+ </InputAdornment>
64
+ }
65
+ rules={{
66
+ required: "Password is rquired"
67
+ }}
68
+ helperText={errors.password?.message}
69
+ />
70
+ <HawaTextField
71
+ name="confirmPassword"
72
+ type="password"
73
+ placeholder="Confirm Password"
74
+ inputLabel="Confirm"
75
+ startAdornment={
76
+ <InputAdornment position="start">
77
+ <PasswordIcon />
78
+ </InputAdornment>
79
+ }
80
+ rules={{
81
+ required: "Password is rquired"
82
+ }}
83
+ helperText={errors.confirmPassword?.message}
84
+ />
85
+ <ActionButton fullWidth type="submit" last text="Reset Password" />
86
+ </form>
87
+ </FormProvider>
88
+ </Box>
15
89
  </Box>
16
90
  );
17
91
  };
@@ -1,14 +1,53 @@
1
- import React, { useContext } from "react";
1
+ import React from "react";
2
+ import { FormProvider, useForm } from "react-hook-form";
2
3
  import { Box } from "../../layout";
3
- import { ThemeProvider } from "../../themes/HawaProvider";
4
- import { StyledTextField, StyledInputLabel } from "../../ui";
4
+ import { HawaTextField, ActionButton, HawaAlert } from "../../ui";
5
+ import InputAdornment from "@mui/material/InputAdornment";
6
+ import EmailIcon from "@mui/icons-material/MailOutline";
7
+
5
8
  export const ResetPasswordForm = (props) => {
6
- const theme = useContext(ThemeProvider);
9
+ const methods = useForm();
10
+ const {
11
+ formState: { errors },
12
+ handleSubmit,
13
+ getValues,
14
+ register,
15
+ watch,
16
+ reset,
17
+ setValue
18
+ } = methods;
7
19
  return (
8
- <Box maxWidth={400} >
9
- <StyledInputLabel label="Email" />
10
- <StyledTextField type="text" />
11
- {props.children}
20
+ <Box maxWidth={400} noColor noMargin noPadding>
21
+ <Box noMargin>
22
+ {props.error && (
23
+ <HawaAlert text="This is a reset password alert" severity="error" />
24
+ )}
25
+ <FormProvider {...methods}>
26
+ <form onSubmit={handleSubmit(props.handleResetPassword)}>
27
+ <HawaTextField
28
+ type="text"
29
+ name="email"
30
+ inputLabel="Email"
31
+ placeholder="Enter your email"
32
+ startAdornment={
33
+ <InputAdornment position="start">
34
+ <EmailIcon />
35
+ </InputAdornment>
36
+ }
37
+ rules={{
38
+ required: "Email is required",
39
+ pattern: {
40
+ value:
41
+ /^(([^<>()[\]\\.,;:\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,}))$/,
42
+ message: "Invalid email address"
43
+ }
44
+ }}
45
+ helperText={errors.email?.message}
46
+ />
47
+ <ActionButton fullWidth last type="submit" text="Reset Password" />
48
+ </form>
49
+ </FormProvider>{" "}
50
+ </Box>
12
51
  </Box>
13
52
  );
14
53
  };
@@ -1,19 +1,97 @@
1
- import React, { useContext } from "react";
2
- import { ThemeProvider } from "../../themes/HawaProvider";
3
- import { StyledTextField, StyledInputLabel } from "../../ui";
4
- import { Box } from '../../layout'
5
- export const SignInForm = (props) => {
6
- const theme = useContext(ThemeProvider);
7
- return (
8
- <Box maxWidth={400}>
1
+ import React from "react";
2
+ import {
3
+ HawaTextField,
4
+ ActionButton,
5
+ GoogleButton,
6
+ TwitterButton,
7
+ GithubButton,
8
+ HawaAlert
9
+ } from "../../ui";
10
+ import { Box } from "../../layout";
11
+ import { FormProvider, useForm } from "react-hook-form";
9
12
 
10
- <StyledInputLabel label="Email" />
11
- <StyledTextField type="text" />
12
- <StyledInputLabel label="Password" />
13
- <StyledTextField type="text" />
13
+ import InputAdornment from "@mui/material/InputAdornment";
14
+ import EmailIcon from "@mui/icons-material/MailOutline";
15
+ import PasswordIcon from "@mui/icons-material/HttpsOutlined";
14
16
 
15
- {props.children}
17
+ export const SignInForm = (props) => {
18
+ const methods = useForm();
19
+ const {
20
+ formState: { errors },
21
+ handleSubmit
22
+ } = methods;
23
+
24
+ return (
25
+ <Box maxWidth={400} noColor noMargin noPadding>
26
+ <Box noMargin>
27
+ {props.error && (
28
+ <HawaAlert text="This is a sign in alert" severity="error" />
29
+ )}
30
+ <FormProvider {...methods}>
31
+ <form onSubmit={handleSubmit(props.handleSignIn)}>
32
+ <HawaTextField
33
+ type="text"
34
+ name="email"
35
+ inputLabel="Email"
36
+ placeholder="Enter your email"
37
+ startAdornment={
38
+ <InputAdornment position="start">
39
+ <EmailIcon />
40
+ </InputAdornment>
41
+ }
42
+ rules={{
43
+ required: "Email is required",
44
+ pattern: {
45
+ value:
46
+ /^(([^<>()[\]\\.,;:\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,}))$/,
47
+ message: "Invalid email address"
48
+ }
49
+ }}
50
+ helperText={errors.email?.message}
51
+ />
16
52
 
53
+ <HawaTextField
54
+ name="password"
55
+ placeholder="Enter password"
56
+ type="password"
57
+ inputLabel="Password"
58
+ startAdornment={
59
+ <InputAdornment position="start">
60
+ <PasswordIcon />
61
+ </InputAdornment>
62
+ }
63
+ rules={{
64
+ required: "Password is rquired"
65
+ }}
66
+ helperText={errors.password?.message}
67
+ />
68
+ <ActionButton
69
+ type="submit"
70
+ fullWidth
71
+ last={"true"}
72
+ text={"Sign In"}
73
+ />
74
+ </form>
75
+ </FormProvider>
76
+ </Box>
77
+ {props.viaGoogle && (
78
+ <GoogleButton
79
+ buttonText={props.googleButtonLabel}
80
+ handleClick={props.handleGoogleSignIn}
81
+ />
82
+ )}
83
+ {props.viaGithub && (
84
+ <GithubButton
85
+ buttonText={props.githubButtonLabel}
86
+ handleClick={props.handleGithubSignIn}
87
+ />
88
+ )}
89
+ {props.viaTwitter && (
90
+ <TwitterButton
91
+ buttonText={props.twitterButtonLabel}
92
+ handleClick={props.handleTwitterSignIn}
93
+ />
94
+ )}
17
95
  </Box>
18
96
  );
19
97
  };
@@ -1,20 +1,127 @@
1
- import React, { useContext } from "react";
1
+ import React from "react";
2
2
  import { Box } from "../../layout";
3
- import { ThemeProvider } from "../../themes/HawaProvider";
4
- import { StyledTextField, StyledInputLabel } from "../../ui";
3
+ import {
4
+ HawaTextField,
5
+ ActionButton,
6
+ GoogleButton,
7
+ GithubButton,
8
+ TwitterButton,
9
+ HawaAlert
10
+ } from "../../ui";
11
+ import PropTypes from "prop-types";
12
+ import { FormProvider, useForm } from "react-hook-form";
13
+
14
+ import PersonIcon from "@mui/icons-material/PermIdentityOutlined";
15
+ import InputAdornment from "@mui/material/InputAdornment";
16
+ import EmailIcon from "@mui/icons-material/MailOutline";
17
+ import PasswordIcon from "@mui/icons-material/HttpsOutlined";
5
18
 
6
19
  export const SignUpForm = (props) => {
7
- const theme = useContext(ThemeProvider);
20
+ const methods = useForm();
21
+ const {
22
+ formState: { errors },
23
+ handleSubmit,
24
+ getValues,
25
+ register,
26
+ watch,
27
+ reset,
28
+ setValue
29
+ } = methods;
30
+
8
31
  return (
9
- <Box maxWidth={400}>
32
+ <Box maxWidth={400} noColor noMargin noPadding>
33
+ <Box noMargin>
34
+ {props.error && (
35
+ <HawaAlert text="This is a sign in alert" severity="error" />
36
+ )}
37
+ <FormProvider {...methods}>
38
+ <form onSubmit={handleSubmit(props.handleSignUp)}>
39
+ <HawaTextField
40
+ name="fullName"
41
+ placeholder="Fulan AlFulani"
42
+ type="text"
43
+ inputLabel="Full Name"
44
+ startAdornment={
45
+ <InputAdornment position="start">
46
+ <PersonIcon />
47
+ </InputAdornment>
48
+ }
49
+ rules={{
50
+ required: "Full name rquired"
51
+ }}
52
+ helperText={errors.fullName?.message}
53
+ />
54
+
55
+ <HawaTextField
56
+ type="text"
57
+ inputLabel="Email"
58
+ placeholder="Enter your email"
59
+ name="email"
60
+ startAdornment={
61
+ <InputAdornment position="start">
62
+ <EmailIcon />
63
+ </InputAdornment>
64
+ }
65
+ rules={{
66
+ required: "Email required",
67
+ pattern: {
68
+ value:
69
+ /^(([^<>()[\]\\.,;:\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,}))$/,
70
+ message: "Invalid email address"
71
+ }
72
+ }}
73
+ helperText={errors.email?.message}
74
+ />
75
+ <HawaTextField
76
+ name="password"
77
+ placeholder="Minimum 8 characters"
78
+ type="password"
79
+ inputLabel="Password"
80
+ startAdornment={
81
+ <InputAdornment position="start">
82
+ <PasswordIcon />
83
+ </InputAdornment>
84
+ }
85
+ rules={{
86
+ required: "Password rquired",
87
+ minLength: {
88
+ value: 8,
89
+ message: "Password too short"
90
+ }
91
+ }}
92
+ helperText={errors.password?.message}
93
+ />
10
94
 
11
- <StyledInputLabel label="Email" />
12
- <StyledTextField type="text" />
13
- <StyledInputLabel label="Password" />
14
- <StyledTextField type="text" />
15
- <StyledInputLabel label="Confirm Password" />
16
- <StyledTextField type="text" />
17
- {props.children}
95
+ <ActionButton fullWidth type="submit" text="Sign Up" last />
96
+ </form>
97
+ </FormProvider>
98
+ </Box>
99
+ {props.viaGoogle && (
100
+ <GoogleButton
101
+ buttonText={props.googleButtonLabel}
102
+ handleClick={props.handleGoogleSignIn}
103
+ />
104
+ )}
105
+ {props.viaGithub && (
106
+ <GithubButton
107
+ buttonText={props.githubButtonLabel}
108
+ handleClick={props.handleGithubSignUp}
109
+ />
110
+ )}
111
+ {props.viaTwitter && (
112
+ <TwitterButton
113
+ buttonText={props.twitterButtonLabel}
114
+ handleClick={props.handleTwitterSignIn}
115
+ />
116
+ )}
18
117
  </Box>
19
118
  );
20
119
  };
120
+
121
+ SignUpForm.propTypes = {
122
+ theme: PropTypes.oneOf(["secondary", "primary"])
123
+ // buttonLabel: PropTypes.string,
124
+ // danger: PropTypes.bool,
125
+ // disabled: PropTypes.bool,
126
+ // showText: PropTypes.bool
127
+ };
@@ -0,0 +1,53 @@
1
+ import React, { useState } from "react";
2
+ import { HawaTextField, ActionButton, HawaTypography } from "../../ui";
3
+ import { Box } from "../../layout";
4
+ import { FormProvider, useForm } from "react-hook-form";
5
+
6
+ export const ChargeWalletForm = (props) => {
7
+ const [walletAmount, setWalletAmount] = useState(0);
8
+ const methods = useForm();
9
+ const {
10
+ formState: { errors },
11
+ handleSubmit
12
+ } = methods;
13
+
14
+ return (
15
+ <Box maxWidth={400} noColor noMargin noPadding>
16
+ <Box noMargin>
17
+ <HawaTypography variant="h2" align="center">
18
+ {Number(walletAmount).toLocaleString("en")}{" "}
19
+ <span style={{ fontSize: 20, letterSpacing: 1 }}>
20
+ {props.currency}
21
+ </span>
22
+ </HawaTypography>
23
+ <FormProvider {...methods}>
24
+ <form
25
+ onChange={(e) => {
26
+ e.preventDefault();
27
+ setWalletAmount(methods.getValues().amount);
28
+ }}
29
+ style={{ marginTop: 10 }}
30
+ onSubmit={handleSubmit(props.handleChargeWallet)}
31
+ >
32
+ <HawaTextField
33
+ name="amount"
34
+ placeholder="Enter amount"
35
+ type="number"
36
+ value={walletAmount}
37
+ rules={{
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>
52
+ );
53
+ };
@@ -0,0 +1,60 @@
1
+ import React from "react";
2
+ import { HawaTextField, ActionButton } from "../../ui";
3
+ import { Box } from "../../layout";
4
+ import { FormProvider, useForm } from "react-hook-form";
5
+
6
+ export const CreditCardForm = (props) => {
7
+ const methods = useForm();
8
+ const {
9
+ formState: { errors },
10
+ handleSubmit
11
+ } = methods;
12
+
13
+ return (
14
+ <Box maxWidth={400} noColor noMargin noPadding>
15
+ <Box noMargin>
16
+ <FormProvider {...methods}>
17
+ <form onSubmit={handleSubmit(props.handle)}>
18
+ <HawaTextField
19
+ name="password"
20
+ placeholder="Enter password"
21
+ type="password"
22
+ inputLabel="Password"
23
+ // startAdornment={
24
+ // <InputAdornment position="start">
25
+ // <PasswordIcon />
26
+ // </InputAdornment>
27
+ // }
28
+ rules={{
29
+ required: "Password is rquired"
30
+ }}
31
+ helperText={errors.password?.message}
32
+ />
33
+
34
+ <HawaTextField
35
+ name="password"
36
+ placeholder="Enter password"
37
+ type="password"
38
+ inputLabel="Password"
39
+ // startAdornment={
40
+ // <InputAdornment position="start">
41
+ // <PasswordIcon />
42
+ // </InputAdornment>
43
+ // }
44
+ rules={{
45
+ required: "Password is rquired"
46
+ }}
47
+ helperText={errors.password?.message}
48
+ />
49
+ <ActionButton
50
+ last
51
+ fullWidth
52
+ text={"Sign In"}
53
+ onClick={props.handleSignIn}
54
+ />
55
+ </form>
56
+ </FormProvider>
57
+ </Box>
58
+ </Box>
59
+ );
60
+ };
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState, useRef } from "react";
2
2
  import sha256 from "crypto-js/sha256";
3
- import Button from "@material-ui/core/Button";
4
- import CircularProgress from "@material-ui/core/CircularProgress";
3
+ import Button from "@mui/material/Button";
4
+ import CircularProgress from "@mui/material/CircularProgress";
5
5
  import useTranslation from "next-translate/useTranslation";
6
6
  import axios from "axios";
7
7
 
@@ -137,10 +137,8 @@ export default function CForm({
137
137
  onUpdateState("isCardFlipped", false);
138
138
  };
139
139
 
140
- const handlePayfortForm = (e) => {
141
-
142
- };
143
-
140
+ const handlePayfortForm = (e) => {};
141
+
144
142
  // NOTE: Currently the cursor on the card number field gets reset if we remove a number, the code bellow was used
145
143
  // in class components, need to transform this to work with functional components.
146
144
  // getSnapshotBeforeUpdate() {
@@ -307,7 +305,12 @@ export default function CForm({
307
305
  />
308
306
  )}
309
307
  </form>
310
- <Button variant="contained" color="primary" fullWidth onClick={handlePayfortForm}>
308
+ <Button
309
+ variant="contained"
310
+ color="primary"
311
+ fullWidth
312
+ onClick={handlePayfortForm}
313
+ >
311
314
  {loading ? (
312
315
  <CircularProgress
313
316
  variant="indeterminate"
@@ -323,4 +326,3 @@ export default function CForm({
323
326
  </div>
324
327
  );
325
328
  }
326
-
@@ -1,9 +1,9 @@
1
1
  import useTranslation from "next-translate/useTranslation";
2
- import Button from "@material-ui/core/Button";
3
- import Grid from "@material-ui/core/Grid";
4
- import Paper from "@material-ui/core/Paper";
5
- import CircularProgress from "@material-ui/core/CircularProgress";
6
- import { makeStyles } from "@material-ui/core/styles";
2
+ import Button from "@mui/material/Button";
3
+ import Grid from "@mui/material/Grid";
4
+ import Paper from "@mui/material/Paper";
5
+ import CircularProgress from "@mui/material/CircularProgress";
6
+ import { makeStyles } from "@mui/material/styles";
7
7
 
8
8
  const useStyles = makeStyles((theme) => ({
9
9
  root: {
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { ActionButton, WalletButton } from "../../ui";
3
+ import { Box } from "../../layout";
4
+
5
+ export const PayWithWallet = (props) => {
6
+ return (
7
+ <Box maxWidth={400} noColor noMargin noPadding>
8
+ <Box noMargin>
9
+ <div>Wallet Balance</div>
10
+ <ActionButton text="Pay now" />
11
+ </Box>
12
+ </Box>
13
+ );
14
+ };
@@ -1,6 +1,6 @@
1
1
  import useTranslation from "next-translate/useTranslation";
2
- import Button from "@material-ui/core/Button";
3
- import Chip from "@material-ui/core/Chip";
2
+ import Button from "@mui/material/Button";
3
+ import Chip from "@mui/material/Chip";
4
4
 
5
5
  const PaymentMethod = (props) => {
6
6
  const { t } = useTranslation("common");