@thecb/components 10.2.4-beta.4 → 10.2.4-beta.6
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 +33 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +33 -22
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/badge/Badge.stories.js +2 -1
- package/src/components/atoms/badge/Badge.theme.js +8 -4
- package/src/components/molecules/link-card/LinkCard.js +10 -25
- package/src/components/molecules/link-card/LinkCard.stories.js +62 -36
- package/src/components/molecules/link-card/LinkCard.theme.js +23 -9
package/package.json
CHANGED
|
@@ -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
|
};
|
|
@@ -5,9 +5,9 @@ import { fallbackValues } from "./LinkCard.theme";
|
|
|
5
5
|
import { ThemeContext } from "styled-components";
|
|
6
6
|
import * as Styled from "./LinkCard.styled";
|
|
7
7
|
import { noop } from "../../../util/general";
|
|
8
|
-
import { ATHENS_GREY } from "../../../constants/colors";
|
|
9
8
|
|
|
10
9
|
const LinkCard = ({
|
|
10
|
+
variant = "primary", // "primary" | "disabled"
|
|
11
11
|
title = "Test Workflow",
|
|
12
12
|
subtitle = "Link your benefit plan",
|
|
13
13
|
showLeft,
|
|
@@ -19,8 +19,7 @@ const LinkCard = ({
|
|
|
19
19
|
extraHoverStyles = "",
|
|
20
20
|
extraActiveStyles = "",
|
|
21
21
|
themeValues,
|
|
22
|
-
titleVariant = "h3"
|
|
23
|
-
disabled = false
|
|
22
|
+
titleVariant = "h3"
|
|
24
23
|
}) => {
|
|
25
24
|
const { isMobile } = useContext(ThemeContext);
|
|
26
25
|
const regex = /\W/g;
|
|
@@ -36,16 +35,11 @@ const LinkCard = ({
|
|
|
36
35
|
minHeight="141px"
|
|
37
36
|
padding="24px"
|
|
38
37
|
theme={themeValues}
|
|
39
|
-
extraStyles={
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
hoverStyles={disabled ? "" : extraHoverStyles}
|
|
46
|
-
activeStyles={disabled ? "" : extraActiveStyles}
|
|
47
|
-
onClick={disabled ? noop : onClick}
|
|
48
|
-
aria-disabled={disabled}
|
|
38
|
+
extraStyles={extraStyles}
|
|
39
|
+
hoverStyles={extraHoverStyles}
|
|
40
|
+
activeStyles={extraActiveStyles}
|
|
41
|
+
onClick={variant === "disabled" ? noop : onClick}
|
|
42
|
+
aria-disabled={variant === "disabled"}
|
|
49
43
|
>
|
|
50
44
|
<Stack
|
|
51
45
|
childGap={0}
|
|
@@ -54,20 +48,12 @@ const LinkCard = ({
|
|
|
54
48
|
style={{ width: "100%" }}
|
|
55
49
|
fullHeight
|
|
56
50
|
>
|
|
57
|
-
<Box
|
|
58
|
-
padding={0}
|
|
59
|
-
width="100%"
|
|
60
|
-
extraStyles={disabled ? "opacity: 0.5;" : ""}
|
|
61
|
-
>
|
|
51
|
+
<Box padding={0} width="100%">
|
|
62
52
|
<Styled.Title variant={titleVariant} theme={themeValues} margin={0}>
|
|
63
53
|
{title}
|
|
64
54
|
</Styled.Title>
|
|
65
55
|
</Box>
|
|
66
|
-
<Box
|
|
67
|
-
padding={"0 0 40px"}
|
|
68
|
-
width="100%"
|
|
69
|
-
extraStyles={disabled ? "opacity: 0.5;" : ""}
|
|
70
|
-
>
|
|
56
|
+
<Box padding={"0 0 40px"} width="100%">
|
|
71
57
|
<Styled.Subtitle variant="pS" theme={themeValues}>
|
|
72
58
|
{subtitle}
|
|
73
59
|
</Styled.Subtitle>
|
|
@@ -77,7 +63,6 @@ const LinkCard = ({
|
|
|
77
63
|
borderWidthOverride="0 0 0 0"
|
|
78
64
|
padding="0"
|
|
79
65
|
width="100%"
|
|
80
|
-
extraStyles={disabled ? "opacity: 0.5;" : ""}
|
|
81
66
|
>
|
|
82
67
|
<Styled.Footer direction="row" childGap="6px" justify="space-between">
|
|
83
68
|
{/* To keep rightContent aligned right, use an empty Box as leftContent if none is provided */}
|
|
@@ -91,4 +76,4 @@ const LinkCard = ({
|
|
|
91
76
|
);
|
|
92
77
|
};
|
|
93
78
|
|
|
94
|
-
export default themeComponent(LinkCard, "LinkCard", fallbackValues);
|
|
79
|
+
export default themeComponent(LinkCard, "LinkCard", fallbackValues, "primary");
|
|
@@ -1,51 +1,77 @@
|
|
|
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 { boolean, 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
|
-
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
ATHENS_GREY,
|
|
14
|
+
CORNFLOWER_BLUE,
|
|
15
|
+
ROYAL_BLUE_VIVID,
|
|
16
|
+
GHOST_GREY
|
|
17
|
+
} from "../../../constants/colors";
|
|
18
|
+
|
|
12
19
|
const groupId = "props";
|
|
20
|
+
const variant = "primary";
|
|
21
|
+
const variants = { primary: "primary", disabled: "disabled" };
|
|
22
|
+
const disabled = false;
|
|
23
|
+
const showLeft = true;
|
|
13
24
|
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
const LeftContent = ({ parentVariant }) => {
|
|
26
|
+
return (
|
|
27
|
+
<Box background="transparent" borderWidthOverride="0 0 0 0" padding="0">
|
|
28
|
+
<Badge
|
|
29
|
+
label="Autopay Available"
|
|
30
|
+
Icon={AutopayIcon}
|
|
31
|
+
variant={parentVariant === "disabled" ? "disabled" : "success"}
|
|
32
|
+
/>
|
|
33
|
+
</Box>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
export const linkCard = () => {
|
|
37
|
+
const leftContent = <LeftContent parentVariant={variant} />;
|
|
38
|
+
return (
|
|
39
|
+
<LinkCard
|
|
40
|
+
variant={select("variant", variants, variant, groupId)}
|
|
41
|
+
title={text("title", "Link Card Title", groupId)}
|
|
42
|
+
subtitle={text("subtitle", "Link card description", groupId)}
|
|
43
|
+
path={text("path", "/service/animal-care-and-control", groupId)}
|
|
44
|
+
showLeft={boolean("showLeft", showLeft, groupId)}
|
|
45
|
+
onClick={() => window.alert("Click event!")}
|
|
46
|
+
leftContent={leftContent}
|
|
47
|
+
showRight={boolean("showRight", true, groupId)}
|
|
48
|
+
rightContent={
|
|
49
|
+
<Stack direction="row" childGap="6px">
|
|
50
|
+
<Text
|
|
51
|
+
variant="pS"
|
|
52
|
+
className="show-on-hover"
|
|
53
|
+
extraStyles={`text-align: right; color: transparent; ${
|
|
54
|
+
!showLeft || (showLeft && !leftContent)
|
|
55
|
+
? "margin-left: auto;"
|
|
56
|
+
: ""
|
|
57
|
+
}`}
|
|
58
|
+
>
|
|
59
|
+
Find
|
|
60
|
+
</Text>
|
|
61
|
+
<PlusCircleIcon
|
|
62
|
+
color={variant === "disabled" ? GHOST_GREY : ROYAL_BLUE_VIVID}
|
|
63
|
+
/>
|
|
64
|
+
</Stack>
|
|
65
|
+
}
|
|
66
|
+
extraHoverStyles={`
|
|
67
|
+
.show-on-hover {color: ${disabled ? ATHENS_GREY : ROYAL_BLUE_VIVID};}
|
|
43
68
|
`}
|
|
44
|
-
|
|
45
|
-
background-color: ${CORNFLOWER_BLUE};
|
|
69
|
+
extraActiveStyles={`
|
|
70
|
+
background-color: ${disabled ? ATHENS_GREY : CORNFLOWER_BLUE};
|
|
46
71
|
`}
|
|
47
|
-
|
|
48
|
-
);
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
49
75
|
|
|
50
76
|
const story = page({
|
|
51
77
|
title: "Components|Molecules/LinkCard",
|
|
@@ -2,17 +2,31 @@ import {
|
|
|
2
2
|
CORNFLOWER_BLUE,
|
|
3
3
|
LINK_WATER,
|
|
4
4
|
MOON_RAKER,
|
|
5
|
-
ROYAL_BLUE_VIVID
|
|
5
|
+
ROYAL_BLUE_VIVID,
|
|
6
|
+
GRECIAN_GREY,
|
|
7
|
+
MANATEE_GREY
|
|
6
8
|
} from "../../../constants/colors";
|
|
7
9
|
|
|
8
|
-
const activeBackgroundColor =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const activeBackgroundColor = {
|
|
11
|
+
primary: `${CORNFLOWER_BLUE}`,
|
|
12
|
+
disabled: `transparent`
|
|
13
|
+
};
|
|
14
|
+
const backgroundColor = {
|
|
15
|
+
primary: `${LINK_WATER}`,
|
|
16
|
+
disabled: `transparent`
|
|
17
|
+
};
|
|
18
|
+
const borderColor = {
|
|
19
|
+
primary: `${MOON_RAKER}`,
|
|
20
|
+
disabled: `${GRECIAN_GREY}`
|
|
21
|
+
};
|
|
22
|
+
const color = {
|
|
23
|
+
primary: `${ROYAL_BLUE_VIVID}`,
|
|
24
|
+
disabled: `${MANATEE_GREY}`
|
|
25
|
+
};
|
|
12
26
|
|
|
13
27
|
export const fallbackValues = {
|
|
14
|
-
activeBackgroundColor,
|
|
15
|
-
backgroundColor,
|
|
16
|
-
borderColor,
|
|
17
|
-
color
|
|
28
|
+
activeBackgroundColor: activeBackgroundColor,
|
|
29
|
+
backgroundColor: backgroundColor,
|
|
30
|
+
borderColor: borderColor,
|
|
31
|
+
color: color
|
|
18
32
|
};
|