@sikka/hawa 0.0.4 → 0.0.5

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 (96) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +10 -7
  4. package/src/blocks/Account/UserProfile.js +11 -11
  5. package/src/blocks/Account/UserSettings.js +11 -11
  6. package/src/blocks/AuthForms/NewPasswordForm.js +15 -8
  7. package/src/blocks/AuthForms/ResetPasswordForm.js +7 -8
  8. package/src/blocks/AuthForms/SignInForm.js +49 -13
  9. package/src/blocks/AuthForms/SignUpForm.js +61 -13
  10. package/src/blocks/Payment/CreditCardForm.js +31 -0
  11. package/src/blocks/Payment/Form/CForm.js +10 -8
  12. package/src/blocks/Payment/Gateway/Wallet.js +5 -5
  13. package/src/blocks/Payment/PaymentMethod.js +2 -2
  14. package/src/blocks/Payment/SelectPayment.js +95 -0
  15. package/src/blocks/Payment/index.js +16 -0
  16. package/src/index.js +3 -1
  17. package/src/layout/Box.js +31 -17
  18. package/src/stories/ActionButton.stories.js +23 -19
  19. package/src/stories/AdaptiveButton.stories.js +1 -1
  20. package/src/stories/BlocksStories/AuthForm.stories.js +99 -0
  21. package/src/stories/BlocksStories/PaymentForm.stories.js +111 -0
  22. package/src/stories/{UserAccount.stories.js → BlocksStories/UserAccount.stories.js} +2 -2
  23. package/src/stories/GlobalVariables.stories.js +33 -90
  24. package/src/stories/HawaProvider.stories.js +0 -1
  25. package/src/stories/LayoutStories/Box.stories.js +56 -0
  26. package/src/themes/HawaProvider.js +59 -17
  27. package/src/ui/ActionButton.js +35 -10
  28. package/src/ui/AdaptiveButton.js +29 -29
  29. package/src/ui/ApplePayButton.js +94 -0
  30. package/src/ui/AutoCompleteField.js +0 -1
  31. package/src/ui/Checkbox.js +2 -2
  32. package/src/ui/DragDropImages.js +2 -2
  33. package/src/ui/GithubButton.js +91 -0
  34. package/src/ui/GoogleButton.js +83 -0
  35. package/src/ui/GooglePayButton.js +94 -0
  36. package/src/ui/HawaInputLabel.js +33 -0
  37. package/src/ui/{TextArea.js → HawaTextArea.js} +2 -2
  38. package/src/ui/HawaTextField.js +118 -0
  39. package/src/ui/MadaButton.js +94 -0
  40. package/src/ui/PayPalButton.js +94 -0
  41. package/src/ui/RadioBox.js +2 -2
  42. package/src/ui/STCPayButton.js +94 -0
  43. package/src/ui/SelectedField.js +4 -4
  44. package/src/ui/StyledTooltip.js +1 -1
  45. package/src/ui/TabPanel.js +1 -1
  46. package/src/ui/TwitterButton.js +84 -0
  47. package/src/ui/VisaMasterButton.js +94 -0
  48. package/src/ui/WalletButton.js +91 -0
  49. package/src/ui/index.js +21 -12
  50. package/storybook-static/0.54f7e52e.iframe.bundle.js +1 -0
  51. package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +1 -0
  52. package/storybook-static/1.95be85dd.iframe.bundle.js +3 -0
  53. package/storybook-static/{1.4e43f671.iframe.bundle.js.LICENSE.txt → 1.95be85dd.iframe.bundle.js.LICENSE.txt} +0 -0
  54. package/storybook-static/1.95be85dd.iframe.bundle.js.map +1 -0
  55. package/storybook-static/2.eb601582.iframe.bundle.js +1 -0
  56. package/storybook-static/{3.c1dc7159.iframe.bundle.js → 3.d72f7fac.iframe.bundle.js} +0 -0
  57. package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +2 -0
  58. package/storybook-static/{4.8c311a6b48cad9f29317.manager.bundle.js.LICENSE.txt → 4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt} +0 -0
  59. package/storybook-static/{5.88fe62ee92ff5ca67829.manager.bundle.js → 5.63ab4f94d50a3acf080d.manager.bundle.js} +1 -1
  60. package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js → 6.a6d45262f7e98f3f18d3.manager.bundle.js} +2 -2
  61. package/storybook-static/{6.96d184f368dea006cb52.manager.bundle.js.LICENSE.txt → 6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt} +0 -0
  62. package/storybook-static/{7.5ec31f3702b08ab0b71c.manager.bundle.js → 7.097710753af9a1c41b80.manager.bundle.js} +1 -1
  63. package/storybook-static/{7.69d2e532.iframe.bundle.js → 7.ffb0d84b.iframe.bundle.js} +1 -1
  64. package/storybook-static/{8.5ce13be7612bd3a6b864.manager.bundle.js → 8.76c3cbf398692028e834.manager.bundle.js} +1 -1
  65. package/storybook-static/iframe.html +1 -1
  66. package/storybook-static/index.html +1 -1
  67. package/storybook-static/main.044648aa.iframe.bundle.js +1 -0
  68. package/storybook-static/main.ac6e4b72b033097dad76.manager.bundle.js +1 -0
  69. package/storybook-static/{runtime~main.6e2e1544.iframe.bundle.js → runtime~main.3e280e98.iframe.bundle.js} +1 -1
  70. package/storybook-static/{runtime~main.cc29f4c2175f187a3707.manager.bundle.js → runtime~main.c8dac23bc753439736f0.manager.bundle.js} +1 -1
  71. package/storybook-static/vendors~main.a697e07137d366f95f76.manager.bundle.js +2 -0
  72. package/storybook-static/{vendors~main.f228d62e92b69563cefb.manager.bundle.js.LICENSE.txt → vendors~main.a697e07137d366f95f76.manager.bundle.js.LICENSE.txt} +0 -0
  73. package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js +76 -0
  74. package/storybook-static/{vendors~main.d144d840.iframe.bundle.js.LICENSE.txt → vendors~main.d75dc38b.iframe.bundle.js.LICENSE.txt} +3 -45
  75. package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js.map +1 -0
  76. package/src/blocks/AuthForms/viaFacebook.js +0 -0
  77. package/src/blocks/AuthForms/viaGithub.js +0 -0
  78. package/src/blocks/AuthForms/viaGoogle.js +0 -0
  79. package/src/blocks/AuthForms/viaTwitter.js +0 -0
  80. package/src/blocks/index.js +0 -13
  81. package/src/stories/AuthForm.stories.js +0 -79
  82. package/src/stories/Box.stories.js +0 -64
  83. package/src/ui/StyledInputLabel.js +0 -19
  84. package/src/ui/TextField.js +0 -62
  85. package/storybook-static/0.d3bc3395610cf5d3ee94.manager.bundle.js +0 -1
  86. package/storybook-static/0.dd3d47f5.iframe.bundle.js +0 -1
  87. package/storybook-static/1.4e43f671.iframe.bundle.js +0 -3
  88. package/storybook-static/1.4e43f671.iframe.bundle.js.map +0 -1
  89. package/storybook-static/2.9a757207.iframe.bundle.js +0 -1
  90. package/storybook-static/4.8c311a6b48cad9f29317.manager.bundle.js +0 -2
  91. package/storybook-static/main.65cb2769.iframe.bundle.js +0 -1
  92. package/storybook-static/main.7e391cf7bf72b0d18ea5.manager.bundle.js +0 -1
  93. package/storybook-static/vendors~main.d144d840.iframe.bundle.js +0 -3
  94. package/storybook-static/vendors~main.d144d840.iframe.bundle.js.map +0 -1
  95. package/storybook-static/vendors~main.f228d62e92b69563cefb.manager.bundle.js +0 -2
  96. package/yarn-error.log +0 -10910
@@ -1,17 +1,24 @@
1
1
  import React, { useContext } from "react";
2
2
  import { Box } from "../../layout";
3
3
  import { ThemeProvider } from "../../themes/HawaProvider";
4
- import { StyledTextField, StyledInputLabel } from "../../ui";
4
+ import { ActionButton, HawaTextField, HawaInputLabel } from "../../ui";
5
5
  export const NewPasswordForm = (props) => {
6
6
  const theme = useContext(ThemeProvider);
7
7
  return (
8
- <Box maxWidth={400} >
9
-
10
- <StyledInputLabel label="Password" />
11
- <StyledTextField type="password" />
12
- <StyledInputLabel label="Confirm Password" />
13
- <StyledTextField type="password" />
14
- {props.children}
8
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
9
+ <Box themeType={props.theme} noMargin>
10
+ <HawaTextField
11
+ themeType={props.theme}
12
+ type="password"
13
+ inputLabel="Password"
14
+ />
15
+ <HawaTextField
16
+ themeType={props.theme}
17
+ type="password"
18
+ inputLabel="Confirm Password"
19
+ />
20
+ <ActionButton themeType={props.theme} last text="Reset Password" />
21
+ </Box>
15
22
  </Box>
16
23
  );
17
24
  };
@@ -1,14 +1,13 @@
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 { HawaTextField, HawaInputLabel, ActionButton } from "../../ui";
5
4
  export const ResetPasswordForm = (props) => {
6
- const theme = useContext(ThemeProvider);
7
5
  return (
8
- <Box maxWidth={400} >
9
- <StyledInputLabel label="Email" />
10
- <StyledTextField type="text" />
11
- {props.children}
6
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
7
+ <Box themeType={props.theme} noMargin>
8
+ <HawaTextField themeType={props.theme} type="text" inputLabel="Email" />
9
+ <ActionButton themeType={props.theme} last text="Reset Password" />
10
+ </Box>
12
11
  </Box>
13
12
  );
14
13
  };
@@ -1,19 +1,55 @@
1
- import React, { useContext } from "react";
2
- import { ThemeProvider } from "../../themes/HawaProvider";
3
- import { StyledTextField, StyledInputLabel } from "../../ui";
4
- import { Box } from '../../layout'
1
+ import React from "react";
2
+ import {
3
+ HawaTextField,
4
+ ActionButton,
5
+ GoogleButton,
6
+ TwitterButton,
7
+ GithubButton
8
+ } from "../../ui";
9
+ import { Box } from "../../layout";
10
+
5
11
  export const SignInForm = (props) => {
6
- const theme = useContext(ThemeProvider);
7
12
  return (
8
- <Box maxWidth={400}>
9
-
10
- <StyledInputLabel label="Email" />
11
- <StyledTextField type="text" />
12
- <StyledInputLabel label="Password" />
13
- <StyledTextField type="text" />
14
-
15
- {props.children}
13
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
14
+ <Box themeType={props.theme} noMargin>
15
+ <HawaTextField themeType={props.theme} type="text" inputLabel="Email" />
16
16
 
17
+ <HawaTextField
18
+ themeType={props.theme}
19
+ type="text"
20
+ inputLabel="Password"
21
+ />
22
+ <ActionButton
23
+ last
24
+ text={"Sign In"}
25
+ themeType={props.theme}
26
+ onClick={props.handleSignIn}
27
+ />
28
+ </Box>
29
+ {props.viaGoogle && (
30
+ <GoogleButton
31
+ themeType={props.theme}
32
+ outlined
33
+ buttonText={props.googleButtonLabel}
34
+ handleClick={props.handleGoogleSignIn}
35
+ />
36
+ )}
37
+ {props.viaGithub && (
38
+ <GithubButton
39
+ outlined
40
+ themeType={props.theme}
41
+ buttonText={props.githubButtonLabel}
42
+ handleClick={props.handleGithubSignIn}
43
+ />
44
+ )}
45
+ {props.viaTwitter && (
46
+ <TwitterButton
47
+ outlined
48
+ themeType={props.theme}
49
+ buttonText={props.twitterButtonLabel}
50
+ handleClick={props.handleTwitterSignIn}
51
+ />
52
+ )}
17
53
  </Box>
18
54
  );
19
55
  };
@@ -1,20 +1,68 @@
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
+ } from "../../ui";
10
+ import PropTypes from "prop-types";
5
11
 
6
12
  export const SignUpForm = (props) => {
7
- const theme = useContext(ThemeProvider);
8
13
  return (
9
- <Box maxWidth={400}>
10
-
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}
14
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
15
+ <Box themeType={props.theme} noMargin>
16
+ <HawaTextField themeType={props.theme} type="text" inputLabel="Email" />
17
+ <HawaTextField
18
+ themeType={props.theme}
19
+ type="text"
20
+ inputLabel="Password"
21
+ />
22
+ <HawaTextField
23
+ themeType={props.theme}
24
+ type="text"
25
+ inputLabel="Confirm Password"
26
+ />
27
+ <ActionButton
28
+ text="Sign Up"
29
+ last
30
+ themeType={props.theme}
31
+ onClick={props.handleSignUp}
32
+ />
33
+ </Box>
34
+ {props.viaGoogle && (
35
+ <GoogleButton
36
+ outlined
37
+ themeType={props.theme}
38
+ buttonText={props.googleButtonLabel}
39
+ handleClick={props.handleGoogleSignIn}
40
+ />
41
+ )}
42
+ {props.viaGithub && (
43
+ <GithubButton
44
+ outlined
45
+ themeType={props.theme}
46
+ buttonText={props.githubButtonLabel}
47
+ handleClick={props.handleGithubSignUp}
48
+ />
49
+ )}
50
+ {props.viaTwitter && (
51
+ <TwitterButton
52
+ outlined
53
+ themeType={props.theme}
54
+ buttonText={props.twitterButtonLabel}
55
+ handleClick={props.handleTwitterSignIn}
56
+ />
57
+ )}
18
58
  </Box>
19
59
  );
20
60
  };
61
+
62
+ SignUpForm.propTypes = {
63
+ theme: PropTypes.oneOf(["secondary", "primary"])
64
+ // buttonLabel: PropTypes.string,
65
+ // danger: PropTypes.bool,
66
+ // disabled: PropTypes.bool,
67
+ // showText: PropTypes.bool
68
+ };
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import {
3
+ HawaTextField,
4
+ ActionButton,
5
+ GoogleButton,
6
+ TwitterButton,
7
+ GithubButton
8
+ } from "../../ui";
9
+ import { Box } from "../../layout";
10
+
11
+ export const CreditCardForm = (props) => {
12
+ return (
13
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
14
+ <Box themeType={props.theme} noMargin>
15
+ <HawaTextField themeType={props.theme} type="text" inputLabel="Email" />
16
+
17
+ <HawaTextField
18
+ themeType={props.theme}
19
+ type="text"
20
+ inputLabel="Password"
21
+ />
22
+ <ActionButton
23
+ last
24
+ text={"Sign In"}
25
+ themeType={props.theme}
26
+ onClick={props.handleSignIn}
27
+ />
28
+ </Box>
29
+ </Box>
30
+ );
31
+ };
@@ -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: {
@@ -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");
@@ -0,0 +1,95 @@
1
+ import React from "react";
2
+ import {
3
+ HawaTextField,
4
+ ActionButton,
5
+ GoogleButton,
6
+ TwitterButton,
7
+ GithubButton,
8
+ VisaMasterButton,
9
+ MadaButton,
10
+ STCPayButton,
11
+ PayPalButton,
12
+ GooglePayButton,
13
+ ApplePayButton,
14
+ WalletButton
15
+ } from "../../ui";
16
+ import { Box } from "../../layout";
17
+ import PropTypes from "prop-types";
18
+
19
+ export const SelectPayment = (props) => {
20
+ return (
21
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
22
+ <Box themeType={props.theme} noMargin>
23
+ <div>Choose Payment</div>
24
+ {props.viaWallet && (
25
+ <WalletButton
26
+ themeType={props.theme}
27
+ outlined
28
+ buttonText={props.walletLabel}
29
+ handleClick={props.handleWallet}
30
+ />
31
+ )}
32
+ {props.viaCreditCard && (
33
+ <VisaMasterButton
34
+ themeType={props.theme}
35
+ outlined
36
+ buttonText={props.visaMasterLabel}
37
+ handleClick={props.handleCreditCard}
38
+ />
39
+ )}
40
+ {props.viaMada && (
41
+ <MadaButton
42
+ themeType={props.theme}
43
+ outlined
44
+ buttonText={props.madaLabel}
45
+ handleClick={props.handleMada}
46
+ />
47
+ )}
48
+
49
+ {props.viaSTCPay && (
50
+ <STCPayButton
51
+ themeType={props.theme}
52
+ outlined
53
+ buttonText={props.stcPayLabel}
54
+ handleClick={props.handleSTCPay}
55
+ />
56
+ )}
57
+ {props.viaPayPal && (
58
+ <PayPalButton
59
+ themeType={props.theme}
60
+ outlined
61
+ buttonText={props.paypalLabel}
62
+ handleClick={props.handlePayPal}
63
+ />
64
+ )}
65
+ {props.viaGooglePay && (
66
+ <GooglePayButton
67
+ themeType={props.theme}
68
+ outlined
69
+ buttonText={props.googlePayLabel}
70
+ handleClick={props.handleGooglePay}
71
+ />
72
+ )}
73
+
74
+ {props.viaApplePay && (
75
+ <ApplePayButton
76
+ themeType={props.theme}
77
+ outlined
78
+ buttonText={props.applePayLabel}
79
+ handleClick={props.handleApplePay}
80
+ />
81
+ )}
82
+ </Box>
83
+ </Box>
84
+ );
85
+ };
86
+
87
+ HawaTextField.propTypes = {
88
+ theme: PropTypes.oneOf(["secondary", "primary"]),
89
+ viaApplePay: PropTypes.bool,
90
+ viaGooglePay: PropTypes.bool,
91
+ viaSTCPay: PropTypes.bool,
92
+ viaCreditCard: PropTypes.bool,
93
+ viaPayPal: PropTypes.bool,
94
+ handleApplePay: PropTypes.func
95
+ };
@@ -0,0 +1,16 @@
1
+ // "use strict";
2
+
3
+ // var _GooglePay = require("./Gateway/GooglePay");
4
+ // var _Payfort = require("./Gateway/Payfort");
5
+ // var _Paypal = require("./Gateway/Paypal");
6
+ // var _Wallet = require("./Gateway/Wallet");
7
+ // var _PaymentMethod = require("./PaymentMethod");
8
+
9
+ // exports.GooglePay = _GooglePay.default;
10
+ // exports.Payfort = _Payfort.default;
11
+ // exports.Paypal = _Paypal.default;
12
+ // exports.Wallet = _Wallet.default;
13
+ // exports.PaymentMethod = _PaymentMethod.default;
14
+
15
+ export * from "./SelectPayment";
16
+ export * from "./CreditCardForm";
package/src/index.js CHANGED
@@ -1,2 +1,4 @@
1
- export * from "./blocks";
1
+ export * from "./blocks/Account";
2
+ export * from "./blocks/AuthForms";
3
+ export * from "./blocks/Payment";
2
4
  //export * from "./components/Hawa";
package/src/layout/Box.js CHANGED
@@ -3,23 +3,37 @@ import { ThemeProvider } from "../themes/HawaProvider";
3
3
 
4
4
  export const Box = (props) => {
5
5
  const theme = useContext(ThemeProvider);
6
- return (
7
- <div
8
- style={{
9
- display: 'flex',
10
- flexDirection: 'column',
11
- // justifyContent: 'center',
12
- // alignItems: 'center',
6
+ let boxStyle = {};
13
7
 
14
- backgroundColor: theme.layoutColor,
15
- color: theme.textColor,
16
- padding: theme.paddings,
17
- margin: theme.margins,
18
- borderRadius: theme.borderRadius,
19
- maxWidth: props.maxWidth
20
- }}
21
- >
22
- {props.children}
23
- </div>
8
+ console.log(Object.keys(theme.actionButton));
9
+ let currentTheme = Object.keys(theme.actionButton).find(
10
+ (themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
24
11
  );
12
+ if (currentTheme) {
13
+ boxStyle = {
14
+ display: "flex",
15
+ flexDirection: "column",
16
+ ...theme.layout[currentTheme],
17
+ backgroundColor: props.noColor
18
+ ? "none"
19
+ : theme.layout[currentTheme].backgroundColor,
20
+ padding: props.noPadding ? 0 : theme.layout[currentTheme].padding,
21
+ margin: props.noMargin ? 0 : theme.layout[currentTheme].margin,
22
+ maxWidth: props.maxWidth
23
+ };
24
+ } else {
25
+ boxStyle = {
26
+ display: "flex",
27
+ flexDirection: "column",
28
+ color: "white",
29
+ marginTop: props.last ? 10 * 2 : 0,
30
+ backgroundColor: props.noColor ? "none" : "lightGrey",
31
+ padding: props.noPadding ? 0 : 10,
32
+ margin: props.noMargin ? 0 : 10,
33
+ maxWidth: props.maxWidth,
34
+ borderRadius: 0
35
+ };
36
+ }
37
+
38
+ return <div style={boxStyle}>{props.children}</div>;
25
39
  };
@@ -4,18 +4,9 @@ import { defaultTheme, HawaProvider } from "../themes/HawaProvider";
4
4
  import { ActionButton } from "../ui";
5
5
 
6
6
  const Template = (args) => {
7
- const theme = {
8
- borderRadius: 10,
9
- primaryColor: "green",
10
- secondaryColor: "red",
11
- // margins: "10px",
12
- paperColors: "#c6c6c6",
13
- paddings: 10,
14
- margins: 10
15
- };
16
7
  return (
17
- <HawaProvider theme={{ ...defaultTheme, ...args.theme }}>
18
- <ActionButton secondary={args.secondary} text='here' />
8
+ <HawaProvider theme={{ ...defaultTheme }}>
9
+ <ActionButton themeType={args.theme} text={args.buttonLabel} />
19
10
  </HawaProvider>
20
11
  );
21
12
  };
@@ -26,24 +17,37 @@ const Template = (args) => {
26
17
 
27
18
  export default {
28
19
  title: "UI/ActionButton",
29
- component: ActionButton
20
+ component: ActionButton,
21
+ argTypes: {
22
+ theme: {
23
+ description: "overwritten description",
24
+ table: {
25
+ type: {
26
+ summary: "something short"
27
+ },
28
+ defaultValue: { summary: "Hello" }
29
+ },
30
+ options: ["primary", "secondary", "default"],
31
+ control: { type: "select" }
32
+ }
33
+ }
30
34
  };
31
35
 
36
+ Template.args = {
37
+ showText: true,
38
+ buttonLabel: "test",
39
+ theme: "primary"
40
+ };
32
41
  export const Primary = Template.bind({});
33
42
  Primary.args = {
34
43
  showText: true,
35
44
  buttonLabel: "test",
36
- borderRadius: 5,
37
- textColor: "#000000",
38
- buttonColor: "#f9f9f9"
45
+ theme: "primary"
39
46
  };
40
47
 
41
48
  export const Secondary = Template.bind({});
42
49
  Secondary.args = {
43
- secondary: true,
44
50
  showText: true,
45
51
  buttonLabel: "test",
46
- borderRadius: 5,
47
- textColor: "#000000",
48
- buttonColor: "#f9f9f9",
52
+ theme: "secondary"
49
53
  };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import CastIcon from "@material-ui/icons/Cast";
2
+ import CastIcon from "@mui/icons-material/Cast";
3
3
  import { HawaProvider } from "../themes/HawaProvider";
4
4
  import { AdaptiveButton } from "../ui";
5
5
 
@@ -0,0 +1,99 @@
1
+ import React from "react";
2
+ import {
3
+ NewPasswordForm,
4
+ ResetPasswordForm,
5
+ SignInForm,
6
+ SignUpForm
7
+ } from "../../blocks/AuthForms";
8
+ import { defaultTheme, HawaProvider } from "../../themes/HawaProvider";
9
+
10
+ export default {
11
+ title: "Blocks/AuthBlocks",
12
+ component: [SignInForm, SignUpForm, NewPasswordForm, NewPasswordForm],
13
+ argTypes: {
14
+ theme: {
15
+ options: ["primary", "secondary", "default"],
16
+ control: { type: "select" }
17
+ }
18
+ }
19
+ };
20
+
21
+ const SignInTemplate = (args) => {
22
+ return (
23
+ <HawaProvider theme={{ ...defaultTheme }}>
24
+ <SignInForm
25
+ {...args}
26
+ theme={args.theme}
27
+ handleSignIn={() => console.log("singing in via email")}
28
+ viaGoogle={args.viaGoogle}
29
+ googleButtonLabel={"Sign in with Google"}
30
+ handleGoogleSignIn={() => console.log("signing in via google")}
31
+ viaGithub={args.viaGithub}
32
+ githubButtonLabel={"Sign in with Github"}
33
+ handleGithubSignIn={() => console.log("signing in via github")}
34
+ viaTwitter={args.viaTwitter}
35
+ twitterButtonLabel={"Sign in with Twitter"}
36
+ handleTwitterSignIn={() => console.log("signing in via Twitter")}
37
+ />
38
+ </HawaProvider>
39
+ );
40
+ };
41
+
42
+ export const SignIn = SignInTemplate.bind({});
43
+ SignIn.args = {
44
+ viaGoogle: true,
45
+ viaGithub: true,
46
+ viaTwitter: true,
47
+ theme: "primary"
48
+ };
49
+
50
+ const SignUpTemplate = (args) => {
51
+ return (
52
+ <HawaProvider theme={{ ...defaultTheme }}>
53
+ <SignUpForm
54
+ {...args}
55
+ theme={args.theme}
56
+ handleSignUp={() => console.log("singing up via email")}
57
+ viaGoogle={args.viaGoogle}
58
+ googleButtonLabel={"Sign up with Google"}
59
+ handleGoogleSignUp={() => console.log("signing up via google")}
60
+ viaGithub={args.viaGithub}
61
+ githubButtonLabel={"Sign up with Github"}
62
+ handleGithubSignUp={() => console.log("signing up via github")}
63
+ viaTwitter={args.viaTwitter}
64
+ twitterButtonLabel={"Sign up with Twitter"}
65
+ handleTwitterSignUp={() => console.log("signing up via Twitter")}
66
+ />
67
+ </HawaProvider>
68
+ );
69
+ };
70
+ export const SignUp = SignUpTemplate.bind({});
71
+ SignUp.args = {
72
+ viaGoogle: true,
73
+ viaGithub: true,
74
+ viaTwitter: true,
75
+ theme: "primary"
76
+ };
77
+
78
+ const ResetPasswordTemplate = (args) => {
79
+ return (
80
+ <HawaProvider theme={{ ...defaultTheme }}>
81
+ <ResetPasswordForm theme={args.theme} {...args} />
82
+ </HawaProvider>
83
+ );
84
+ };
85
+ export const ResetPassword = ResetPasswordTemplate.bind({});
86
+ ResetPassword.args = {
87
+ theme: "primary"
88
+ };
89
+ const NewPasswordTemplate = (args) => {
90
+ return (
91
+ <HawaProvider theme={{ ...defaultTheme }}>
92
+ <NewPasswordForm theme={args.theme} {...args} />
93
+ </HawaProvider>
94
+ );
95
+ };
96
+ export const NewPassword = NewPasswordTemplate.bind({});
97
+ NewPassword.args = {
98
+ theme: "primary"
99
+ };