@thecb/components 10.4.0-beta.0 → 10.4.0-beta.2
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/README.md +2 -2
- package/dist/index.cjs.js +812 -323
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +64 -1
- package/dist/index.esm.js +808 -322
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- 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/breadcrumb/Breadcrumb.js +4 -3
- package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +5 -2
- package/src/components/atoms/button-with-action/ButtonWithAction.js +34 -31
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +5 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +74 -4
- package/src/components/atoms/button-with-link/ButtonWithLink.js +7 -3
- package/src/components/atoms/form-layouts/FormInput.js +1 -1
- package/src/components/atoms/icons/AutopayIcon.js +2 -2
- package/src/components/atoms/icons/CloseIcon.d.ts +1 -0
- package/src/components/atoms/icons/CloseIcon.js +48 -0
- package/src/components/atoms/icons/MultiCartIcon.js +12 -10
- package/src/components/atoms/icons/TrashIconV2.d.ts +1 -0
- package/src/components/atoms/icons/TrashIconV2.js +41 -0
- package/src/components/atoms/icons/icons.stories.js +5 -1
- package/src/components/atoms/icons/index.d.ts +2 -0
- package/src/components/atoms/icons/index.js +5 -1
- package/src/components/atoms/jumbo/Jumbo.js +1 -5
- package/src/components/atoms/layouts/Box.js +1 -0
- package/src/components/atoms/layouts/Box.styled.js +15 -0
- package/src/components/atoms/layouts/examples/box-example/BoxExample.stories.js +2 -1
- package/src/components/atoms/link/ExternalLink.styled.js +6 -3
- package/src/components/atoms/link/InternalLink.styled.js +6 -3
- package/src/components/atoms/placeholder/Placeholder.js +87 -74
- package/src/components/atoms/placeholder/Placeholder.stories.js +2 -2
- package/src/components/atoms/text/Text.styled.js +1 -0
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +1 -0
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.stories.js +41 -0
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.theme.js +10 -2
- package/src/components/molecules/index.d.ts +1 -0
- package/src/components/molecules/index.js +1 -0
- 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 +3 -0
- package/src/components/molecules/obligation/modules/AmountModule.js +3 -1
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +33 -21
- package/src/components/molecules/obligation/modules/InactiveControlsModule.js +6 -3
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +20 -5
- package/src/components/molecules/obligation/modules/RemoveAccountModalModule.js +4 -2
- package/src/components/molecules/pagination/Pagination.js +1 -7
- package/src/components/molecules/pagination/Pagination.stories.js +32 -0
- package/src/components/molecules/pagination/Pagination.theme.js +1 -2
- package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +6 -1
- package/src/components/molecules/tab-sidebar/TabSidebar.js +2 -2
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +1 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.theme.js +10 -2
- package/src/components/templates/default-page-template/DefaultPageTemplate.js +3 -2
- package/src/constants/index.d.ts +2 -1
- package/src/constants/index.js +12 -3
- package/src/constants/style_constants.d.ts +11 -0
- package/src/constants/style_constants.js +3 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import {
|
|
3
|
+
import { colors, styleConstants } from "../../../constants";
|
|
4
|
+
|
|
5
|
+
const { ROYAL_BLUE } = colors;
|
|
6
|
+
const { LINK_TEXT_DECORATION } = styleConstants;
|
|
7
|
+
|
|
4
8
|
/*
|
|
5
9
|
The extracting of props and the disabling of the eslint rule is to stop React from complaining about
|
|
6
10
|
unrecognized DOM attributes.
|
|
@@ -18,10 +22,10 @@ export const StyledExternalLink = styled(
|
|
|
18
22
|
font-weight: ${({ weight }) => weight};
|
|
19
23
|
font-family: ${({ fontFamily }) => fontFamily};
|
|
20
24
|
line-height: ${({ lineheight }) => lineheight};
|
|
25
|
+
text-decoration: ${LINK_TEXT_DECORATION};
|
|
21
26
|
|
|
22
27
|
&:hover {
|
|
23
28
|
color: ${({ hoverColor }) => hoverColor};
|
|
24
|
-
text-decoration: underline;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
&:focus {
|
|
@@ -30,7 +34,6 @@ export const StyledExternalLink = styled(
|
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
&:active {
|
|
33
|
-
text-decoration: underline;
|
|
34
37
|
color: ${({ activeColor }) => activeColor};
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { Link } from "react-router-dom";
|
|
4
|
-
import {
|
|
4
|
+
import { colors, styleConstants } from "../../../constants";
|
|
5
|
+
|
|
6
|
+
const { ROYAL_BLUE } = colors;
|
|
7
|
+
const { LINK_TEXT_DECORATION } = styleConstants;
|
|
8
|
+
|
|
5
9
|
/*
|
|
6
10
|
The extracting of props and the disabling of the eslint rule is to stop React from complaining about
|
|
7
11
|
unrecognized DOM attributes.
|
|
@@ -24,10 +28,10 @@ export const StyledInternalLink = styled(
|
|
|
24
28
|
font-size: ${({ fontSize }) => fontSize};
|
|
25
29
|
font-family: ${({ fontFamily }) => fontFamily};
|
|
26
30
|
margin: ${({ margin }) => margin};
|
|
31
|
+
text-decoration: ${LINK_TEXT_DECORATION};
|
|
27
32
|
|
|
28
33
|
&:hover {
|
|
29
34
|
color: ${({ hoverColor }) => hoverColor};
|
|
30
|
-
text-decoration: underline;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
&:focus {
|
|
@@ -36,7 +40,6 @@ export const StyledInternalLink = styled(
|
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
&:active {
|
|
39
|
-
text-decoration: underline;
|
|
40
43
|
color: ${({ activeColor }) => activeColor};
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -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
|
-
<Link to={destination} data-qa={dataQa}>
|
|
43
|
-
<Box
|
|
44
|
+
<Link to={destination} data-qa={dataQa} style={{ textDecoration: "none" }}>
|
|
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,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { text, select } from "@storybook/addon-knobs";
|
|
2
|
+
import { boolean, text, select } from "@storybook/addon-knobs";
|
|
3
3
|
import Placeholder from "./Placeholder";
|
|
4
4
|
import page from "../../../../.storybook/page";
|
|
5
5
|
|
|
@@ -23,7 +23,7 @@ const defaultIcon = "accounts";
|
|
|
23
23
|
export const placeholder = () => (
|
|
24
24
|
<Placeholder
|
|
25
25
|
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
26
|
-
isLink
|
|
26
|
+
isLink={boolean("isLink", true, "props")}
|
|
27
27
|
destination={text("destination", "add-account", "props")}
|
|
28
28
|
text={text("text", "Add an Account", "props")}
|
|
29
29
|
largeIcon={select(iconLabel, icons, defaultIcon, groupId)}
|
|
@@ -8,6 +8,7 @@ export const TextSpan = styled.span`
|
|
|
8
8
|
font-weight: ${({ weight }) => weight};
|
|
9
9
|
font-family: ${({ fontFamily }) => fontFamily};
|
|
10
10
|
color: ${({ color }) => color};
|
|
11
|
+
text-decoration: ${({ textDecoration }) => textDecoration};
|
|
11
12
|
white-space: ${({ $textWrap }) => ($textWrap ? "initial" : "nowrap")};
|
|
12
13
|
|
|
13
14
|
&:hover {
|
|
@@ -60,6 +60,7 @@ const AccountAndRoutingModal = ({
|
|
|
60
60
|
color={themeValues.linkColor}
|
|
61
61
|
weight={themeValues.fontWeight}
|
|
62
62
|
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
63
|
+
textDecoration={themeValues.linkTextDecoration}
|
|
63
64
|
extraStyles={`cursor: pointer;`}
|
|
64
65
|
role="button"
|
|
65
66
|
className="modal-trigger"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { connect } from "react-redux";
|
|
3
|
+
import { boolean, select, text } from "@storybook/addon-knobs";
|
|
4
|
+
|
|
5
|
+
import AccountAndRoutingModal from "./AccountAndRoutingModal";
|
|
6
|
+
import page from "../../../../.storybook/page";
|
|
7
|
+
|
|
8
|
+
const groupId = "props";
|
|
9
|
+
|
|
10
|
+
const variants = {
|
|
11
|
+
default: "default",
|
|
12
|
+
None: undefined
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const linkVariants = {
|
|
16
|
+
p: "p",
|
|
17
|
+
pL: "pL",
|
|
18
|
+
pS: "pS",
|
|
19
|
+
pXS: "pXS",
|
|
20
|
+
pXXS: "pXXS",
|
|
21
|
+
pXL: "PXL"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const accountAndRoutingModal = () => (
|
|
25
|
+
<AccountAndRoutingModal
|
|
26
|
+
link={text("text", "Show modal", groupId)}
|
|
27
|
+
title={text("title", "Title", groupId)}
|
|
28
|
+
isOpen={boolean("isOpen", false, groupId)}
|
|
29
|
+
acceptText={text("acceptText", "Accept", groupId)}
|
|
30
|
+
content="Your routing number is the 9-digit..."
|
|
31
|
+
variant={select("variants", variants, "default", groupId)}
|
|
32
|
+
linkVariant={select("linkVariants", linkVariants, groupId)}
|
|
33
|
+
initialFocusSelector="[name='Cancel']"
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const story = page({
|
|
38
|
+
title: "Components|Molecules/AccountAndRoutingModal",
|
|
39
|
+
Component: AccountAndRoutingModal
|
|
40
|
+
});
|
|
41
|
+
export default story;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FONT_WEIGHT_REGULAR,
|
|
3
|
+
LINK_TEXT_DECORATION
|
|
4
|
+
} from "../../../constants/style_constants";
|
|
2
5
|
|
|
3
6
|
const linkColor = { default: "#3176AA" };
|
|
4
7
|
const fontSize = { default: "1rem" };
|
|
@@ -10,10 +13,15 @@ const modalLinkHoverFocus = {
|
|
|
10
13
|
default: `outline: none; text-decoration: underline;`
|
|
11
14
|
};
|
|
12
15
|
|
|
16
|
+
const linkTextDecoration = {
|
|
17
|
+
default: LINK_TEXT_DECORATION
|
|
18
|
+
};
|
|
19
|
+
|
|
13
20
|
export const fallbackValues = {
|
|
14
21
|
linkColor,
|
|
15
22
|
fontSize,
|
|
16
23
|
lineHeight,
|
|
17
24
|
fontWeight,
|
|
18
|
-
modalLinkHoverFocus
|
|
25
|
+
modalLinkHoverFocus,
|
|
26
|
+
linkTextDecoration
|
|
19
27
|
};
|
|
@@ -40,3 +40,4 @@ export { default as Timeout } from "./timeout";
|
|
|
40
40
|
export { default as ToastNotification } from "./toast-notification";
|
|
41
41
|
export { default as WelcomeModule } from "./welcome-module";
|
|
42
42
|
export { default as WorkflowTile } from "./workflow-tile";
|
|
43
|
+
export { default as PopupMenu } from "./popup-menu";
|
|
@@ -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",
|
|
@@ -4,6 +4,7 @@ import Paragraph from "../../atoms/paragraph";
|
|
|
4
4
|
import Stack from "../../atoms/layouts/Stack";
|
|
5
5
|
import { Box } from "../../atoms/layouts";
|
|
6
6
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
7
|
+
import { TRANSPARENT, GHOST_GREY } from "../../../constants/colors";
|
|
7
8
|
|
|
8
9
|
export const Container = styled(Box)`
|
|
9
10
|
display: flex;
|
|
@@ -22,13 +23,19 @@ export const Container = styled(Box)`
|
|
|
22
23
|
|
|
23
24
|
&:hover,
|
|
24
25
|
&:active {
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
box-shadow:
|
|
26
|
+
cursor: ${({ disabled }) => (disabled ? `default` : `pointer`)};
|
|
27
|
+
box-shadow: ${({ disabled }) => `
|
|
28
|
+
${
|
|
29
|
+
disabled
|
|
30
|
+
? `none`
|
|
31
|
+
: `0px 0px 0px 0px rgba(41, 42, 51, 0.1),
|
|
27
32
|
0px 5px 11px 0px rgba(41, 42, 51, 0.1),
|
|
28
33
|
0px 4px 19px 0px rgba(41, 42, 51, 0.09),
|
|
29
34
|
0px 27px 26px 0px rgba(41, 42, 51, 0.05),
|
|
30
35
|
0px 56px 31px 0px rgba(41, 42, 51, 0.01),
|
|
31
|
-
0px 80px 33px 0px rgba(41, 42, 51, 0)
|
|
36
|
+
0px 80px 33px 0px rgba(41, 42, 51, 0);`
|
|
37
|
+
}
|
|
38
|
+
`};
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
&:hover:not(:active) {
|
|
@@ -38,7 +45,7 @@ export const Container = styled(Box)`
|
|
|
38
45
|
&:active {
|
|
39
46
|
${({ theme }) => `
|
|
40
47
|
background-color: ${theme.activeBackgroundColor};
|
|
41
|
-
border: 1px solid ${theme.
|
|
48
|
+
border: 1px solid ${theme.borderColor};
|
|
42
49
|
;`}
|
|
43
50
|
}
|
|
44
51
|
`;
|
|
@@ -2,13 +2,28 @@ import {
|
|
|
2
2
|
CORNFLOWER_BLUE,
|
|
3
3
|
LINK_WATER,
|
|
4
4
|
MOON_RAKER,
|
|
5
|
-
ROYAL_BLUE_VIVID
|
|
5
|
+
ROYAL_BLUE_VIVID,
|
|
6
|
+
MANATEE_GREY,
|
|
7
|
+
GHOST_GREY,
|
|
8
|
+
TRANSPARENT
|
|
6
9
|
} from "../../../constants/colors";
|
|
7
10
|
|
|
8
|
-
const activeBackgroundColor =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const activeBackgroundColor = {
|
|
12
|
+
primary: `${CORNFLOWER_BLUE}`,
|
|
13
|
+
disabled: `${TRANSPARENT}`
|
|
14
|
+
};
|
|
15
|
+
const backgroundColor = {
|
|
16
|
+
primary: `${LINK_WATER}`,
|
|
17
|
+
disabled: `${TRANSPARENT}`
|
|
18
|
+
};
|
|
19
|
+
const borderColor = {
|
|
20
|
+
primary: `${MOON_RAKER}`,
|
|
21
|
+
disabled: `${GHOST_GREY}`
|
|
22
|
+
};
|
|
23
|
+
const color = {
|
|
24
|
+
primary: `${ROYAL_BLUE_VIVID}`,
|
|
25
|
+
disabled: `${MANATEE_GREY}`
|
|
26
|
+
};
|
|
12
27
|
|
|
13
28
|
export const fallbackValues = {
|
|
14
29
|
activeBackgroundColor,
|
|
@@ -115,6 +115,7 @@ const Obligation = ({
|
|
|
115
115
|
description={description}
|
|
116
116
|
subDescription={subDescription}
|
|
117
117
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
118
|
+
isInCustomerManagement={isInCustomerManagement}
|
|
118
119
|
/>
|
|
119
120
|
)}
|
|
120
121
|
</Cluster>
|
|
@@ -221,6 +222,7 @@ const Obligation = ({
|
|
|
221
222
|
description={description}
|
|
222
223
|
subDescription={subDescription}
|
|
223
224
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
225
|
+
isInCustomerManagement={isInCustomerManagement}
|
|
224
226
|
/>
|
|
225
227
|
)}
|
|
226
228
|
</Cluster>
|
|
@@ -243,6 +245,7 @@ const Obligation = ({
|
|
|
243
245
|
description={description}
|
|
244
246
|
subDescription={subDescription}
|
|
245
247
|
allowedPaymentInstruments={allowedPaymentInstruments}
|
|
248
|
+
isInCustomerManagement={isInCustomerManagement}
|
|
246
249
|
/>
|
|
247
250
|
)}
|
|
248
251
|
</Stack>
|