@thecb/components 10.3.0 → 10.4.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 +215 -107
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +215 -107
- package/dist/index.esm.js.map +1 -1
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +49322 -0
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/badge/Badge.js +6 -2
- package/src/components/atoms/badge/Badge.stories.js +2 -1
- package/src/components/atoms/badge/Badge.theme.js +8 -4
- package/src/components/atoms/button-with-action/ButtonWithAction.js +27 -21
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +2 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +52 -2
- package/src/components/atoms/icons/.DS_Store +0 -0
- package/src/components/atoms/icons/AutopayIcon.js +2 -2
- package/src/components/atoms/layouts/Box.js +1 -0
- package/src/components/atoms/layouts/examples/box-example/BoxExample.stories.js +2 -1
- package/src/components/atoms/placeholder/Placeholder.js +86 -73
- package/src/components/molecules/link-card/LinkCard.js +13 -6
- package/src/components/molecules/link-card/LinkCard.stories.js +64 -34
- package/src/components/molecules/link-card/LinkCard.styled.js +11 -4
- package/src/components/molecules/link-card/LinkCard.theme.js +20 -5
- package/src/components/molecules/obligation/Obligation.js +6 -1
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +17 -10
- package/src/components/molecules/obligation/modules/InactiveControlsModule.js +6 -3
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +22 -5
- package/src/components/molecules/obligation/modules/RemoveAccountModalModule.js +5 -3
package/package.json
CHANGED
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -32,9 +32,13 @@ const StyledBadge = styled(Text)`
|
|
|
32
32
|
|
|
33
33
|
const Badge = ({ label, Icon, themeValues, iconOnLeft = true }) => (
|
|
34
34
|
<StyledBadgeContainer background={themeValues.background}>
|
|
35
|
-
{iconOnLeft && Icon &&
|
|
35
|
+
{iconOnLeft && Icon && (
|
|
36
|
+
<Icon color={themeValues.color} fill={themeValues.color} />
|
|
37
|
+
)}
|
|
36
38
|
<StyledBadge color={themeValues.color}>{label}</StyledBadge>
|
|
37
|
-
{!iconOnLeft && Icon &&
|
|
39
|
+
{!iconOnLeft && Icon && (
|
|
40
|
+
<Icon color={themeValues.color} fill={themeValues.color} />
|
|
41
|
+
)}
|
|
38
42
|
</StyledBadgeContainer>
|
|
39
43
|
);
|
|
40
44
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
+
MANATEE_GREY,
|
|
3
|
+
GRECIAN_GREY,
|
|
2
4
|
CORNFLOWER_BLUE,
|
|
3
5
|
HALF_COLONIAL_WHITE,
|
|
4
6
|
HINT_GREEN,
|
|
@@ -13,17 +15,19 @@ const background = {
|
|
|
13
15
|
info: `${INFO_BLUE}`,
|
|
14
16
|
warn: `${HALF_COLONIAL_WHITE}`,
|
|
15
17
|
primary: `${CORNFLOWER_BLUE}`,
|
|
16
|
-
success: `${HINT_GREEN}
|
|
18
|
+
success: `${HINT_GREEN}`,
|
|
19
|
+
disabled: `${GRECIAN_GREY}`
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
const color = {
|
|
20
23
|
info: `${MATISSE_BLUE}`,
|
|
21
24
|
warn: `${ZEST_ORANGE}`,
|
|
22
25
|
primary: `${ROYAL_BLUE_VIVID}`,
|
|
23
|
-
success: `${SEA_GREEN}
|
|
26
|
+
success: `${SEA_GREEN}`,
|
|
27
|
+
disabled: `${MANATEE_GREY}`
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
export const fallbackValues = {
|
|
27
|
-
background,
|
|
28
|
-
color
|
|
31
|
+
background: background,
|
|
32
|
+
color: color
|
|
29
33
|
};
|
|
@@ -91,29 +91,35 @@ const ButtonWithAction = forwardRef(
|
|
|
91
91
|
const { isMobile } = themeContext;
|
|
92
92
|
|
|
93
93
|
const hoverStyles = `
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
outline: none;
|
|
95
|
+
background-color: ${themeValues.hoverBackgroundColor};
|
|
96
|
+
border-color: ${themeValues.hoverBorderColor};
|
|
97
|
+
color: ${themeValues.hoverColor};
|
|
98
|
+
text-decoration: ${
|
|
99
|
+
variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
|
|
100
|
+
};
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
`;
|
|
100
103
|
const activeStyles = `
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
outline: none;
|
|
105
|
+
background-color: ${themeValues.activeBackgroundColor};
|
|
106
|
+
border-color: ${themeValues.activeBorderColor};
|
|
107
|
+
color: ${themeValues.activeColor};
|
|
108
|
+
text-decoration: ${
|
|
109
|
+
variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
|
|
110
|
+
};
|
|
105
111
|
`;
|
|
106
112
|
const disabledStyles = `
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
background-color: ${themeValues.disabledBackgroundColor};
|
|
114
|
+
border-color: ${themeValues.disabledBorderColor};
|
|
115
|
+
color: ${themeValues.disabledColor};
|
|
116
|
+
cursor: default;
|
|
117
|
+
&:focus {
|
|
118
|
+
outline: 3px solid ${themeValues.disabledBorderColor};
|
|
119
|
+
outline-offset: 2px;
|
|
120
|
+
}
|
|
121
|
+
${extraDisabledStyles}
|
|
122
|
+
`;
|
|
117
123
|
|
|
118
124
|
return (
|
|
119
125
|
<Box
|
|
@@ -147,7 +153,7 @@ const ButtonWithAction = forwardRef(
|
|
|
147
153
|
<Text
|
|
148
154
|
weight={themeValues.fontWeight}
|
|
149
155
|
variant={themeValues.fontSizeVariant}
|
|
150
|
-
color={themeValues.color}
|
|
156
|
+
color={disabled ? themeValues.disabledColor : themeValues.color}
|
|
151
157
|
textDecoration={themeValues.textDecoration}
|
|
152
158
|
textWrap={textWrap}
|
|
153
159
|
extraStyles={textExtraStyles}
|
|
@@ -12,6 +12,7 @@ const variants = {
|
|
|
12
12
|
smallSecondary: "smallSecondary",
|
|
13
13
|
ghost: "ghost",
|
|
14
14
|
smallGhost: "smallGhost",
|
|
15
|
+
tertiary: "tertiary",
|
|
15
16
|
danger: "danger",
|
|
16
17
|
None: undefined
|
|
17
18
|
};
|
|
@@ -23,10 +24,10 @@ const buttonHandler = () => console.log("Button selected");
|
|
|
23
24
|
export const buttonWithAction = () => (
|
|
24
25
|
<ButtonWithAction
|
|
25
26
|
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
27
|
+
disabled={boolean("disabled", false, "props")}
|
|
26
28
|
text={text("text", "button", "props")}
|
|
27
29
|
isLoading={boolean("isLoading", false, "props")}
|
|
28
30
|
action={text("action", buttonHandler, "props")}
|
|
29
|
-
disabled={boolean("disabled", false, "props")}
|
|
30
31
|
/>
|
|
31
32
|
);
|
|
32
33
|
|
|
@@ -5,13 +5,60 @@ const {
|
|
|
5
5
|
TRANSPARENT,
|
|
6
6
|
SAPPHIRE_BLUE,
|
|
7
7
|
PEACOCK_BLUE,
|
|
8
|
+
MANATEE_GREY,
|
|
8
9
|
MATISSE_BLUE,
|
|
9
10
|
RASPBERRY,
|
|
10
|
-
ERROR_COLOR
|
|
11
|
+
ERROR_COLOR,
|
|
12
|
+
STORM_GREY
|
|
11
13
|
} = colors;
|
|
12
14
|
|
|
13
15
|
const { LINK_TEXT_DECORATION } = styleConstants;
|
|
14
16
|
|
|
17
|
+
const disabledBorderColor = {
|
|
18
|
+
primary: STORM_GREY,
|
|
19
|
+
secondary: STORM_GREY,
|
|
20
|
+
back: TRANSPARENT,
|
|
21
|
+
smallPrimary: STORM_GREY,
|
|
22
|
+
smallSecondary: STORM_GREY,
|
|
23
|
+
smallGhost: TRANSPARENT,
|
|
24
|
+
ghost: TRANSPARENT,
|
|
25
|
+
tertiary: TRANSPARENT,
|
|
26
|
+
danger: STORM_GREY,
|
|
27
|
+
dangerSecondary: STORM_GREY,
|
|
28
|
+
whiteSecondary: TRANSPARENT,
|
|
29
|
+
whitePrimary: TRANSPARENT
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const disabledColor = {
|
|
33
|
+
primary: WHITE,
|
|
34
|
+
secondary: MANATEE_GREY,
|
|
35
|
+
back: MANATEE_GREY,
|
|
36
|
+
smallPrimary: WHITE,
|
|
37
|
+
smallSecondary: MANATEE_GREY,
|
|
38
|
+
smallGhost: MANATEE_GREY,
|
|
39
|
+
ghost: MANATEE_GREY,
|
|
40
|
+
tertiary: MANATEE_GREY,
|
|
41
|
+
danger: WHITE,
|
|
42
|
+
dangerSecondary: MANATEE_GREY,
|
|
43
|
+
whiteSecondary: MANATEE_GREY,
|
|
44
|
+
whitePrimary: MANATEE_GREY
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const disabledBackgroundColor = {
|
|
48
|
+
primary: MANATEE_GREY,
|
|
49
|
+
secondary: TRANSPARENT,
|
|
50
|
+
back: TRANSPARENT,
|
|
51
|
+
smallPrimary: MANATEE_GREY,
|
|
52
|
+
smallSecondary: TRANSPARENT,
|
|
53
|
+
smallGhost: TRANSPARENT,
|
|
54
|
+
ghost: TRANSPARENT,
|
|
55
|
+
tertiary: TRANSPARENT,
|
|
56
|
+
danger: MANATEE_GREY,
|
|
57
|
+
dangerSecondary: TRANSPARENT,
|
|
58
|
+
whiteSecondary: TRANSPARENT,
|
|
59
|
+
whitePrimary: TRANSPARENT
|
|
60
|
+
};
|
|
61
|
+
|
|
15
62
|
const padding = {
|
|
16
63
|
primary: "0.75rem 1.5rem",
|
|
17
64
|
secondary: "0.75rem 1.5rem",
|
|
@@ -252,5 +299,8 @@ export const fallbackValues = {
|
|
|
252
299
|
hoverColor,
|
|
253
300
|
activeBackgroundColor,
|
|
254
301
|
activeBorderColor,
|
|
255
|
-
activeColor
|
|
302
|
+
activeColor,
|
|
303
|
+
disabledColor,
|
|
304
|
+
disabledBackgroundColor,
|
|
305
|
+
disabledBorderColor
|
|
256
306
|
};
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
// Fill color based on default "success" variant color
|
|
4
|
-
const AutopayIcon = ({ fill = "#317D4F" }) => (
|
|
4
|
+
const AutopayIcon = ({ fill = "#317D4F", color = "#317D4F" }) => (
|
|
5
5
|
<svg
|
|
6
6
|
width="16"
|
|
7
7
|
height="16"
|
|
@@ -24,7 +24,7 @@ const AutopayIcon = ({ fill = "#317D4F" }) => (
|
|
|
24
24
|
/>
|
|
25
25
|
</mask>
|
|
26
26
|
<g mask="url(#mask0_5560_39870)">
|
|
27
|
-
<path d="M0 0H16V16H0V0Z" fill={fill} />
|
|
27
|
+
<path d="M0 0H16V16H0V0Z" fill={fill || color} />
|
|
28
28
|
</g>
|
|
29
29
|
</svg>
|
|
30
30
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { text, radios, select } from "@storybook/addon-knobs";
|
|
2
|
+
import { boolean, text, radios, select } from "@storybook/addon-knobs";
|
|
3
3
|
|
|
4
4
|
import page from "../../../../../../.storybook/page";
|
|
5
5
|
import Box from "../../Box";
|
|
@@ -47,6 +47,7 @@ export const box = () => (
|
|
|
47
47
|
onFocus={text("onFocus", () => {}, groupId)}
|
|
48
48
|
onBlur={text("onBlur", () => {}, groupId)}
|
|
49
49
|
onTouchEnd={text("onTouchEnd", () => {}, groupId)}
|
|
50
|
+
disabled={boolean("disabled", false, groupId)}
|
|
50
51
|
>
|
|
51
52
|
Text Child
|
|
52
53
|
<LayoutContentBlock
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
PaymentMethodAddIcon
|
|
18
18
|
} from "../icons";
|
|
19
19
|
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
20
|
+
import { noop } from "../../../util/general";
|
|
20
21
|
|
|
21
22
|
const getLargeIcon = iconName => {
|
|
22
23
|
switch (iconName) {
|
|
@@ -36,21 +37,27 @@ const PlaceholderContentWrapper = ({
|
|
|
36
37
|
action,
|
|
37
38
|
destination,
|
|
38
39
|
children,
|
|
39
|
-
dataQa
|
|
40
|
+
dataQa,
|
|
41
|
+
disabled = false
|
|
40
42
|
}) =>
|
|
41
43
|
isLink ? (
|
|
42
44
|
<Link to={destination} data-qa={dataQa} style={{ textDecoration: "none" }}>
|
|
43
|
-
<Box
|
|
45
|
+
<Box
|
|
46
|
+
padding="0"
|
|
47
|
+
minHeight="100%"
|
|
48
|
+
extraStyles={disabled ? `cursor: default;` : `cursor: pointer;`}
|
|
49
|
+
>
|
|
44
50
|
{children}
|
|
45
51
|
</Box>
|
|
46
52
|
</Link>
|
|
47
53
|
) : (
|
|
48
54
|
<Box
|
|
49
|
-
onClick={action}
|
|
55
|
+
onClick={disabled ? noop : action}
|
|
50
56
|
padding="0"
|
|
51
57
|
minHeight="100%"
|
|
52
|
-
extraStyles={`cursor: pointer;`}
|
|
53
58
|
dataQa={dataQa}
|
|
59
|
+
aria-disabled={disabled}
|
|
60
|
+
extraStyles={disabled ? "cursor: default;" : "cursor: pointer;"}
|
|
54
61
|
>
|
|
55
62
|
{children}
|
|
56
63
|
</Box>
|
|
@@ -65,21 +72,26 @@ const Placeholder = ({
|
|
|
65
72
|
variant,
|
|
66
73
|
largeIcon,
|
|
67
74
|
themeValues,
|
|
68
|
-
dataQa
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
dataQa,
|
|
76
|
+
disabled = false
|
|
77
|
+
}) => {
|
|
78
|
+
const tintedColor = `${tint(0.9, themeValues.color)}`;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<PlaceholderContentWrapper
|
|
82
|
+
isLink={isLink}
|
|
83
|
+
action={action}
|
|
84
|
+
destination={destination}
|
|
85
|
+
dataQa={dataQa}
|
|
86
|
+
disabled={disabled}
|
|
87
|
+
>
|
|
88
|
+
<Box
|
|
89
|
+
padding="0"
|
|
90
|
+
borderRadius="4px"
|
|
91
|
+
border="none"
|
|
92
|
+
minHeight={themeValues.height}
|
|
93
|
+
hiddenStyles={!visible}
|
|
94
|
+
extraStyles={`
|
|
83
95
|
background: linear-gradient(
|
|
84
96
|
to right,
|
|
85
97
|
${variant === "large" ? STORM_GREY : themeValues.color} 40%,
|
|
@@ -100,22 +112,22 @@ const Placeholder = ({
|
|
|
100
112
|
display: flex;
|
|
101
113
|
justify-content: center;
|
|
102
114
|
align-items:center;`}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
hoverStyles={`background-color: ${
|
|
116
|
+
variant === "large" ? GRECIAN_GREY : tintedColor
|
|
117
|
+
};`}
|
|
118
|
+
>
|
|
119
|
+
<Center maxWidth="300px">
|
|
120
|
+
<Box
|
|
121
|
+
padding="0"
|
|
122
|
+
tabIndex="0"
|
|
123
|
+
onKeyPress={e => e.key === "Enter" && !disabled && action()}
|
|
124
|
+
>
|
|
125
|
+
<Cluster justify="center" align="center" minHeight="100%">
|
|
126
|
+
<Switcher maxChildren={2} childGap="0">
|
|
127
|
+
{variant === "large" && <div></div>}
|
|
128
|
+
<Box
|
|
129
|
+
padding="0"
|
|
130
|
+
extraStyles={`.fill {
|
|
119
131
|
fill: ${
|
|
120
132
|
variant === "large" ? CHARADE_GREY : themeValues.color
|
|
121
133
|
};
|
|
@@ -124,44 +136,45 @@ const Placeholder = ({
|
|
|
124
136
|
variant === "large" ? CHARADE_GREY : themeValues.color
|
|
125
137
|
};
|
|
126
138
|
}`}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
);
|
|
139
|
+
>
|
|
140
|
+
{variant === "large" ? (
|
|
141
|
+
<Center intrinsic>
|
|
142
|
+
{getLargeIcon(largeIcon)}
|
|
143
|
+
<Text
|
|
144
|
+
variant="pS"
|
|
145
|
+
color={themeValues.color}
|
|
146
|
+
weight={FONT_WEIGHT_REGULAR}
|
|
147
|
+
extraStyles={`text-align: center;`}
|
|
148
|
+
>
|
|
149
|
+
{text}
|
|
150
|
+
</Text>
|
|
151
|
+
</Center>
|
|
152
|
+
) : (
|
|
153
|
+
<Cover singleChild minHeight="100%">
|
|
154
|
+
<Cluster justify="center" align="center">
|
|
155
|
+
<IconAdd />
|
|
156
|
+
<Center intrinsic>
|
|
157
|
+
<Text
|
|
158
|
+
variant="pS"
|
|
159
|
+
color={themeValues.color}
|
|
160
|
+
weight={FONT_WEIGHT_REGULAR}
|
|
161
|
+
extraStyles={`padding: 0 0 0 8px; text-align: center;`}
|
|
162
|
+
>
|
|
163
|
+
{text}
|
|
164
|
+
</Text>
|
|
165
|
+
</Center>
|
|
166
|
+
</Cluster>
|
|
167
|
+
</Cover>
|
|
168
|
+
)}
|
|
169
|
+
</Box>
|
|
170
|
+
</Switcher>
|
|
171
|
+
</Cluster>
|
|
172
|
+
</Box>
|
|
173
|
+
</Center>
|
|
174
|
+
</Box>
|
|
175
|
+
</PlaceholderContentWrapper>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
165
178
|
|
|
166
179
|
export default themeComponent(
|
|
167
180
|
Placeholder,
|
|
@@ -4,8 +4,10 @@ import { themeComponent } from "../../../util/themeUtils";
|
|
|
4
4
|
import { fallbackValues } from "./LinkCard.theme";
|
|
5
5
|
import { ThemeContext } from "styled-components";
|
|
6
6
|
import * as Styled from "./LinkCard.styled";
|
|
7
|
+
import { noop } from "../../../util/general";
|
|
7
8
|
|
|
8
9
|
const LinkCard = ({
|
|
10
|
+
variant = "primary", // "primary" | "disabled"
|
|
9
11
|
title = "Test Workflow",
|
|
10
12
|
subtitle = "Link your benefit plan",
|
|
11
13
|
showLeft,
|
|
@@ -17,7 +19,8 @@ const LinkCard = ({
|
|
|
17
19
|
extraHoverStyles = "",
|
|
18
20
|
extraActiveStyles = "",
|
|
19
21
|
themeValues,
|
|
20
|
-
titleVariant = "h3"
|
|
22
|
+
titleVariant = "h3",
|
|
23
|
+
disabled = false
|
|
21
24
|
}) => {
|
|
22
25
|
const { isMobile } = useContext(ThemeContext);
|
|
23
26
|
const regex = /\W/g;
|
|
@@ -36,7 +39,8 @@ const LinkCard = ({
|
|
|
36
39
|
extraStyles={extraStyles}
|
|
37
40
|
hoverStyles={extraHoverStyles}
|
|
38
41
|
activeStyles={extraActiveStyles}
|
|
39
|
-
onClick={onClick}
|
|
42
|
+
onClick={disabled ? noop : onClick}
|
|
43
|
+
disabled={disabled}
|
|
40
44
|
>
|
|
41
45
|
<Stack
|
|
42
46
|
childGap={0}
|
|
@@ -63,9 +67,12 @@ const LinkCard = ({
|
|
|
63
67
|
>
|
|
64
68
|
<Styled.Footer direction="row" childGap="6px" justify="space-between">
|
|
65
69
|
{/* To keep rightContent aligned right, use an empty Box as leftContent if none is provided */}
|
|
66
|
-
{showLeft &&
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
{showLeft && !!leftContent ? (
|
|
71
|
+
leftContent
|
|
72
|
+
) : (
|
|
73
|
+
<Box extraStyles="margin-right: auto;" />
|
|
74
|
+
)}
|
|
75
|
+
{showRight && !!rightContent && rightContent}
|
|
69
76
|
</Styled.Footer>
|
|
70
77
|
</Box>
|
|
71
78
|
</Stack>
|
|
@@ -73,4 +80,4 @@ const LinkCard = ({
|
|
|
73
80
|
);
|
|
74
81
|
};
|
|
75
82
|
|
|
76
|
-
export default themeComponent(LinkCard, "LinkCard", fallbackValues);
|
|
83
|
+
export default themeComponent(LinkCard, "LinkCard", fallbackValues, "primary");
|
|
@@ -1,49 +1,79 @@
|
|
|
1
|
+
import page from "../../../../.storybook/page";
|
|
2
|
+
import { boolean, select, text } from "@storybook/addon-knobs";
|
|
1
3
|
import React from "react";
|
|
2
4
|
import LinkCard from "./LinkCard";
|
|
3
5
|
import Box from "../../atoms/layouts/Box";
|
|
4
6
|
import Stack from "../../atoms/layouts/Stack";
|
|
5
7
|
import Text from "../../atoms/text/Text";
|
|
6
|
-
import page from "../../../../.storybook/page";
|
|
7
|
-
import { text } from "@storybook/addon-knobs";
|
|
8
8
|
import Badge from "../../atoms/badge/Badge";
|
|
9
9
|
import PlusCircleIcon from "../../atoms/icons/PlusCircleIcon";
|
|
10
10
|
import AutopayIcon from "../../atoms/icons/AutopayIcon";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
CORNFLOWER_BLUE,
|
|
13
|
+
ROYAL_BLUE_VIVID,
|
|
14
|
+
MANATEE_GREY,
|
|
15
|
+
TRANSPARENT
|
|
16
|
+
} from "../../../constants/colors";
|
|
17
|
+
|
|
12
18
|
const groupId = "props";
|
|
19
|
+
const variant = "primary";
|
|
20
|
+
const variants = { primary: "primary", disabled: "disabled" };
|
|
21
|
+
const disabled = false;
|
|
22
|
+
const showLeft = true;
|
|
13
23
|
|
|
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
|
-
|
|
24
|
+
const renderLeftContent = ({ disabled }) => {
|
|
25
|
+
return (
|
|
26
|
+
<Box background="transparent" borderWidthOverride="0 0 0 0" padding="0">
|
|
27
|
+
<Badge
|
|
28
|
+
label="Autopay Available"
|
|
29
|
+
Icon={AutopayIcon}
|
|
30
|
+
variant={disabled ? "disabled" : "success"}
|
|
31
|
+
/>
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
const renderRightContent = ({ disabled }) => {
|
|
36
|
+
return (
|
|
37
|
+
<Stack direction="row" childGap="6px">
|
|
38
|
+
<Text
|
|
39
|
+
variant="pS"
|
|
40
|
+
disabled={disabled || variant === "disabled"}
|
|
41
|
+
className="show-on-hover"
|
|
42
|
+
color={disabled ? MANATEE_GREY : ROYAL_BLUE_VIVID}
|
|
43
|
+
extraStyles={`text-align: right; color: transparent; ${
|
|
44
|
+
!showLeft ? "margin-left: auto;" : ""
|
|
45
|
+
}`}
|
|
46
|
+
>
|
|
47
|
+
Find
|
|
48
|
+
</Text>
|
|
49
|
+
<PlusCircleIcon color={disabled ? MANATEE_GREY : ROYAL_BLUE_VIVID} />
|
|
50
|
+
</Stack>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
export const linkCard = () => {
|
|
54
|
+
return (
|
|
55
|
+
<LinkCard
|
|
56
|
+
disabled={boolean("disabled", disabled, groupId)}
|
|
57
|
+
variant={select("variant", variants, variant, groupId)}
|
|
58
|
+
title={text("title", "Link Card Title", groupId)}
|
|
59
|
+
subtitle={text("subtitle", "Link card description", groupId)}
|
|
60
|
+
path={text("path", "/service/animal-care-and-control", groupId)}
|
|
61
|
+
showLeft={boolean("showLeft", true, groupId)}
|
|
62
|
+
onClick={() => window.alert("Click event!")}
|
|
63
|
+
leftContent={renderLeftContent({ disabled })}
|
|
64
|
+
showRight={boolean("showRight", true, groupId)}
|
|
65
|
+
rightContent={renderRightContent({ disabled })}
|
|
66
|
+
extraHoverStyles={`
|
|
67
|
+
.show-on-hover {
|
|
68
|
+
color: ${disabled ? TRANSPARENT : ROYAL_BLUE_VIVID};
|
|
69
|
+
}
|
|
41
70
|
`}
|
|
42
|
-
|
|
43
|
-
background-color: ${CORNFLOWER_BLUE};
|
|
71
|
+
extraActiveStyles={`
|
|
72
|
+
background-color: ${disabled ? TRANSPARENT : CORNFLOWER_BLUE};
|
|
44
73
|
`}
|
|
45
|
-
|
|
46
|
-
);
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
47
77
|
|
|
48
78
|
const story = page({
|
|
49
79
|
title: "Components|Molecules/LinkCard",
|