@thecb/components 7.6.1 → 7.7.0-beta.1
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 +147 -159
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +147 -159
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/{icons/PaymentIcon.js → formatted-bank-account/FormattedBankAccount.js} +22 -8
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.theme.js +9 -0
- package/src/components/atoms/formatted-bank-account/index.js +3 -0
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +32 -60
- package/src/components/atoms/icons/index.js +0 -2
- package/src/components/atoms/index.js +1 -0
- package/src/components/molecules/radio-section/RadioSection.js +5 -46
- package/src/util/general.js +47 -1
package/package.json
CHANGED
package/src/components/atoms/{icons/PaymentIcon.js → formatted-bank-account/FormattedBankAccount.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
+
import { fallbackValues } from "./FormattedBankAccount.theme";
|
|
5
|
+
import BankIcon from "../icons/BankIcon";
|
|
5
6
|
import { Stack, Box } from "../layouts";
|
|
6
7
|
import Text from "../text";
|
|
7
8
|
|
|
@@ -12,7 +13,7 @@ export const BankItemWrapper = styled.div`
|
|
|
12
13
|
`;
|
|
13
14
|
|
|
14
15
|
export const BankAccountText = styled.h4`
|
|
15
|
-
color: ${
|
|
16
|
+
color: ${({ color }) => color};
|
|
16
17
|
font-size: 1rem;
|
|
17
18
|
font-weight: 400;
|
|
18
19
|
line-height: 1.5rem;
|
|
@@ -24,22 +25,31 @@ export const BankAccountText = styled.h4`
|
|
|
24
25
|
const CHECKING = "CHECKING";
|
|
25
26
|
const SAVINGS = "SAVINGS";
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
+
const FormattedBankAccount = ({
|
|
29
|
+
lastFour,
|
|
30
|
+
accountType,
|
|
31
|
+
autoPay,
|
|
32
|
+
themeValues
|
|
33
|
+
}) => (
|
|
28
34
|
<BankItemWrapper>
|
|
29
35
|
<Box padding="0.25rem 0 0 0" extraStyles={`margin-right: 1rem;`}>
|
|
30
36
|
<BankIcon />
|
|
31
37
|
</Box>
|
|
32
38
|
<Stack childGap="0">
|
|
33
39
|
{accountType === CHECKING && (
|
|
34
|
-
<BankAccountText
|
|
40
|
+
<BankAccountText color={themeValues.textColor}>
|
|
41
|
+
Checking Account ending in {lastFour}
|
|
42
|
+
</BankAccountText>
|
|
35
43
|
)}
|
|
36
44
|
{accountType === SAVINGS && (
|
|
37
|
-
<BankAccountText
|
|
45
|
+
<BankAccountText color={themeValues.textColor}>
|
|
46
|
+
Savings Account ending in {lastFour}
|
|
47
|
+
</BankAccountText>
|
|
38
48
|
)}
|
|
39
49
|
{autoPay && (
|
|
40
50
|
<Text
|
|
41
51
|
variant="p"
|
|
42
|
-
color={
|
|
52
|
+
color={themeValues.autopayTextColor}
|
|
43
53
|
extraStyles={`font-style: italic;`}
|
|
44
54
|
>{`Autopay Enabled`}</Text>
|
|
45
55
|
)}
|
|
@@ -47,4 +57,8 @@ const PaymentIcon = ({ lastFour, accountType, autoPay }) => (
|
|
|
47
57
|
</BankItemWrapper>
|
|
48
58
|
);
|
|
49
59
|
|
|
50
|
-
export default
|
|
60
|
+
export default themeComponent(
|
|
61
|
+
FormattedBankAccount,
|
|
62
|
+
"FormattedBankAccount",
|
|
63
|
+
fallbackValues
|
|
64
|
+
);
|
|
@@ -2,15 +2,10 @@ import React, { Fragment } from "react";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import GenericCard from "../icons/GenericCard";
|
|
4
4
|
import Text from "../text";
|
|
5
|
-
import Paragraph from "../paragraph";
|
|
6
5
|
import { Box, Stack } from "../layouts";
|
|
7
6
|
import { fallbackValues } from "./FormattedCreditCard.theme";
|
|
8
7
|
import { themeComponent } from "../../../util/themeUtils";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const ACTIVE = "ACTIVE";
|
|
12
|
-
const EXPIRING_SOON = "EXPIRING_SOON";
|
|
13
|
-
const EXPIRED = "EXPIRED";
|
|
8
|
+
import { renderCardStatus } from "../../../util/general";
|
|
14
9
|
|
|
15
10
|
export const CreditCardWrapper = styled.div`
|
|
16
11
|
display: flex;
|
|
@@ -31,61 +26,38 @@ const FormattedCreditCard = ({
|
|
|
31
26
|
expireDate,
|
|
32
27
|
expirationStatus,
|
|
33
28
|
themeValues
|
|
34
|
-
}) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
</
|
|
54
|
-
);
|
|
55
|
-
default:
|
|
56
|
-
null;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
return (
|
|
60
|
-
<CreditCardWrapper>
|
|
61
|
-
<CCIconWrapper>
|
|
62
|
-
<GenericCard />
|
|
63
|
-
</CCIconWrapper>
|
|
64
|
-
<Stack childGap="0">
|
|
65
|
-
<Box padding="0">
|
|
66
|
-
<Text
|
|
67
|
-
variant="p"
|
|
68
|
-
padding="0 0 0 8px"
|
|
69
|
-
color={themeValues.textColor}
|
|
70
|
-
textAlign="left"
|
|
71
|
-
extraStyles={`display: inline-block;`}
|
|
72
|
-
>
|
|
73
|
-
{`Card ending in ${lastFour}`}
|
|
74
|
-
</Text>
|
|
75
|
-
{expireDate && <Fragment>{renderCardStatus()}</Fragment>}
|
|
76
|
-
</Box>
|
|
77
|
-
{autoPay && (
|
|
78
|
-
<Text
|
|
79
|
-
variant="p"
|
|
80
|
-
color={themeValues.autopayTextColor}
|
|
81
|
-
extraStyles={`font-style: italic;`}
|
|
82
|
-
>{`Autopay Enabled`}</Text>
|
|
29
|
+
}) => (
|
|
30
|
+
<CreditCardWrapper>
|
|
31
|
+
<CCIconWrapper>
|
|
32
|
+
<GenericCard />
|
|
33
|
+
</CCIconWrapper>
|
|
34
|
+
<Stack childGap="0">
|
|
35
|
+
<Box padding="0">
|
|
36
|
+
<Text
|
|
37
|
+
variant="p"
|
|
38
|
+
padding="0 0 0 8px"
|
|
39
|
+
color={themeValues.textColor}
|
|
40
|
+
textAlign="left"
|
|
41
|
+
extraStyles={`display: inline-block;`}
|
|
42
|
+
>
|
|
43
|
+
{`Card ending in ${lastFour}`}
|
|
44
|
+
</Text>
|
|
45
|
+
{expireDate && (
|
|
46
|
+
<Fragment>
|
|
47
|
+
{renderCardStatus(expirationStatus, expireDate, "left", "p")}
|
|
48
|
+
</Fragment>
|
|
83
49
|
)}
|
|
84
|
-
</
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
50
|
+
</Box>
|
|
51
|
+
{autoPay && (
|
|
52
|
+
<Text
|
|
53
|
+
variant="p"
|
|
54
|
+
color={themeValues.autopayTextColor}
|
|
55
|
+
extraStyles={`font-style: italic;`}
|
|
56
|
+
>{`Autopay Enabled`}</Text>
|
|
57
|
+
)}
|
|
58
|
+
</Stack>
|
|
59
|
+
</CreditCardWrapper>
|
|
60
|
+
);
|
|
89
61
|
export default themeComponent(
|
|
90
62
|
FormattedCreditCard,
|
|
91
63
|
"FormattedCreditCard",
|
|
@@ -18,7 +18,6 @@ import RoutingNumberImage from "./RoutingNumberImage";
|
|
|
18
18
|
import CheckmarkIcon from "./CheckmarkIcon";
|
|
19
19
|
import BankIcon from "./BankIcon";
|
|
20
20
|
import GenericCard from "./GenericCard";
|
|
21
|
-
import PaymentIcon from "./PaymentIcon";
|
|
22
21
|
import IconAdd from "./IconAdd";
|
|
23
22
|
import IconQuitLarge from "./IconQuitLarge";
|
|
24
23
|
import TimeoutImage from "./TimeoutImage";
|
|
@@ -85,7 +84,6 @@ export {
|
|
|
85
84
|
CheckmarkIcon,
|
|
86
85
|
BankIcon,
|
|
87
86
|
GenericCard,
|
|
88
|
-
PaymentIcon,
|
|
89
87
|
IconAdd,
|
|
90
88
|
IconQuitLarge,
|
|
91
89
|
TimeoutImage,
|
|
@@ -16,6 +16,7 @@ export { default as Dropdown } from "./dropdown";
|
|
|
16
16
|
export * from "./form-layouts";
|
|
17
17
|
export { default as FormSelect } from "./form-select";
|
|
18
18
|
export { default as FormattedAddress } from "./formatted-address";
|
|
19
|
+
export { default as FormattedBankAccount } from "./formatted-bank-account";
|
|
19
20
|
export { default as FormattedCreditCard } from "./formatted-credit-card";
|
|
20
21
|
export { default as HamburgerButton } from "./hamburger-button";
|
|
21
22
|
export { default as Heading } from "./heading";
|
|
@@ -7,7 +7,7 @@ import RadioButton from "./radio-button/RadioButton";
|
|
|
7
7
|
import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
|
|
8
8
|
import { noop } from "../../../util/general";
|
|
9
9
|
import Text from "../../atoms/text";
|
|
10
|
-
import { CHARADE_GREY
|
|
10
|
+
import { CHARADE_GREY } from "../../../constants/colors";
|
|
11
11
|
/*
|
|
12
12
|
Takes an array of section objects, each object should look like:
|
|
13
13
|
{
|
|
@@ -17,7 +17,8 @@ import { CHARADE_GREY, ASH_GREY, FIRE_YELLOW } from "../../../constants/colors";
|
|
|
17
17
|
hideRadioButton: boolean, (keeps section displayed but hides radio and disables open/close function),
|
|
18
18
|
hidden: boolean, (hides section entirely)
|
|
19
19
|
dataQa: string,
|
|
20
|
-
content: <React Component(s)> e.g.: <Box><Stack>cool content stuff</Stack></Box> (any collection of components will work)
|
|
20
|
+
content: <React Component(s)> e.g.: <Box><Stack>cool content stuff</Stack></Box> (any collection of components will work),
|
|
21
|
+
rightTitleContent: <React Component(s)> (rendered on the very right of the title section, use to supplement "rightIcons" with text, as in expired CC status, or render other custom content)
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
Also takes an "openSection" which should equal the id of the section that should be open
|
|
@@ -30,10 +31,6 @@ import { CHARADE_GREY, ASH_GREY, FIRE_YELLOW } from "../../../constants/colors";
|
|
|
30
31
|
|
|
31
32
|
*/
|
|
32
33
|
|
|
33
|
-
const ACTIVE = "ACTIVE";
|
|
34
|
-
const EXPIRING_SOON = "EXPIRING_SOON";
|
|
35
|
-
const EXPIRED = "EXPIRED";
|
|
36
|
-
|
|
37
34
|
const RadioSection = ({
|
|
38
35
|
themeValues,
|
|
39
36
|
isMobile,
|
|
@@ -51,44 +48,6 @@ const RadioSection = ({
|
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
50
|
|
|
54
|
-
const renderCardStatus = item => {
|
|
55
|
-
const { expirationStatus, expireDate } = item;
|
|
56
|
-
switch (expirationStatus) {
|
|
57
|
-
case ACTIVE:
|
|
58
|
-
return (
|
|
59
|
-
<Text
|
|
60
|
-
variant="pXS"
|
|
61
|
-
color={ASH_GREY}
|
|
62
|
-
extraStyles={`text-align: right;`}
|
|
63
|
-
>
|
|
64
|
-
Exp Date {expireDate}
|
|
65
|
-
</Text>
|
|
66
|
-
);
|
|
67
|
-
case EXPIRING_SOON:
|
|
68
|
-
return (
|
|
69
|
-
<Text
|
|
70
|
-
variant="pXS"
|
|
71
|
-
color={FIRE_YELLOW}
|
|
72
|
-
extraStyles={`text-align: right;`}
|
|
73
|
-
>
|
|
74
|
-
Expiring Soon {expireDate}
|
|
75
|
-
</Text>
|
|
76
|
-
);
|
|
77
|
-
case EXPIRED:
|
|
78
|
-
return (
|
|
79
|
-
<Text
|
|
80
|
-
variant="pXS"
|
|
81
|
-
color={ASH_GREY}
|
|
82
|
-
extraStyles={`text-align: right;`}
|
|
83
|
-
>
|
|
84
|
-
Expired
|
|
85
|
-
</Text>
|
|
86
|
-
);
|
|
87
|
-
default:
|
|
88
|
-
null;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
51
|
const wrapper = {
|
|
93
52
|
open: {
|
|
94
53
|
height: openHeight,
|
|
@@ -232,8 +191,8 @@ const RadioSection = ({
|
|
|
232
191
|
))}
|
|
233
192
|
</Cluster>
|
|
234
193
|
)}
|
|
235
|
-
{section.
|
|
236
|
-
<Fragment>{
|
|
194
|
+
{section.rightTitleContent && (
|
|
195
|
+
<Fragment>{rightTitleContent}</Fragment>
|
|
237
196
|
)}
|
|
238
197
|
</Cluster>
|
|
239
198
|
</Box>
|
package/src/util/general.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Fragment } from "react";
|
|
2
2
|
import numeral from "numeral";
|
|
3
|
-
import { CHARADE_GREY } from "../constants/colors";
|
|
3
|
+
import { CHARADE_GREY, ASH_GREY, FIRE_YELLOW } from "../constants/colors";
|
|
4
|
+
import Text from "../components/atoms/text";
|
|
4
5
|
|
|
5
6
|
export const noop = () => {};
|
|
6
7
|
|
|
@@ -159,3 +160,48 @@ export const titleCaseString = string => {
|
|
|
159
160
|
)
|
|
160
161
|
.join(" ");
|
|
161
162
|
};
|
|
163
|
+
|
|
164
|
+
export const renderCardStatus = (
|
|
165
|
+
expirationStatus,
|
|
166
|
+
expireDate,
|
|
167
|
+
textAlign = "right",
|
|
168
|
+
as = "span"
|
|
169
|
+
) => {
|
|
170
|
+
switch (expirationStatus) {
|
|
171
|
+
case ACTIVE:
|
|
172
|
+
return (
|
|
173
|
+
<Text
|
|
174
|
+
as={as}
|
|
175
|
+
variant="pXS"
|
|
176
|
+
color={ASH_GREY}
|
|
177
|
+
extraStyles={`text-align: ${textAlign};`}
|
|
178
|
+
>
|
|
179
|
+
Exp Date {expireDate}
|
|
180
|
+
</Text>
|
|
181
|
+
);
|
|
182
|
+
case EXPIRING_SOON:
|
|
183
|
+
return (
|
|
184
|
+
<Text
|
|
185
|
+
as={as}
|
|
186
|
+
variant="pXS"
|
|
187
|
+
color={FIRE_YELLOW}
|
|
188
|
+
extraStyles={`text-align: ${textAlign};`}
|
|
189
|
+
>
|
|
190
|
+
Expiring Soon {expireDate}
|
|
191
|
+
</Text>
|
|
192
|
+
);
|
|
193
|
+
case EXPIRED:
|
|
194
|
+
return (
|
|
195
|
+
<Text
|
|
196
|
+
as={as}
|
|
197
|
+
variant="pXS"
|
|
198
|
+
color={ASH_GREY}
|
|
199
|
+
extraStyles={`text-align: ${textAlign};`}
|
|
200
|
+
>
|
|
201
|
+
Expired
|
|
202
|
+
</Text>
|
|
203
|
+
);
|
|
204
|
+
default:
|
|
205
|
+
null;
|
|
206
|
+
}
|
|
207
|
+
};
|