@thecb/components 4.0.7-beta.0 → 4.0.9
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/.tool-versions +1 -0
- package/dist/index.cjs.js +1154 -148
- package/package.json +2 -1
- package/src/components/atoms/card/Card.js +121 -0
- package/src/components/atoms/card/Card.theme.js +9 -0
- package/src/components/atoms/card/index.js +37 -0
- package/src/components/atoms/icons/PropertiesAddIcon.js +1 -6
- package/src/components/atoms/index.js +1 -0
- package/src/components/atoms/placeholder/Placeholder.js +20 -7
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/welcome-module/WelcomeModule.js +52 -0
- package/src/components/molecules/welcome-module/WelcomeModule.theme.js +15 -0
- package/src/components/molecules/welcome-module/index.js +3 -0
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js +0 -38375
- package/dist/index.esm.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecb/components",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
4
4
|
"description": "Common lib for CityBase react components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"formatted-input": "^0.1.3",
|
|
77
77
|
"framer-motion": "^1.11.0",
|
|
78
78
|
"numeral": "^2.0.6",
|
|
79
|
+
"polished": "^4.0.3",
|
|
79
80
|
"ramda": "^0.27.0",
|
|
80
81
|
"react-aria-modal": "^4.0.0",
|
|
81
82
|
"react-pose": "^4.0.10",
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { Fragment, useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "styled-components";
|
|
3
|
+
import { useNavigate } from "react-router-dom";
|
|
4
|
+
import { Box, Stack, Cover } from "../layouts";
|
|
5
|
+
import Text from "../text";
|
|
6
|
+
import Heading from "../heading";
|
|
7
|
+
import ButtonWithAction from "../button-with-action";
|
|
8
|
+
import { fallbackValues } from "./Card.theme";
|
|
9
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
10
|
+
import {
|
|
11
|
+
AccountsAddIcon,
|
|
12
|
+
PropertiesAddIcon,
|
|
13
|
+
PaymentMethodIcon
|
|
14
|
+
} from "../icons";
|
|
15
|
+
import withWindowSize from "../../withWindowSize";
|
|
16
|
+
|
|
17
|
+
const CardVariantSwitcher = ({ variant, children }) => {
|
|
18
|
+
return variant === "vertical" ? (
|
|
19
|
+
<Fragment>{children}</Fragment>
|
|
20
|
+
) : (
|
|
21
|
+
<Box padding="0" extraStyles={`width: 100%`}>
|
|
22
|
+
<Stack childGap="0" maxWidth="100%" fullHeight>
|
|
23
|
+
{children}
|
|
24
|
+
</Stack>
|
|
25
|
+
</Box>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const Card = ({
|
|
30
|
+
themeValues,
|
|
31
|
+
icon,
|
|
32
|
+
heading,
|
|
33
|
+
text,
|
|
34
|
+
cardAction = "/profile",
|
|
35
|
+
buttonText,
|
|
36
|
+
variant = "vertical"
|
|
37
|
+
}) => {
|
|
38
|
+
const { isMobile } = useContext(ThemeContext);
|
|
39
|
+
let navigate = useNavigate();
|
|
40
|
+
|
|
41
|
+
const renderIcon = icon => {
|
|
42
|
+
switch (icon) {
|
|
43
|
+
case "accounts":
|
|
44
|
+
return <AccountsAddIcon />;
|
|
45
|
+
case "properties":
|
|
46
|
+
return <PropertiesAddIcon />;
|
|
47
|
+
case "payment":
|
|
48
|
+
return <PaymentMethodIcon />;
|
|
49
|
+
default:
|
|
50
|
+
return <PaymentMethodIcon />;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Box
|
|
56
|
+
background={themeValues.backgroundColor}
|
|
57
|
+
borderRadius="4px"
|
|
58
|
+
boxShadow=" 0px 1px 10px 0px rgb(246, 246, 249),
|
|
59
|
+
0px 2px 5px 0px rgb(202, 206, 216)"
|
|
60
|
+
padding="0"
|
|
61
|
+
maxWidth="100%"
|
|
62
|
+
minHeight="100%"
|
|
63
|
+
minWidth={variant !== "vertical" && "300px"}
|
|
64
|
+
>
|
|
65
|
+
<Cover singleChild fillCenter>
|
|
66
|
+
<Stack
|
|
67
|
+
direction={variant === "vertical" ? "column" : "row"}
|
|
68
|
+
justify={variant === "vertical" && "center"}
|
|
69
|
+
fullHeight
|
|
70
|
+
childGap="0"
|
|
71
|
+
>
|
|
72
|
+
{icon && (
|
|
73
|
+
<Box padding="0" background={themeValues.iconBackgroundColor}>
|
|
74
|
+
<Stack
|
|
75
|
+
direction={variant === "vertical" ? "row" : "column"}
|
|
76
|
+
justify="center"
|
|
77
|
+
fullHeight
|
|
78
|
+
>
|
|
79
|
+
<Box
|
|
80
|
+
padding={
|
|
81
|
+
variant === "vertical"
|
|
82
|
+
? "0.5rem 0"
|
|
83
|
+
: isMobile
|
|
84
|
+
? "1rem 1.5rem"
|
|
85
|
+
: "2rem 2.5rem"
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
{renderIcon(icon)}
|
|
89
|
+
</Box>
|
|
90
|
+
</Stack>
|
|
91
|
+
</Box>
|
|
92
|
+
)}
|
|
93
|
+
<CardVariantSwitcher variant={variant}>
|
|
94
|
+
<Box
|
|
95
|
+
padding="0.5rem 1rem"
|
|
96
|
+
width="100%"
|
|
97
|
+
extraStyles={`flex-grow: 1; width: 100%;`}
|
|
98
|
+
>
|
|
99
|
+
<Cover singleChild fillCenter>
|
|
100
|
+
<Box padding="0">
|
|
101
|
+
<Heading variant="h6">{heading}</Heading>
|
|
102
|
+
<Text variant="pS">{text}</Text>
|
|
103
|
+
</Box>
|
|
104
|
+
</Cover>
|
|
105
|
+
</Box>
|
|
106
|
+
<Box padding="0.5rem 1rem 1rem">
|
|
107
|
+
<ButtonWithAction
|
|
108
|
+
variant="smallPrimary"
|
|
109
|
+
text={buttonText}
|
|
110
|
+
action={() => navigate(cardAction)}
|
|
111
|
+
extraStyles={`width: 100%;`}
|
|
112
|
+
/>
|
|
113
|
+
</Box>
|
|
114
|
+
</CardVariantSwitcher>
|
|
115
|
+
</Stack>
|
|
116
|
+
</Cover>
|
|
117
|
+
</Box>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default themeComponent(withWindowSize(Card), "Card", fallbackValues);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Card from "./Card";
|
|
3
|
+
|
|
4
|
+
export const cardRegistry = {
|
|
5
|
+
accounts: props => (
|
|
6
|
+
<Card
|
|
7
|
+
icon="accounts"
|
|
8
|
+
heading="Add an Account"
|
|
9
|
+
buttonText="Add Account"
|
|
10
|
+
text="Add your accounts to this profile to make your payments simple."
|
|
11
|
+
cardAction="/profile/accounts"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
),
|
|
15
|
+
properties: props => (
|
|
16
|
+
<Card
|
|
17
|
+
icon="properties"
|
|
18
|
+
heading="Add a Property"
|
|
19
|
+
buttonText="Add Property"
|
|
20
|
+
text="Add a home, car, or other types of personal or business property."
|
|
21
|
+
cardAction="/profile/properties"
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
),
|
|
25
|
+
payment: props => (
|
|
26
|
+
<Card
|
|
27
|
+
icon="payment"
|
|
28
|
+
heading="Add a Payment Method"
|
|
29
|
+
buttonText="Add Payment Method"
|
|
30
|
+
text="Save cards and/or bank accounts to your profile for fast future payments."
|
|
31
|
+
cardAction="/profile/settings"
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default cardRegistry;
|
|
@@ -3,12 +3,7 @@ import { fallbackValues } from "./Icons.theme";
|
|
|
3
3
|
import { themeComponent } from "../../../util/themeUtils";
|
|
4
4
|
const PropertiesAddIcon = ({ themeValues }) => {
|
|
5
5
|
return (
|
|
6
|
-
<svg
|
|
7
|
-
width={100}
|
|
8
|
-
height={100}
|
|
9
|
-
viewBox="0 0 100 100"
|
|
10
|
-
style={{ paddingLeft: "16px" }}
|
|
11
|
-
>
|
|
6
|
+
<svg width={100} height={100} viewBox="0 0 84 100">
|
|
12
7
|
<title>{"8330C897-662E-49C5-B716-3661563AA1FB@1.00x"}</title>
|
|
13
8
|
<defs>
|
|
14
9
|
<path id="prefix__a" d="M0 0h100v100H0z" />
|
|
@@ -4,6 +4,7 @@ export { default as AmountCallout } from "./amount-callout";
|
|
|
4
4
|
export { default as Breadcrumb } from "./breadcrumb";
|
|
5
5
|
export { default as ButtonWithAction } from "./button-with-action";
|
|
6
6
|
export { default as ButtonWithLink } from "./button-with-link";
|
|
7
|
+
export { default as cardRegistry } from "./card";
|
|
7
8
|
export { default as Checkbox } from "./checkbox";
|
|
8
9
|
export { default as CheckboxList } from "./checkbox-list";
|
|
9
10
|
export { default as CountryDropdown } from "./country-dropdown";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { tint } from "polished";
|
|
2
3
|
import { Link } from "react-router-dom";
|
|
3
4
|
import Text from "../text";
|
|
4
5
|
import { Box, Switcher, Center, Cluster, Cover } from "../layouts";
|
|
@@ -63,19 +64,27 @@ const Placeholder = ({
|
|
|
63
64
|
extraStyles={`
|
|
64
65
|
background: linear-gradient(
|
|
65
66
|
to right,
|
|
66
|
-
${STORM_GREY} 40%,
|
|
67
|
+
${variant === "large" ? STORM_GREY : themeValues.color} 40%,
|
|
67
68
|
rgba(255, 255, 255, 0) 0%
|
|
68
69
|
),
|
|
69
|
-
linear-gradient(${
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
linear-gradient(${
|
|
71
|
+
variant === "large" ? STORM_GREY : themeValues.color
|
|
72
|
+
} 40%, rgba(255, 255, 255, 0) 0%),
|
|
73
|
+
linear-gradient(to right, ${
|
|
74
|
+
variant === "large" ? STORM_GREY : themeValues.color
|
|
75
|
+
} 40%, rgba(255, 255, 255, 0) 0%),
|
|
76
|
+
linear-gradient(${
|
|
77
|
+
variant === "large" ? STORM_GREY : themeValues.color
|
|
78
|
+
} 40%, rgba(255, 255, 255, 0) 0%);
|
|
72
79
|
background-position: top, right, bottom, left;
|
|
73
80
|
background-repeat: repeat-x, repeat-y;
|
|
74
81
|
background-size: 5px 1px, 1px 5px;
|
|
75
82
|
display: flex;
|
|
76
83
|
justify-content: center;
|
|
77
84
|
align-items:center;`}
|
|
78
|
-
hoverStyles={`background-color: ${
|
|
85
|
+
hoverStyles={`background-color: ${
|
|
86
|
+
variant === "large" ? GRECIAN_GREY : tint(0.9, themeValues.color)
|
|
87
|
+
};`}
|
|
79
88
|
>
|
|
80
89
|
<Center maxWidth="300px">
|
|
81
90
|
<Box padding="0px 0px 0px 0px">
|
|
@@ -85,9 +94,13 @@ const Placeholder = ({
|
|
|
85
94
|
<Box
|
|
86
95
|
padding="0"
|
|
87
96
|
extraStyles={`.fill {
|
|
88
|
-
fill: ${
|
|
97
|
+
fill: ${
|
|
98
|
+
variant === "large" ? CHARADE_GREY : themeValues.color
|
|
99
|
+
};
|
|
89
100
|
} .stroke {
|
|
90
|
-
stroke: ${
|
|
101
|
+
stroke: ${
|
|
102
|
+
variant === "large" ? CHARADE_GREY : themeValues.color
|
|
103
|
+
};
|
|
91
104
|
}`}
|
|
92
105
|
>
|
|
93
106
|
{variant === "large" ? (
|
|
@@ -28,4 +28,5 @@ export { default as TabSidebar } from "./tab-sidebar";
|
|
|
28
28
|
export { default as TermsAndConditions } from "./terms-and-conditions";
|
|
29
29
|
export { default as TermsAndConditionsModal } from "./terms-and-conditions-modal";
|
|
30
30
|
export { default as Timeout } from "./timeout";
|
|
31
|
+
export { default as WelcomeModule } from "./welcome-module";
|
|
31
32
|
export { default as WorkflowTile } from "./workflow-tile";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { Fragment, memo } from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
+
import { fallbackValues } from "./WelcomeModule.theme";
|
|
5
|
+
import Heading from "../../atoms/heading";
|
|
6
|
+
import { Box, Cluster } from "../../atoms/layouts";
|
|
7
|
+
|
|
8
|
+
const WelcomeImage = styled.img`
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: auto;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const WelcomeModule = ({ heading, isMobile, themeValues }) => {
|
|
14
|
+
const welcomeImage =
|
|
15
|
+
"https://cb-public-assets.s3-us-west-2.amazonaws.com/profile-assets/profile-welcome-image.png";
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Fragment>
|
|
19
|
+
<Box padding="0">
|
|
20
|
+
{isMobile && (
|
|
21
|
+
<Box padding="0" background={themeValues.imageBackgroundColor}>
|
|
22
|
+
<Cluster justify="center">
|
|
23
|
+
<WelcomeImage src={welcomeImage} />
|
|
24
|
+
</Cluster>
|
|
25
|
+
</Box>
|
|
26
|
+
)}
|
|
27
|
+
<Box background={themeValues.headerBackgroundColor}>
|
|
28
|
+
<Heading
|
|
29
|
+
variant="h5"
|
|
30
|
+
weight={themeValues.fontWeight}
|
|
31
|
+
color={themeValues.fontColor}
|
|
32
|
+
textAlign={themeValues.textAlign}
|
|
33
|
+
aria-level="3"
|
|
34
|
+
>
|
|
35
|
+
{heading}
|
|
36
|
+
</Heading>
|
|
37
|
+
</Box>
|
|
38
|
+
{!isMobile && (
|
|
39
|
+
<Box padding="0" background={themeValues.imageBackgroundColor}>
|
|
40
|
+
<Cluster justify="center" align="flex-end">
|
|
41
|
+
<WelcomeImage src={welcomeImage} />
|
|
42
|
+
</Cluster>
|
|
43
|
+
</Box>
|
|
44
|
+
)}
|
|
45
|
+
</Box>
|
|
46
|
+
</Fragment>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default memo(
|
|
51
|
+
themeComponent(WelcomeModule, "WelcomeModule", fallbackValues)
|
|
52
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MATISSE_BLUE, BRIGHT_GREY, WHITE } from "../../../constants/colors";
|
|
2
|
+
|
|
3
|
+
const fontWeight = "600";
|
|
4
|
+
const fontColor = WHITE;
|
|
5
|
+
const textAlign = "left";
|
|
6
|
+
const headerBackgroundColor = BRIGHT_GREY;
|
|
7
|
+
const imageBackgroundColor = MATISSE_BLUE;
|
|
8
|
+
|
|
9
|
+
export const fallbackValues = {
|
|
10
|
+
fontWeight,
|
|
11
|
+
fontColor,
|
|
12
|
+
textAlign,
|
|
13
|
+
headerBackgroundColor,
|
|
14
|
+
imageBackgroundColor
|
|
15
|
+
};
|