@sikka/hawa 0.0.11 → 0.0.14

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 (84) hide show
  1. package/es/index.es.js +1 -1
  2. package/lib/index.js +1 -1
  3. package/package.json +3 -3
  4. package/src/blocks/Account/{UserProfile.js → UserProfileForm.js} +16 -7
  5. package/src/blocks/Account/UserSettingsForm.js +13 -0
  6. package/src/blocks/Account/index.js +2 -2
  7. package/src/blocks/AuthForms/NewPasswordForm.js +1 -1
  8. package/src/blocks/AuthForms/ResetPasswordForm.js +1 -1
  9. package/src/blocks/AuthForms/SignInForm.js +10 -11
  10. package/src/blocks/AuthForms/SignUpForm.js +2 -1
  11. package/src/blocks/Payment/ChargeWalletForm.js +40 -37
  12. package/src/blocks/Payment/CreditCardForm.js +50 -45
  13. package/src/blocks/Payment/PayWithWallet.js +17 -7
  14. package/src/blocks/Payment/SelectPayment.js +8 -9
  15. package/src/blocks/Pricing/PricingPlans.js +47 -0
  16. package/src/{ui → elements}/ActionButton.js +0 -0
  17. package/src/elements/AdaptiveButton.js +32 -0
  18. package/src/{ui → elements}/AutoCompleteField.js +0 -0
  19. package/src/{ui → elements}/DragDropImages.js +0 -0
  20. package/src/{ui → elements}/Hawa.js +0 -0
  21. package/src/{ui → elements}/HawaAlert.js +0 -0
  22. package/src/{ui → elements}/HawaButton.js +0 -0
  23. package/src/{ui → elements}/HawaCheckbox.js +0 -0
  24. package/src/{ui → elements}/HawaInputLabel.js +0 -0
  25. package/src/{ui → elements}/HawaLogoButton.js +0 -0
  26. package/src/elements/HawaPricingCard.js +115 -0
  27. package/src/elements/HawaRadio.js +30 -0
  28. package/src/elements/HawaSettingsRow.js +27 -0
  29. package/src/elements/HawaSwitch.js +6 -0
  30. package/src/{ui → elements}/HawaTextArea.js +0 -0
  31. package/src/{ui → elements}/HawaTextField.js +0 -0
  32. package/src/{ui → elements}/HawaTypography.js +0 -0
  33. package/src/{ui → elements}/RadioBox.js +0 -0
  34. package/src/{ui → elements}/Row.js +0 -0
  35. package/src/{ui → elements}/SelectedField.js +0 -0
  36. package/src/{ui → elements}/StyledTooltip.js +0 -0
  37. package/src/{ui → elements}/TabPanel.js +0 -0
  38. package/src/{ui → elements}/index.js +1 -1
  39. package/src/stories/BlocksStories/Account/UserProfile.stories.js +21 -0
  40. package/src/stories/BlocksStories/Account/UserSettings.stories.js +55 -0
  41. package/src/stories/BlocksStories/Auth/NewPassword.stories.js +60 -0
  42. package/src/stories/BlocksStories/Auth/ResetPassword.stories.js +59 -0
  43. package/src/stories/BlocksStories/Auth/SignIn.stories.js +89 -0
  44. package/src/stories/BlocksStories/Auth/SignUp.stories.js +90 -0
  45. package/src/stories/BlocksStories/Payment/ChargeWallet.stories.js +30 -0
  46. package/src/stories/BlocksStories/Payment/PayWithCreditCard.stories.js +37 -0
  47. package/src/stories/BlocksStories/Payment/PayWithWallet.stories.js +17 -0
  48. package/src/stories/BlocksStories/{PaymentForm.stories.js → Payment/PaymentSelection.stories.js} +12 -23
  49. package/src/stories/BlocksStories/Pricing/BillingPlans.stories.js +46 -0
  50. package/src/stories/BlocksStories/Pricing/LandingPlans.stories.js +45 -0
  51. package/src/stories/ElementsStories/AdaptiveButton.stories.js +51 -0
  52. package/src/stories/{UIStories → ElementsStories}/Alert.stories.js +1 -1
  53. package/src/stories/{UIStories → ElementsStories}/InputLabel.stories.js +1 -1
  54. package/src/stories/ElementsStories/ItemCard.stories.js +18 -0
  55. package/src/stories/ElementsStories/LogoButtons.stories.js +73 -0
  56. package/src/stories/ElementsStories/PricingCard.stories.js +91 -0
  57. package/src/stories/ElementsStories/RadioSelector.stories.js +36 -0
  58. package/src/stories/ElementsStories/SettingsRow.stories.js +63 -0
  59. package/src/stories/{UIStories → ElementsStories}/TextField.stories.js +1 -1
  60. package/src/stories/LayoutStories/Box.stories.js +10 -24
  61. package/src/styles.css +1 -0
  62. package/storybook-static/iframe.html +1 -1
  63. package/storybook-static/index.html +1 -1
  64. package/storybook-static/main.e382d866.iframe.bundle.js +1 -0
  65. package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js +76 -0
  66. package/storybook-static/{vendors~main.f8d30727.iframe.bundle.js.LICENSE.txt → vendors~main.5eab66d3.iframe.bundle.js.LICENSE.txt} +0 -0
  67. package/storybook-static/vendors~main.5eab66d3.iframe.bundle.js.map +1 -0
  68. package/src/blocks/Account/UserSettings.js +0 -14
  69. package/src/stories/BlocksStories/AuthForm.stories.js +0 -171
  70. package/src/stories/BlocksStories/UserForm.stories.js +0 -27
  71. package/src/stories/UIStories/ActionButton.stories.js +0 -41
  72. package/src/stories/UIStories/AdaptiveButton.stories.js +0 -76
  73. package/src/stories/UIStories/CheckBox.stories.js +0 -34
  74. package/src/stories/UIStories/LogoButtons.stories.js +0 -86
  75. package/src/stories/UIStories/RadioSelector.stories.js +0 -50
  76. package/src/stories/UIStories/SettingsRow.stories.js +0 -51
  77. package/src/themes/HawaProvider.js +0 -192
  78. package/src/themes/QawaimTheme.js +0 -199
  79. package/src/ui/AdaptiveButton.js +0 -131
  80. package/src/ui/HawaRadio.js +0 -64
  81. package/src/ui/HawaSettingsRow.js +0 -45
  82. package/storybook-static/main.b00949db.iframe.bundle.js +0 -1
  83. package/storybook-static/vendors~main.f8d30727.iframe.bundle.js +0 -76
  84. package/storybook-static/vendors~main.f8d30727.iframe.bundle.js.map +0 -1
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { Box } from "../../layout";
4
- import { HawaTextField, HawaTypography, HawaLogoButton } from "../../ui";
3
+ import { HawaTextField, HawaTypography, HawaLogoButton } from "../../elements";
5
4
  import { Container } from "@mui/material";
6
5
 
7
6
  export const SelectPayment = (props) => {
8
7
  return (
9
- <Container maxWidth="xs" >
8
+ <Container maxWidth="xs">
10
9
  <HawaTypography align="center">Choose Payment Method</HawaTypography>
11
10
  {props.viaWallet && (
12
11
  <HawaLogoButton
@@ -19,42 +18,42 @@ export const SelectPayment = (props) => {
19
18
  <HawaLogoButton
20
19
  logo="visa/master"
21
20
  buttonText={props.visaMasterLabel}
22
- handleClick={props.handleCreditCard}
21
+ onClick={props.handleCreditCard}
23
22
  />
24
23
  )}
25
24
  {props.viaMada && (
26
25
  <HawaLogoButton
27
26
  logo="mada"
28
27
  buttonText={props.madaLabel}
29
- handleClick={props.handleMada}
28
+ onClick={props.handleMada}
30
29
  />
31
30
  )}
32
31
  {props.viaSTCPay && (
33
32
  <HawaLogoButton
34
33
  logo="stcpay"
35
34
  buttonText={props.stcPayLabel}
36
- handleClick={props.handleSTCPay}
35
+ onClick={props.handleSTCPay}
37
36
  />
38
37
  )}
39
38
  {props.viaPayPal && (
40
39
  <HawaLogoButton
41
40
  logo="paypal"
42
41
  buttonText={props.paypalLabel}
43
- handleClick={props.handlePayPal}
42
+ onClick={props.handlePayPal}
44
43
  />
45
44
  )}
46
45
  {props.viaGooglePay && (
47
46
  <HawaLogoButton
48
47
  logo="googlepay"
49
48
  buttonText={props.googlePayLabel}
50
- handleClick={props.handleGooglePay}
49
+ onClick={props.handleGooglePay}
51
50
  />
52
51
  )}
53
52
  {props.viaApplePay && (
54
53
  <HawaLogoButton
55
54
  logo="applepay"
56
55
  buttonText={props.applePayLabel}
57
- handleClick={props.handleApplePay}
56
+ onClick={props.handleApplePay}
58
57
  />
59
58
  )}
60
59
  </Container>
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import Container from "@mui/material/Container";
3
+ import { HawaPricingCard, HawaRadio } from "../../elements";
4
+
5
+ export const PricingPlans = (props) => {
6
+ return (
7
+ <Container style={{ width: "fit-content" }} variant="plain">
8
+ <div
9
+ style={{
10
+ display: "flex",
11
+ flexDirection: "row",
12
+ justifyContent: "space-between",
13
+
14
+ marginBottom: 10
15
+ }}
16
+ >
17
+ <HawaRadio
18
+ location="inPricing"
19
+ handleChange={(e) => console.log("changing to ", e)}
20
+ defaultValue="usd"
21
+ options={[
22
+ { label: `Monthly`, value: `usd` },
23
+ { label: `3 Months`, value: `3-months` },
24
+ { label: `6 Months`, value: `6-months` },
25
+ { label: `Annually`, value: `annual` }
26
+ ]}
27
+ />
28
+
29
+ <HawaRadio
30
+ location="inPricing"
31
+ handleChange={(e) => console.log("changing to ", e)}
32
+ defaultValue="usd"
33
+ options={[
34
+ { label: `USD`, value: `usd` },
35
+ { label: `SAR`, value: `sar` }
36
+ ]}
37
+ />
38
+ </div>
39
+
40
+ <Container variant="pricing">
41
+ {props.plans.map((plan) => {
42
+ return <HawaPricingCard lang={props.lang} {...plan} />;
43
+ })}
44
+ </Container>
45
+ </Container>
46
+ );
47
+ };
File without changes
@@ -0,0 +1,32 @@
1
+ import React, { useState } from "react";
2
+ import Button from "@mui/material/Button";
3
+ import Tooltip from "@mui/material/Tooltip";
4
+ import PropTypes from "prop-types";
5
+ import { StyledTooltip } from "./StyledTooltip";
6
+ import { getTextColor } from "../util";
7
+
8
+ export const AdaptiveButton = (props) => {
9
+ if (props.showText) {
10
+ return (
11
+ <Button variant="adaptive-dark" onClick={props.onClick}>
12
+ {props.icon}
13
+ <div style={{ width: 10 }} />
14
+ {props.buttonText}
15
+ </Button>
16
+ );
17
+ } else {
18
+ //icon only
19
+ return (
20
+ <Tooltip title={props.buttonText} placement="top">
21
+ <Button variant="adaptive-dark" onClick={props.onClick}>
22
+ {props.icon}
23
+ </Button>
24
+ </Tooltip>
25
+ );
26
+ }
27
+ };
28
+
29
+ AdaptiveButton.propTypes = {
30
+ buttonText: PropTypes.string,
31
+ showText: PropTypes.bool
32
+ };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,115 @@
1
+ import React from "react";
2
+ import Container from "@mui/material/Container";
3
+ import { Button, Typography } from "@mui/material";
4
+ import CheckIcon from "@mui/icons-material/CheckCircleOutlined";
5
+ export const HawaPricingCard = (props) => {
6
+ return (
7
+ <Container
8
+ maxWidth="xs"
9
+ variant={props.selectedPlan ? "selected-plan-card" : "plan-card"}
10
+ style={{ direction: props.lang === "ar" ? "rtl" : "ltr" }}
11
+ >
12
+ <Container variant="plan-header">
13
+ <Typography variant="h3" fontWeight={500}>
14
+ {props.title}
15
+ </Typography>
16
+ <Typography variant="caption">{props.subtitle}</Typography>
17
+ <br />
18
+ <Typography
19
+ variant="h4"
20
+ fontWeight={500}
21
+ style={{
22
+ display: "flex",
23
+ // flexDirection: "column",
24
+ alignItems: "center"
25
+ // justifyContent: props.lang === "ar" ? "" : "center"
26
+ }}
27
+ >
28
+ {props.lang === "ar" ? (
29
+ <div
30
+ style={{
31
+ width: "100%",
32
+ display: "flex",
33
+ flexDirection: "column",
34
+ justifyContent: "center"
35
+ // alignItems: "center"
36
+ }}
37
+ >
38
+ <div style={{ display: "flex", flexDirection: "row" }}>
39
+ {props.price}
40
+ <div style={{ width: 5 }} />
41
+ <Typography>{props.currency}</Typography>
42
+ </div>
43
+ <Typography style={{ fontSize: 14, margin: 5 }}>
44
+ {props.cycleText}
45
+ </Typography>
46
+ </div>
47
+ ) : (
48
+ <div
49
+ style={{
50
+ width: "100%",
51
+ display: "flex",
52
+ flexDirection: "column",
53
+ justifyContent: "center"
54
+ // alignItems: "center"
55
+ }}
56
+ >
57
+ <div style={{ display: "flex", flexDirection: "row" }}>
58
+ <Typography>{props.currency}</Typography>
59
+ <div style={{ width: 5 }} />
60
+ {props.price}
61
+ </div>
62
+ <Typography style={{ fontSize: 14, margin: 5 }}>
63
+ {props.cycleText}
64
+ </Typography>
65
+ </div>
66
+ )}
67
+ {/* {props.lang === "ar" ? null : (
68
+ <Typography style={{ fontSize: 14, margin: 5 }}>
69
+ {" / "}
70
+ {props.cycleText}
71
+ </Typography>
72
+ )} */}
73
+ </Typography>
74
+ </Container>
75
+
76
+ <div
77
+ style={{ padding: 20, color: props.selectedPlan ? "white" : "black" }}
78
+ >
79
+ {props.features?.map((feature) => {
80
+ return (
81
+ <div
82
+ style={{
83
+ display: "flex",
84
+ flexDirection: "row",
85
+ alignItems: "center",
86
+ justifyContent: "flex-start",
87
+ marginTop: 10,
88
+ width: "100%"
89
+ }}
90
+ >
91
+ <div
92
+ style={{
93
+ display: "flex",
94
+ flexDirection: "row",
95
+ justifyContent: "flex-end",
96
+ width: "10%"
97
+ }}
98
+ >
99
+ <CheckIcon fontSize="small" />
100
+ </div>
101
+ <div style={{ width: 10 }} />
102
+ <Typography variant="subtitle2">{feature}</Typography>
103
+ </div>
104
+ );
105
+ })}
106
+ </div>
107
+ <Button
108
+ variant={props.selectedPlan ? "outlined" : "contained"}
109
+ style={{ margin: 20 }}
110
+ >
111
+ {props.buttonText}
112
+ </Button>
113
+ </Container>
114
+ );
115
+ };
@@ -0,0 +1,30 @@
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 variant={props.location || "panelTabs"}>
9
+ {props.options.map((singleOption, i) => {
10
+ return (
11
+ <Button
12
+ key={i}
13
+ onClick={() => {
14
+ props.handleChange(singleOption.value);
15
+ setValue(singleOption.value);
16
+ }}
17
+ fullWidth
18
+ variant={
19
+ value?.toLowerCase() === singleOption.value?.toLowerCase()
20
+ ? "selected"
21
+ : "unselected"
22
+ }
23
+ >
24
+ {singleOption.label}
25
+ </Button>
26
+ );
27
+ })}
28
+ </Container>
29
+ );
30
+ };
@@ -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
+ };
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { Switch } from "@mui/material";
3
+
4
+ export const HawaSwitch = (props) => {
5
+ return <Switch {...props} />;
6
+ };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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 "./HawaPricingCard";
6
6
  export * from "./HawaSettingsRow";
7
7
  export * from "./HawaLogoButton";
8
8
  export * from "./HawaButton";
@@ -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
+ };
@@ -0,0 +1,89 @@
1
+ import React from "react";
2
+ import { SignInForm } from "../../../blocks/AuthForms";
3
+
4
+ export default {
5
+ title: "Blocks/Auth/Sign In",
6
+ component: [SignInForm],
7
+ argTypes: {
8
+ viaGoogle: {
9
+ default: true,
10
+ control: "boolean",
11
+ description: "Display the sign in via Google button",
12
+ table: { defaultValue: { summary: true } }
13
+ },
14
+ viaTwitter: {
15
+ default: true,
16
+ control: "boolean",
17
+ description: "Display the sign in via Twitter button",
18
+ table: { defaultValue: { summary: true } }
19
+ },
20
+ viaGithub: {
21
+ default: true,
22
+ control: "boolean",
23
+ description: "Display the sign in via Github button",
24
+ table: { defaultValue: { summary: true } }
25
+ },
26
+ showError: {
27
+ default: false,
28
+ control: "boolean",
29
+ description: "Display the error when auth fails",
30
+ table: { defaultValue: { summary: true } }
31
+ },
32
+ errorTitle: {
33
+ default: " ",
34
+ control: "text",
35
+ description: "The error text for the auth failure",
36
+ table: { defaultValue: { summary: "" } }
37
+ },
38
+ errorText: {
39
+ default: "Something went wrong",
40
+ control: "text",
41
+ description: "The error text for the auth failure",
42
+ table: { defaultValue: { summary: "Something went wrong" } }
43
+ }
44
+ }
45
+ };
46
+
47
+ const SignInTemplate = (args) => {
48
+ return (
49
+ <SignInForm
50
+ {...args}
51
+ error={args.showError}
52
+ texts={{
53
+ emailLabel: "Email",
54
+ emailPlaceholder: "Enter your email",
55
+ emailRequiredText: "Email is required",
56
+ emailInvalidText: "Invalid email address",
57
+ passwordLabel: "Password",
58
+ passwordPlaceholder: "Enter password",
59
+ passwordRequiredText: "Password is required",
60
+ forgotPasswordText: "Forgot password?",
61
+ newUserText: "New user?",
62
+ signUpText: "Sign up",
63
+ signInText: "Sign in",
64
+ googleButtonLabel: "Sign in with Google",
65
+ githubButtonLabel: "Sign in with Github",
66
+ twitterButtonLabel: "Sign in with Twitter"
67
+ }}
68
+ handleSignIn={(e) => console.log("singing in via email", e)}
69
+ handleForgotPassword={() => console.log("user forgot password")}
70
+ handleGoogleSignIn={() => console.log("signing in via google")}
71
+ handleGithubSignIn={() => console.log("signing in via github")}
72
+ handleTwitterSignIn={() => console.log("signing in via Twitter")}
73
+ handleRouteToSignUp={() => console.log("switching to sign up")}
74
+ viaGoogle={args.viaGoogle}
75
+ viaGithub={args.viaGithub}
76
+ viaTwitter={args.viaTwitter}
77
+ />
78
+ );
79
+ };
80
+
81
+ export const SignIn = SignInTemplate.bind({});
82
+ SignIn.args = {
83
+ viaGoogle: true,
84
+ viaGithub: true,
85
+ viaTwitter: true,
86
+ showError: false,
87
+ errorTitle: "Error",
88
+ errorText: "Something went wrong"
89
+ };