@thecb/components 4.1.14 → 4.1.16
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/dist/index.cjs.js +235 -553
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +63 -49
- package/src/components/atoms/dropdown/Dropdown.js +2 -2
- package/src/components/atoms/icons/ProfileIcon.js +48 -0
- package/src/components/atoms/icons/WalletIcon.js +38 -172
- package/src/components/atoms/icons/index.js +3 -1
- package/src/components/atoms/text/Text.js +2 -0
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +14 -16
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.theme.js +6 -11
- package/src/components/molecules/address-form/AddressForm.js +7 -27
- package/src/components/molecules/email-form/EmailForm.js +7 -27
- package/src/components/molecules/email-form/EmailForm.stories.js +4 -1
- package/src/components/molecules/modal/Modal.js +3 -3
- package/src/components/molecules/obligation/modules/AmountModule.stories.js +27 -0
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +47 -38
- package/src/components/molecules/obligation/modules/AutopayModalModule.theme.js +12 -1
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +22 -57
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +7 -26
- package/src/components/molecules/phone-form/PhoneForm.js +7 -27
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +12 -40
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +14 -15
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.theme.js +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import styled from "styled-components";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
3
2
|
import { required, isProbablyEmail } from "redux-freeform";
|
|
4
3
|
import {
|
|
5
4
|
FormInput,
|
|
@@ -10,10 +9,6 @@ import Checkbox from "../../atoms/checkbox";
|
|
|
10
9
|
import Paragraph from "../../atoms/paragraph";
|
|
11
10
|
import { noop } from "../../../util/general";
|
|
12
11
|
|
|
13
|
-
const CheckboxWrapper = styled.div`
|
|
14
|
-
outline: none;
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
12
|
const EmailForm = ({
|
|
18
13
|
variant = "default",
|
|
19
14
|
clearOnDismount,
|
|
@@ -26,13 +21,6 @@ const EmailForm = ({
|
|
|
26
21
|
saveToWallet,
|
|
27
22
|
walletCheckboxMarked
|
|
28
23
|
}) => {
|
|
29
|
-
const [checkboxFocused, focusCheckbox] = useState(false);
|
|
30
|
-
const handleClick = (e, func) => {
|
|
31
|
-
if (e?.keyCode === 13) {
|
|
32
|
-
func();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
24
|
if (clearOnDismount) {
|
|
37
25
|
useEffect(() => () => actions.form.clear(), []);
|
|
38
26
|
}
|
|
@@ -59,20 +47,12 @@ const EmailForm = ({
|
|
|
59
47
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
60
48
|
/>
|
|
61
49
|
{showWalletCheckbox && (
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<Checkbox
|
|
69
|
-
name="email checkbox"
|
|
70
|
-
title="Save email address to wallet"
|
|
71
|
-
checked={walletCheckboxMarked}
|
|
72
|
-
onChange={saveToWallet}
|
|
73
|
-
focused={checkboxFocused}
|
|
74
|
-
/>
|
|
75
|
-
</CheckboxWrapper>
|
|
50
|
+
<Checkbox
|
|
51
|
+
name="email checkbox"
|
|
52
|
+
title="Save email address to wallet"
|
|
53
|
+
checked={walletCheckboxMarked}
|
|
54
|
+
onChange={saveToWallet}
|
|
55
|
+
/>
|
|
76
56
|
)}
|
|
77
57
|
</FormInputColumn>
|
|
78
58
|
</FormContainer>
|
|
@@ -20,5 +20,8 @@ const ConnectedForm = connect(
|
|
|
20
20
|
EmailFormState.mapDispatchToProps
|
|
21
21
|
)(EmailForm);
|
|
22
22
|
export const emailForm = () => (
|
|
23
|
-
<ConnectedForm
|
|
23
|
+
<ConnectedForm
|
|
24
|
+
showErrors={boolean("showErrors", false, "props")}
|
|
25
|
+
showWalletCheckbox={boolean("showWalletCheckbox", false, "props")}
|
|
26
|
+
/>
|
|
24
27
|
);
|
|
@@ -21,7 +21,6 @@ a different route (as with a link) connect() and use "push" from connected-react
|
|
|
21
21
|
const getApplicationNode = () => document.getElementById("root");
|
|
22
22
|
|
|
23
23
|
const Modal = ({
|
|
24
|
-
ModalLink,
|
|
25
24
|
hideModal,
|
|
26
25
|
continueAction,
|
|
27
26
|
cancelAction,
|
|
@@ -36,12 +35,12 @@ const Modal = ({
|
|
|
36
35
|
defaultWrapper = true,
|
|
37
36
|
onlyCloseButton = false,
|
|
38
37
|
maxHeight,
|
|
39
|
-
underlayClickExits = true
|
|
38
|
+
underlayClickExits = true,
|
|
39
|
+
children
|
|
40
40
|
}) => {
|
|
41
41
|
const { isMobile } = useContext(ThemeContext);
|
|
42
42
|
return (
|
|
43
43
|
<Fragment>
|
|
44
|
-
<ModalLink />
|
|
45
44
|
{modalOpen && (
|
|
46
45
|
<AriaModal
|
|
47
46
|
onExit={hideModal}
|
|
@@ -134,6 +133,7 @@ const Modal = ({
|
|
|
134
133
|
</Box>
|
|
135
134
|
</AriaModal>
|
|
136
135
|
)}
|
|
136
|
+
{children}
|
|
137
137
|
</Fragment>
|
|
138
138
|
);
|
|
139
139
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text, boolean } from "@storybook/addon-knobs";
|
|
3
|
+
|
|
4
|
+
import AmountModule from "./AmountModule";
|
|
5
|
+
import page from "../../../../../.storybook/page";
|
|
6
|
+
import { noop } from "../../../../util/general";
|
|
7
|
+
|
|
8
|
+
const groupId = "props";
|
|
9
|
+
|
|
10
|
+
export const amountModule = () => (
|
|
11
|
+
<AmountModule
|
|
12
|
+
totalAmountDue={text("totalAmountDue", "123", groupId)}
|
|
13
|
+
autoPayEnabled={boolean("autopayEnabled", true, groupId)}
|
|
14
|
+
isMobile={boolean("isMobile", false, groupId)}
|
|
15
|
+
deactivatePaymentSchedule={noop}
|
|
16
|
+
navigateToSettings={noop}
|
|
17
|
+
autoPaySchedule={{}}
|
|
18
|
+
paymentPlanSchedule={{}}
|
|
19
|
+
isPaymentPlan={boolean("isPaymentPlan", false, groupId)}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const story = page({
|
|
24
|
+
title: "Components|Molecules/AmountModule",
|
|
25
|
+
Component: AmountModule
|
|
26
|
+
});
|
|
27
|
+
export default story;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Modal from "../../modal";
|
|
3
3
|
import ButtonWithAction from "../../../atoms/button-with-action";
|
|
4
|
+
import Text from "../../../atoms/text";
|
|
4
5
|
import { AutopayOnIcon } from "../../../atoms/icons";
|
|
5
6
|
import { Box, Cluster } from "../../../atoms/layouts";
|
|
6
7
|
import { fallbackValues } from "./AutopayModalModule.theme";
|
|
@@ -61,48 +62,56 @@ const AutopayModal = ({
|
|
|
61
62
|
`;
|
|
62
63
|
return (
|
|
63
64
|
<Modal
|
|
64
|
-
ModalLink={() =>
|
|
65
|
-
buttonLinkType ? (
|
|
66
|
-
<ButtonWithAction
|
|
67
|
-
text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
|
|
68
|
-
variant="tertiary"
|
|
69
|
-
action={() => {
|
|
70
|
-
toggleModal(true);
|
|
71
|
-
}}
|
|
72
|
-
dataQa="Manage Autopay"
|
|
73
|
-
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
74
|
-
/>
|
|
75
|
-
) : (
|
|
76
|
-
<Box
|
|
77
|
-
padding="0"
|
|
78
|
-
onClick={() => {
|
|
79
|
-
toggleModal(true);
|
|
80
|
-
}}
|
|
81
|
-
hoverStyles={hoverStyles}
|
|
82
|
-
activeStyles={activeStyles}
|
|
83
|
-
extraStyles={defaultStyles}
|
|
84
|
-
>
|
|
85
|
-
<Cluster
|
|
86
|
-
justify={isMobile ? "flex-start" : "flex-end"}
|
|
87
|
-
align="center"
|
|
88
|
-
>
|
|
89
|
-
<AutopayOnIcon />
|
|
90
|
-
<ButtonWithAction
|
|
91
|
-
text={`${planType} On`}
|
|
92
|
-
variant="smallGhost"
|
|
93
|
-
dataQa="Autopay On"
|
|
94
|
-
textExtraStyles={`font-size: 0.875rem; `}
|
|
95
|
-
extraStyles={`min-width: auto; padding: 0 0 0 6px;`}
|
|
96
|
-
/>
|
|
97
|
-
</Cluster>
|
|
98
|
-
</Box>
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
65
|
showModal={() => toggleModal(true)}
|
|
102
66
|
hideModal={() => toggleModal(false)}
|
|
103
67
|
modalOpen={modalOpen}
|
|
104
68
|
{...modalExtraProps}
|
|
105
|
-
|
|
69
|
+
>
|
|
70
|
+
{buttonLinkType ? (
|
|
71
|
+
<ButtonWithAction
|
|
72
|
+
text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
|
|
73
|
+
variant="tertiary"
|
|
74
|
+
action={() => {
|
|
75
|
+
toggleModal(true);
|
|
76
|
+
}}
|
|
77
|
+
dataQa="Manage Autopay"
|
|
78
|
+
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
79
|
+
/>
|
|
80
|
+
) : (
|
|
81
|
+
<Box
|
|
82
|
+
padding="0"
|
|
83
|
+
onClick={() => {
|
|
84
|
+
toggleModal(true);
|
|
85
|
+
}}
|
|
86
|
+
hoverStyles={hoverStyles}
|
|
87
|
+
activeStyles={activeStyles}
|
|
88
|
+
extraStyles={defaultStyles}
|
|
89
|
+
>
|
|
90
|
+
<Cluster
|
|
91
|
+
justify={isMobile ? "flex-start" : "flex-end"}
|
|
92
|
+
align="center"
|
|
93
|
+
>
|
|
94
|
+
<AutopayOnIcon />
|
|
95
|
+
<Text
|
|
96
|
+
variant="pS"
|
|
97
|
+
onClick={() => toggleModal(true)}
|
|
98
|
+
onKeyPress={e => {
|
|
99
|
+
console.log({ e });
|
|
100
|
+
e.key === "Enter" && toggleModal(true);
|
|
101
|
+
}}
|
|
102
|
+
tabIndex="0"
|
|
103
|
+
dataQa={`${planType} On`}
|
|
104
|
+
color={themeValues.linkColor}
|
|
105
|
+
weight={themeValues.fontWeight}
|
|
106
|
+
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
107
|
+
extraStyles={`padding: 0 0 0 6px;`}
|
|
108
|
+
>
|
|
109
|
+
{`${planType} On`}
|
|
110
|
+
</Text>
|
|
111
|
+
</Cluster>
|
|
112
|
+
</Box>
|
|
113
|
+
)}
|
|
114
|
+
</Modal>
|
|
106
115
|
);
|
|
107
116
|
};
|
|
108
117
|
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import { FONT_WEIGHT_REGULAR } from "../../../../constants/style_constants";
|
|
2
|
+
|
|
1
3
|
const color = "#15749D";
|
|
2
4
|
const hoverColor = "#116285";
|
|
3
5
|
const activeColor = "#0E506D";
|
|
6
|
+
const linkColor = "#357fb8";
|
|
7
|
+
const fontWeight = FONT_WEIGHT_REGULAR;
|
|
8
|
+
const modalLinkHoverFocus = `outline: none;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
text-decoration: underline;
|
|
11
|
+
text-decoration-color: #357fb8;`;
|
|
4
12
|
|
|
5
13
|
export const fallbackValues = {
|
|
6
14
|
color,
|
|
7
15
|
hoverColor,
|
|
8
|
-
activeColor
|
|
16
|
+
activeColor,
|
|
17
|
+
linkColor,
|
|
18
|
+
fontWeight,
|
|
19
|
+
modalLinkHoverFocus
|
|
9
20
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import Checkbox from "../../atoms/checkbox";
|
|
4
3
|
import {
|
|
5
4
|
required,
|
|
@@ -16,12 +15,6 @@ import {
|
|
|
16
15
|
import AccountAndRoutingModal from "../account-and-routing-modal";
|
|
17
16
|
import { noop } from "../../../util/general";
|
|
18
17
|
|
|
19
|
-
const ModalWrapper = styled.div``;
|
|
20
|
-
|
|
21
|
-
const CheckboxWrapper = styled.div`
|
|
22
|
-
outline: none;
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
18
|
const PaymentFormACH = ({
|
|
26
19
|
variant = "default",
|
|
27
20
|
defaultMethod,
|
|
@@ -37,12 +30,6 @@ const PaymentFormACH = ({
|
|
|
37
30
|
saveToWallet,
|
|
38
31
|
walletCheckboxMarked
|
|
39
32
|
}) => {
|
|
40
|
-
const [checkboxFocused, focusCheckbox] = useState(false);
|
|
41
|
-
const handleClick = (e, func) => {
|
|
42
|
-
if (e?.keyCode === 13) {
|
|
43
|
-
func();
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
33
|
if (clearOnDismount) {
|
|
47
34
|
useEffect(() => () => actions.form.clear(), []);
|
|
48
35
|
}
|
|
@@ -91,22 +78,15 @@ const PaymentFormACH = ({
|
|
|
91
78
|
fieldActions={actions.fields.routingNumber}
|
|
92
79
|
showErrors={showErrors}
|
|
93
80
|
helperModal={() => (
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
>
|
|
100
|
-
<AccountAndRoutingModal
|
|
101
|
-
link="What is this?"
|
|
102
|
-
title="Where is my routing number?"
|
|
103
|
-
content="Your routing number is the 9-digit number in the bottom left
|
|
81
|
+
<AccountAndRoutingModal
|
|
82
|
+
link="What is this?"
|
|
83
|
+
title="Where is my routing number?"
|
|
84
|
+
content="Your routing number is the 9-digit number in the bottom left
|
|
104
85
|
corner of your check."
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</ModalWrapper>
|
|
86
|
+
imageType="Routing"
|
|
87
|
+
isOpen={showRouting}
|
|
88
|
+
toggleOpen={toggleShowRouting}
|
|
89
|
+
/>
|
|
110
90
|
)}
|
|
111
91
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
112
92
|
/>
|
|
@@ -125,22 +105,15 @@ const PaymentFormACH = ({
|
|
|
125
105
|
fieldActions={actions.fields.accountNumber}
|
|
126
106
|
showErrors={showErrors}
|
|
127
107
|
helperModal={() => (
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
>
|
|
134
|
-
<AccountAndRoutingModal
|
|
135
|
-
link="What is this?"
|
|
136
|
-
title="Where is my account number?"
|
|
137
|
-
content="Your account number is usually the 10-digit number in the bottom
|
|
108
|
+
<AccountAndRoutingModal
|
|
109
|
+
link="What is this?"
|
|
110
|
+
title="Where is my account number?"
|
|
111
|
+
content="Your account number is usually the 10-digit number in the bottom
|
|
138
112
|
of your check to the right of the routing number."
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
</ModalWrapper>
|
|
113
|
+
imageType="Account"
|
|
114
|
+
isOpen={showAccount}
|
|
115
|
+
toggleOpen={toggleShowAccount}
|
|
116
|
+
/>
|
|
144
117
|
)}
|
|
145
118
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
146
119
|
/>
|
|
@@ -176,20 +149,12 @@ const PaymentFormACH = ({
|
|
|
176
149
|
/>
|
|
177
150
|
)}
|
|
178
151
|
{showWalletCheckbox && (
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
<Checkbox
|
|
186
|
-
name="bank checkbox"
|
|
187
|
-
title="Save bank account to wallet"
|
|
188
|
-
checked={walletCheckboxMarked}
|
|
189
|
-
onChange={saveToWallet}
|
|
190
|
-
focused={checkboxFocused}
|
|
191
|
-
/>
|
|
192
|
-
</CheckboxWrapper>
|
|
152
|
+
<Checkbox
|
|
153
|
+
name="bank checkbox"
|
|
154
|
+
title="Save bank account to wallet"
|
|
155
|
+
checked={walletCheckboxMarked}
|
|
156
|
+
onChange={saveToWallet}
|
|
157
|
+
/>
|
|
193
158
|
)}
|
|
194
159
|
</FormInputColumn>
|
|
195
160
|
</FormContainer>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import styled from "styled-components";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
3
2
|
import { required, hasLength, matchesRegex } from "redux-freeform";
|
|
4
3
|
import Checkbox from "../../atoms/checkbox";
|
|
5
4
|
import CountryDropdown from "../../atoms/country-dropdown";
|
|
@@ -17,10 +16,6 @@ import {
|
|
|
17
16
|
} from "../../atoms/form-layouts";
|
|
18
17
|
import { Box } from "../../atoms/layouts";
|
|
19
18
|
|
|
20
|
-
const CheckboxWrapper = styled.div`
|
|
21
|
-
outline: none;
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
19
|
const nameOnCardErrors = {
|
|
25
20
|
[required.error]: "Name is required"
|
|
26
21
|
};
|
|
@@ -58,12 +53,6 @@ const PaymentFormCard = ({
|
|
|
58
53
|
saveToWallet,
|
|
59
54
|
walletCheckboxMarked
|
|
60
55
|
}) => {
|
|
61
|
-
const [checkboxFocused, focusCheckbox] = useState(false);
|
|
62
|
-
const handleClick = (e, func) => {
|
|
63
|
-
if (e?.keyCode === 13) {
|
|
64
|
-
func();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
56
|
useEffect(() => {
|
|
68
57
|
if (clearOnDismount) {
|
|
69
58
|
return () => actions.form.clear();
|
|
@@ -148,20 +137,12 @@ const PaymentFormCard = ({
|
|
|
148
137
|
</Box>
|
|
149
138
|
)}
|
|
150
139
|
{showWalletCheckbox && (
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<Checkbox
|
|
158
|
-
name="credit card checkbox"
|
|
159
|
-
title="Save credit card to wallet"
|
|
160
|
-
checked={walletCheckboxMarked}
|
|
161
|
-
onChange={saveToWallet}
|
|
162
|
-
focused={checkboxFocused}
|
|
163
|
-
/>
|
|
164
|
-
</CheckboxWrapper>
|
|
140
|
+
<Checkbox
|
|
141
|
+
name="credit card checkbox"
|
|
142
|
+
title="Save credit card to wallet"
|
|
143
|
+
checked={walletCheckboxMarked}
|
|
144
|
+
onChange={saveToWallet}
|
|
145
|
+
/>
|
|
165
146
|
)}
|
|
166
147
|
</FormInputColumn>
|
|
167
148
|
</FormContainer>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import styled from "styled-components";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
3
2
|
import { required, hasLength } from "redux-freeform";
|
|
4
3
|
import { createFormat } from "formatted-input";
|
|
5
4
|
import {
|
|
@@ -11,10 +10,6 @@ import Checkbox from "../../atoms/checkbox";
|
|
|
11
10
|
import { noop } from "../../../util/general";
|
|
12
11
|
import { phoneFormats, formatDelimiter } from "../../../util/formats";
|
|
13
12
|
|
|
14
|
-
const CheckboxWrapper = styled.div`
|
|
15
|
-
outline: none;
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
13
|
const PhoneForm = ({
|
|
19
14
|
variant = "default",
|
|
20
15
|
fields,
|
|
@@ -26,13 +21,6 @@ const PhoneForm = ({
|
|
|
26
21
|
saveToWallet,
|
|
27
22
|
walletCheckboxMarked
|
|
28
23
|
}) => {
|
|
29
|
-
const [checkboxFocused, focusCheckbox] = useState(false);
|
|
30
|
-
const handleClick = (e, func) => {
|
|
31
|
-
if (e?.keyCode === 13) {
|
|
32
|
-
func();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
24
|
if (clearOnDismount) {
|
|
37
25
|
useEffect(() => () => actions.form.clear(), []);
|
|
38
26
|
}
|
|
@@ -54,20 +42,12 @@ const PhoneForm = ({
|
|
|
54
42
|
onKeyUp={e => e.key === "Enter" && handleSubmit(e)}
|
|
55
43
|
/>
|
|
56
44
|
{showWalletCheckbox && (
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<Checkbox
|
|
64
|
-
name="phone checkbox"
|
|
65
|
-
title="Save phone number to wallet"
|
|
66
|
-
checked={walletCheckboxMarked}
|
|
67
|
-
onChange={saveToWallet}
|
|
68
|
-
focused={checkboxFocused}
|
|
69
|
-
/>
|
|
70
|
-
</CheckboxWrapper>
|
|
45
|
+
<Checkbox
|
|
46
|
+
name="phone checkbox"
|
|
47
|
+
title="Save phone number to wallet"
|
|
48
|
+
checked={walletCheckboxMarked}
|
|
49
|
+
onChange={saveToWallet}
|
|
50
|
+
/>
|
|
71
51
|
)}
|
|
72
52
|
</FormInputColumn>
|
|
73
53
|
</FormContainer>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import Checkbox from "../../atoms/checkbox";
|
|
4
3
|
import Text from "../../atoms/text";
|
|
5
4
|
import { Box, Stack } from "../../atoms/layouts";
|
|
@@ -7,12 +6,6 @@ import DisplayBox from "../../atoms/display-box";
|
|
|
7
6
|
import { FONT_WEIGHT_BOLD } from "../../../constants/style_constants";
|
|
8
7
|
import TermsAndConditionsModal from "../../molecules/terms-and-conditions-modal";
|
|
9
8
|
|
|
10
|
-
const CheckboxWrapper = styled.div`
|
|
11
|
-
outline: none;
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
const ModalWrapper = styled.div``;
|
|
15
|
-
|
|
16
9
|
const TermsAndConditions = ({
|
|
17
10
|
onCheck,
|
|
18
11
|
isChecked,
|
|
@@ -21,48 +14,27 @@ const TermsAndConditions = ({
|
|
|
21
14
|
error = false
|
|
22
15
|
}) => {
|
|
23
16
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
24
|
-
const [checkboxFocused, focusCheckbox] = useState(false);
|
|
25
|
-
|
|
26
|
-
const handleClick = (e, func) => {
|
|
27
|
-
if (e?.keyCode === 13) {
|
|
28
|
-
func();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
17
|
return (
|
|
33
18
|
<DisplayBox>
|
|
34
19
|
<Stack direction="row">
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<Checkbox
|
|
42
|
-
name="terms"
|
|
43
|
-
error={error}
|
|
44
|
-
checked={isChecked}
|
|
45
|
-
onChange={onCheck}
|
|
46
|
-
focused={checkboxFocused}
|
|
47
|
-
/>
|
|
48
|
-
</CheckboxWrapper>
|
|
20
|
+
<Checkbox
|
|
21
|
+
name="terms"
|
|
22
|
+
error={error}
|
|
23
|
+
checked={isChecked}
|
|
24
|
+
onChange={onCheck}
|
|
25
|
+
/>
|
|
49
26
|
<Stack>
|
|
50
27
|
<Text variant="p" fontWeight={FONT_WEIGHT_BOLD}>
|
|
51
28
|
Terms and Conditions
|
|
52
29
|
</Text>
|
|
53
30
|
<Box padding="0">{html}</Box>
|
|
54
31
|
{terms && (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
terms={terms}
|
|
62
|
-
isOpen={showTerms}
|
|
63
|
-
toggleOpen={toggleShowTerms}
|
|
64
|
-
/>
|
|
65
|
-
</ModalWrapper>
|
|
32
|
+
<TermsAndConditionsModal
|
|
33
|
+
link="Learn More"
|
|
34
|
+
terms={terms}
|
|
35
|
+
isOpen={showTerms}
|
|
36
|
+
toggleOpen={toggleShowTerms}
|
|
37
|
+
/>
|
|
66
38
|
)}
|
|
67
39
|
</Stack>
|
|
68
40
|
</Stack>
|
|
@@ -17,20 +17,6 @@ const TermsAndConditionsModal = ({
|
|
|
17
17
|
themeValues
|
|
18
18
|
}) => (
|
|
19
19
|
<Modal
|
|
20
|
-
ModalLink={() => (
|
|
21
|
-
<Text
|
|
22
|
-
variant={variant === "default" ? "pS" : "pXS"}
|
|
23
|
-
onClick={() => toggleOpen(true)}
|
|
24
|
-
color={themeValues.linkColor}
|
|
25
|
-
weight={themeValues.fontWeight}
|
|
26
|
-
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
27
|
-
extraStyles={`cursor: pointer;`}
|
|
28
|
-
tabIndex="0"
|
|
29
|
-
onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
|
|
30
|
-
>
|
|
31
|
-
{link}
|
|
32
|
-
</Text>
|
|
33
|
-
)}
|
|
34
20
|
modalOpen={isOpen}
|
|
35
21
|
hideModal={() => toggleOpen(false)}
|
|
36
22
|
showModal={() => toggleOpen(true)}
|
|
@@ -52,7 +38,20 @@ const TermsAndConditionsModal = ({
|
|
|
52
38
|
toggleAccepted(true);
|
|
53
39
|
toggleOpen(false);
|
|
54
40
|
}}
|
|
55
|
-
|
|
41
|
+
>
|
|
42
|
+
<Text
|
|
43
|
+
variant={variant === "default" ? "pS" : "pXS"}
|
|
44
|
+
onClick={() => toggleOpen(true)}
|
|
45
|
+
onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
|
|
46
|
+
tabIndex="0"
|
|
47
|
+
color={themeValues.linkColor}
|
|
48
|
+
weight={themeValues.fontWeight}
|
|
49
|
+
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
50
|
+
extraStyles={`cursor: pointer;`}
|
|
51
|
+
>
|
|
52
|
+
{link}
|
|
53
|
+
</Text>
|
|
54
|
+
</Modal>
|
|
56
55
|
);
|
|
57
56
|
|
|
58
57
|
export default themeComponent(
|