@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
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { HawaTextField, ActionButton } from "../../ui";
|
|
3
3
|
import { Box } from "../../layout";
|
|
4
4
|
import { FormProvider, useForm } from "react-hook-form";
|
|
5
|
+
import { Button, Container } from "@mui/material";
|
|
5
6
|
|
|
6
7
|
export const CreditCardForm = (props) => {
|
|
7
8
|
const methods = useForm();
|
|
@@ -11,50 +12,54 @@ export const CreditCardForm = (props) => {
|
|
|
11
12
|
} = methods;
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
<Container maxWidth="xs">
|
|
16
|
+
<FormProvider {...methods}>
|
|
17
|
+
<form onSubmit={handleSubmit(props.handle)}>
|
|
18
|
+
<HawaTextField
|
|
19
|
+
fullWidth
|
|
20
|
+
name="password"
|
|
21
|
+
placeholder="Enter password"
|
|
22
|
+
type="number"
|
|
23
|
+
label="Card Number"
|
|
24
|
+
// startAdornment={
|
|
25
|
+
// <InputAdornment position="start">
|
|
26
|
+
// <PasswordIcon />
|
|
27
|
+
// </InputAdornment>
|
|
28
|
+
// }
|
|
29
|
+
rules={{
|
|
30
|
+
required: "Password is rquired"
|
|
31
|
+
}}
|
|
32
|
+
helperText={errors.password?.message}
|
|
33
|
+
/>
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
<HawaTextField
|
|
36
|
+
fullWidth
|
|
37
|
+
name="password"
|
|
38
|
+
placeholder="Enter password"
|
|
39
|
+
type="password"
|
|
40
|
+
label="Name On Card"
|
|
41
|
+
// startAdornment={
|
|
42
|
+
// <InputAdornment position="start">
|
|
43
|
+
// <PasswordIcon />
|
|
44
|
+
// </InputAdornment>
|
|
45
|
+
// }
|
|
46
|
+
rules={{
|
|
47
|
+
required: "Password is rquired"
|
|
48
|
+
}}
|
|
49
|
+
helperText={errors.password?.message}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<Button
|
|
53
|
+
type="submit"
|
|
54
|
+
fullWidth
|
|
55
|
+
variant="last"
|
|
56
|
+
onClick={props.handlePayWithCreditCard}
|
|
57
|
+
>
|
|
58
|
+
{/* {props.texts.signInText} */}
|
|
59
|
+
{"Pay with Credit Card"}
|
|
60
|
+
</Button>
|
|
61
|
+
</form>
|
|
62
|
+
</FormProvider>
|
|
63
|
+
</Container>
|
|
59
64
|
);
|
|
60
65
|
};
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ActionButton } from "../../ui";
|
|
3
3
|
import { Box } from "../../layout";
|
|
4
|
+
import { Button, Container, Typography } from "@mui/material";
|
|
4
5
|
|
|
5
6
|
export const PayWithWallet = (props) => {
|
|
6
7
|
return (
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
<Container maxWidth="xs">
|
|
9
|
+
<Typography align="center">Wallet Balance</Typography>
|
|
10
|
+
<Typography align="center" variant="h1">
|
|
11
|
+
{props.walletBalance || "0"}
|
|
12
|
+
<Typography>{props.currency || "SAR"}</Typography>
|
|
13
|
+
</Typography>
|
|
14
|
+
<Button
|
|
15
|
+
type="submit"
|
|
16
|
+
fullWidth
|
|
17
|
+
variant="last"
|
|
18
|
+
onClick={props.handlePayWithWallet}
|
|
19
|
+
>
|
|
20
|
+
{"Pay Now"}
|
|
21
|
+
</Button>
|
|
22
|
+
</Container>
|
|
13
23
|
);
|
|
14
24
|
};
|
|
@@ -1,64 +1,62 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import { Box } from "../../layout";
|
|
4
3
|
import { HawaTextField, HawaTypography, HawaLogoButton } from "../../ui";
|
|
4
|
+
import { Container } from "@mui/material";
|
|
5
5
|
|
|
6
6
|
export const SelectPayment = (props) => {
|
|
7
7
|
return (
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</Box>
|
|
61
|
-
</Box>
|
|
8
|
+
<Container maxWidth="xs">
|
|
9
|
+
<HawaTypography align="center">Choose Payment Method</HawaTypography>
|
|
10
|
+
{props.viaWallet && (
|
|
11
|
+
<HawaLogoButton
|
|
12
|
+
logo="wallet"
|
|
13
|
+
buttonText={props.walletLabel}
|
|
14
|
+
onClick={props.handleWallet}
|
|
15
|
+
/>
|
|
16
|
+
)}
|
|
17
|
+
{props.viaCreditCard && (
|
|
18
|
+
<HawaLogoButton
|
|
19
|
+
logo="visa/master"
|
|
20
|
+
buttonText={props.visaMasterLabel}
|
|
21
|
+
onClick={props.handleCreditCard}
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
{props.viaMada && (
|
|
25
|
+
<HawaLogoButton
|
|
26
|
+
logo="mada"
|
|
27
|
+
buttonText={props.madaLabel}
|
|
28
|
+
onClick={props.handleMada}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
|
+
{props.viaSTCPay && (
|
|
32
|
+
<HawaLogoButton
|
|
33
|
+
logo="stcpay"
|
|
34
|
+
buttonText={props.stcPayLabel}
|
|
35
|
+
onClick={props.handleSTCPay}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
{props.viaPayPal && (
|
|
39
|
+
<HawaLogoButton
|
|
40
|
+
logo="paypal"
|
|
41
|
+
buttonText={props.paypalLabel}
|
|
42
|
+
onClick={props.handlePayPal}
|
|
43
|
+
/>
|
|
44
|
+
)}
|
|
45
|
+
{props.viaGooglePay && (
|
|
46
|
+
<HawaLogoButton
|
|
47
|
+
logo="googlepay"
|
|
48
|
+
buttonText={props.googlePayLabel}
|
|
49
|
+
onClick={props.handleGooglePay}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
{props.viaApplePay && (
|
|
53
|
+
<HawaLogoButton
|
|
54
|
+
logo="applepay"
|
|
55
|
+
buttonText={props.applePayLabel}
|
|
56
|
+
onClick={props.handleApplePay}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
</Container>
|
|
62
60
|
);
|
|
63
61
|
};
|
|
64
62
|
|
package/src/index.js
CHANGED
package/src/layout/Box.js
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { ThemeProvider } from "../themes/HawaProvider";
|
|
1
|
+
import React from "react";
|
|
3
2
|
|
|
4
3
|
export const Box = (props) => {
|
|
5
|
-
|
|
6
|
-
let boxStyle = {};
|
|
4
|
+
// let boxStyle = {};
|
|
7
5
|
|
|
8
|
-
let currentTheme = Object.keys(hawaTheme.layout).find(
|
|
9
|
-
|
|
10
|
-
);
|
|
11
|
-
if (currentTheme) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} else {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
6
|
+
// let currentTheme = Object.keys(hawaTheme.layout).find(
|
|
7
|
+
// (tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
8
|
+
// );
|
|
9
|
+
// if (currentTheme) {
|
|
10
|
+
// boxStyle = {
|
|
11
|
+
// display: "flex",
|
|
12
|
+
// flexDirection: props.horizontal ? "row" : "column",
|
|
13
|
+
// ...hawaTheme?.layout[currentTheme],
|
|
14
|
+
// backgroundColor: props.noColor
|
|
15
|
+
// ? "none"
|
|
16
|
+
// : hawaTheme.layout[currentTheme].backgroundColor,
|
|
17
|
+
// padding: props.noPadding ? 0 : hawaTheme?.layout[currentTheme].padding,
|
|
18
|
+
// margin: props.noMargin ? 0 : hawaTheme?.layout[currentTheme].margin,
|
|
19
|
+
// maxWidth: props.maxWidth
|
|
20
|
+
// };
|
|
21
|
+
// } else {
|
|
22
|
+
// boxStyle = {
|
|
23
|
+
// display: "flex",
|
|
24
|
+
// flexDirection: props.horizontal ? "row" : "column",
|
|
25
|
+
// color: "white",
|
|
26
|
+
// marginTop: props.last ? 10 * 2 : 0,
|
|
27
|
+
// backgroundColor: props.noColor ? "none" : "lightGrey",
|
|
28
|
+
// padding: props.noPadding ? 0 : 10,
|
|
29
|
+
// margin: props.noMargin ? 0 : 10,
|
|
30
|
+
// maxWidth: props.maxWidth,
|
|
31
|
+
// };
|
|
32
|
+
// }
|
|
36
33
|
|
|
37
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
// style={boxStyle}
|
|
37
|
+
>
|
|
38
|
+
{props.children}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
38
41
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { UserProfileForm } from "../../../blocks/Account";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Blocks/Account/User Profile",
|
|
6
|
+
component: [UserProfile],
|
|
7
|
+
argTypes: {}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const ProfileTemplate = (args) => {
|
|
11
|
+
return <UserProfileForm {...args} />;
|
|
12
|
+
};
|
|
13
|
+
export const UserProfile = ProfileTemplate.bind({});
|
|
14
|
+
UserProfile.args = {
|
|
15
|
+
viaGoogle: true,
|
|
16
|
+
viaGithub: true,
|
|
17
|
+
viaTwitter: true,
|
|
18
|
+
showError: false,
|
|
19
|
+
errorTitle: "Error",
|
|
20
|
+
errorText: "Something went wrong"
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { UserSettingsForm } from "../../../blocks/Account";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Blocks/Account/User Settings",
|
|
6
|
+
component: UserSettingsForm,
|
|
7
|
+
argTypes: {
|
|
8
|
+
theme: {
|
|
9
|
+
options: ["primary", "secondary", "default"],
|
|
10
|
+
control: { type: "select" }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const UserSettings = (args) => {
|
|
16
|
+
return <UserSettingsForm {...args} />;
|
|
17
|
+
};
|
|
18
|
+
UserSettings.args = {
|
|
19
|
+
theme: "primary",
|
|
20
|
+
title: "red"
|
|
21
|
+
};
|
|
@@ -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
|
+
};
|