@thecb/components 8.4.0-beta.1 → 8.4.0-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "8.4.0-beta.1",
3
+ "version": "8.4.0-beta.3",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -2,58 +2,59 @@ import React from "react";
2
2
  import { useNavigate } from "react-router-dom";
3
3
  import Heading from "../../atoms/heading";
4
4
  import Paragraph from "../../atoms/paragraph";
5
- import Text from "../../atoms/text/Text";
6
- import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
5
+ // import { Text } from "../../atoms/text";
6
+ // import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
7
7
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
8
8
  import { Box, Stack } from "../../atoms/layouts";
9
- import Badge from "../../atoms/badge/Badge";
10
- import { PlusCircleIcon, AutopayIcon, ArrowRightIcon } from "../../atoms/icons";
11
9
  import { themeComponent } from "../../../util/themeUtils";
12
10
  import { fallbackValues } from "./LinkCard.theme";
11
+ // import PlusCircleIcon from "../../atoms/icons/PlusCircleIcon";
12
+ // import ArrowRightIcon from "../../atoms/icons/ArrowRightIcon";
13
13
 
14
14
  const LinkCard = ({
15
15
  variant = "default",
16
- workflowName = "Test Workflow",
17
- workflowDescription = "Link your benefit plan",
18
- workflowActionName = "Link an account",
16
+ title = "Test Workflow",
17
+ subtitle = "Link your benefit plan",
19
18
  themeValues,
20
- slug
19
+ path,
20
+ showLeft,
21
+ leftContent,
22
+ showRight,
23
+ rightContent,
24
+ onClick = () => navigate(path)
21
25
  }) => {
22
26
  const navigate = useNavigate();
27
+ const activeHoverStyles = `
28
+ border-radius: 8px;
29
+ cursor: pointer;
30
+ border: 1px solid ${themeValues.color};
31
+ background: var(--primary-color-primary-10, #EBEFFB);
32
+ /* Primitives/New Shadow/3-Pressed-New */
33
+ box-shadow: 0px 0px 0px 0px rgba(41, 42, 51, 0.10), 0px 5px 11px 0px rgba(41, 42, 51, 0.10), 0px 4px 19px 0px rgba(41, 42, 51, 0.09), 0px 27px 26px 0px rgba(41, 42, 51, 0.05), 0px 56px 31px 0px rgba(41, 42, 51, 0.01), 0px 80px 33px 0px rgba(41, 42, 51, 0.00);
34
+ .show-on-hover {color: ${themeValues.color};}
35
+ `;
23
36
 
24
37
  return (
25
38
  <Box
26
39
  background="#FEFEFE" // --grays-cool-gray-00
27
40
  border="1px solid #C4CEF4;" // --primary-color-primary-30
28
- padding={0}
29
41
  borderRadius="8px"
30
- dataQa={`link-card-${workflowDescription}`}
31
- hoverStyles={`
32
- border-radius: 8px;
33
- cursor: pointer;
34
- border: 1px solid ${ROYAL_BLUE_VIVID};
35
- background: var(--primary-color-primary-10, #EBEFFB);
36
- /* Primitives/New Shadow/3-Pressed-New */
37
- box-shadow: 0px 0px 0px 0px rgba(41, 42, 51, 0.10), 0px 5px 11px 0px rgba(41, 42, 51, 0.10), 0px 4px 19px 0px rgba(41, 42, 51, 0.09), 0px 27px 26px 0px rgba(41, 42, 51, 0.05), 0px 56px 31px 0px rgba(41, 42, 51, 0.01), 0px 80px 33px 0px rgba(41, 42, 51, 0.00);
38
- .show-on-hover {color: ${ROYAL_BLUE_VIVID};}
39
- `}
40
- extraStyles="display: flex;
41
- width: 288px;
42
- min-width: 240px;
43
- max-width: 288px;
44
- min-height: 141px;
45
- padding: 16px 24px;
46
- flex-direction: column;
47
- align-items: flex-start;
48
- gap: 40px;
49
- flex-shrink: 0;
42
+ dataQa={`link-card-${title}`}
43
+ width="100%"
44
+ maxWidth="288px"
45
+ minWidth="240px"
46
+ minHeight="141px"
47
+ padding="16px 24px"
48
+ extraStyles="
49
+ display: flex;
50
+ flex-direction: column;
51
+ align-items: flex-start;
52
+ gap: 40px;
53
+ flex-shrink: 0;
50
54
  align-self: stretch;"
51
- onClick={() => {
52
- // @TODO replace with something valid like navigate
53
- console.log("attempting navigation...");
54
- // window.location.pathname = `/service/${slug}`;
55
- navigate(`/service/${slug}`);
56
- }}
55
+ hoverStyles={activeHoverStyles}
56
+ activeStyles={activeHoverStyles}
57
+ onClick={onClick}
57
58
  >
58
59
  <Stack childGap={0} bottomItem={3} fullHeight>
59
60
  <Box padding={"1rem 1rem 0 1rem"}>
@@ -64,10 +65,10 @@ const LinkCard = ({
64
65
  margin={0}
65
66
  extraStyles="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; align-self: stretch; overflow: hidden; text-overflow: ellipsis; font-family: Public Sans; font-size: 16px; font-style: normal; font-weight: 600; line-height: 150%;"
66
67
  >
67
- {workflowName}
68
+ {title}
68
69
  </Heading>
69
70
  </Box>
70
- <Box padding={"0 1rem 0"} minHeight={"4.25rem"}>
71
+ <Box padding={"0 1rem 40px"} /* minHeight={"4.25rem"}*/>
71
72
  <Paragraph
72
73
  variant="pS"
73
74
  color={themeValues.color}
@@ -86,7 +87,7 @@ const LinkCard = ({
86
87
  line-height: 150%; /* 21px */
87
88
  letter-spacing: 0.14px;"
88
89
  >
89
- {workflowDescription}
90
+ {subtitle}
90
91
  </Paragraph>
91
92
  </Box>
92
93
  <Box
@@ -95,41 +96,27 @@ const LinkCard = ({
95
96
  padding="0 1rem 1rem 1rem"
96
97
  >
97
98
  <Stack direction="row" justify="space-between">
98
- <Box
99
- background="transparent"
100
- borderWidthOverride="0 0 0 0"
101
- padding="0"
102
- >
103
- <Badge label="Autopay Available" Icon={AutopayIcon} />
104
- </Box>
105
99
  <Stack direction="row" childGap="6px">
106
- {workflowActionName === "Link an account" && (
107
- <>
108
- <Text
109
- variant="pS"
110
- color={themeValues.color}
111
- extraStyles="text-align: right; color: transparent;"
112
- className="show-on-hover"
113
- >
114
- Find
115
- </Text>
116
- <PlusCircleIcon color={themeValues.color} />
117
- </>
100
+ {showLeft && leftContent}
101
+ {showRight && rightContent}
102
+ </Stack>
103
+
104
+ {/* <Stack direction="row" childGap="6px">
105
+ <Text
106
+ variant="pS"
107
+ color={themeValues.color}
108
+ extraStyles="text-align: right; color: transparent;"
109
+ className="show-on-hover"
110
+ >
111
+ {workflowActionName}
112
+ </Text>
113
+ {workflowActionName === "Find" && (
114
+ <PlusCircleIcon color={themeValues.color} />
118
115
  )}
119
- {workflowActionName === "Pay now" && (
120
- <>
121
- <Text
122
- variant="pS"
123
- color={themeValues.color}
124
- extraStyles="text-align: right; color: transparent;"
125
- className="show-on-hover"
126
- >
127
- Pay
128
- </Text>
129
- <ArrowRightIcon color={themeValues.color} />
130
- </>
116
+ {workflowActionName === "Pay" && (
117
+ <ArrowRightIcon color={themeValues.color} />
131
118
  )}
132
- </Stack>
119
+ </Stack> */}
133
120
  </Stack>
134
121
  </Box>
135
122
  </Stack>
@@ -1,20 +1,42 @@
1
1
  import React from "react";
2
2
  import LinkCard from "./LinkCard";
3
+ import Box from "../../atoms/layouts/Box";
4
+ import Stack from "../../atoms/layouts/Stack";
5
+ import Text from "../../atoms/text/Text";
3
6
  import page from "../../../../.storybook/page";
4
7
  import { text } from "@storybook/addon-knobs";
8
+ import Badge from "../../atoms/badge/Badge";
9
+ import PlusCircleIcon from "../../atoms/icons/PlusCircleIcon";
10
+ import AutopayIcon from "../../atoms/icons/AutopayIcon";
11
+ import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
5
12
 
6
13
  const groupId = "props";
7
14
 
8
15
  export const linkCard = () => (
9
16
  <LinkCard
10
- workflowName={text("workflowName", "Workflow Name", "props")}
11
- workflowDescription={text(
12
- "workflowDescription",
13
- "Workflow description",
14
- groupId
15
- )}
16
- workflowActionName={text("workflowActionName", "Link an account", "props")}
17
- slug={text("slug", "animal-care-and-control", "props")}
17
+ title={text("title", "Link Card Title", "props")}
18
+ subtitle={text("subtitle", "Link card description", groupId)}
19
+ path={text("path", "/service/animal-care-and-control", "props")}
20
+ showLeft={true}
21
+ leftContent={
22
+ <Box background="transparent" borderWidthOverride="0 0 0 0" padding="0">
23
+ <Badge label="Autopay Available" Icon={AutopayIcon} />
24
+ </Box>
25
+ }
26
+ showRight={true}
27
+ rightContent={
28
+ <Stack direction="row" childGap="6px">
29
+ <Text
30
+ variant="pS"
31
+ color={ROYAL_BLUE_VIVID}
32
+ extraStyles="text-align: right; color: transparent;"
33
+ className="show-on-hover"
34
+ >
35
+ Find
36
+ </Text>
37
+ <PlusCircleIcon color={ROYAL_BLUE_VIVID} />
38
+ </Stack>
39
+ }
18
40
  />
19
41
  );
20
42
 
@@ -3,11 +3,15 @@ import Expand from "../../../util/expand";
3
3
 
4
4
  export interface LinkCardProps {
5
5
  variant?: string; // "default" is only one
6
- workflowName?: string; // title
7
- workflowDescription?: string; // beneath title
8
- workflowActionName: "Find" | "Pay";
6
+ title?: string; // title
7
+ subtitle?: string; // beneath title
9
8
  slug: string; // path segment of button on click (/service/${slug})
10
9
  themeValues?: any;
10
+ showLeft?: boolean;
11
+ leftContent?: JSX.Element;
12
+ showRight?: boolean;
13
+ rightContent?: JSX.Element;
14
+ onClick: () => void;
11
15
  }
12
16
 
13
17
  export const LinkCard: React.FC<Expand<LinkCardProps> &