@thecb/components 8.4.0-beta.17 → 8.4.0-beta.18

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.17",
3
+ "version": "8.4.0-beta.18",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,12 +1,10 @@
1
1
  import React, { useContext } from "react";
2
- import Heading from "../../atoms/heading";
3
- import Paragraph from "../../atoms/paragraph";
4
2
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
5
3
  import { Box, Stack } from "../../atoms/layouts";
6
4
  import { themeComponent } from "../../../util/themeUtils";
7
5
  import { fallbackValues } from "./LinkCard.theme";
8
- import { MOON_RAKER } from "../../../constants/colors";
9
6
  import { ThemeContext } from "styled-components";
7
+ import * as Styled from "./LinkCard.styled";
10
8
 
11
9
  const LinkCard = ({
12
10
  title = "Test Workflow",
@@ -22,13 +20,10 @@ const LinkCard = ({
22
20
  extraActiveStyles = ""
23
21
  }) => {
24
22
  const { isMobile } = useContext(ThemeContext);
25
- const activeAndHoverStyles = `cursor: pointer;
26
- border-radius: 8px;
27
- border: 1px solid ${themeValues.color};
28
- 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);`;
23
+
29
24
  return (
30
- <Box
31
- border={`1px solid ${MOON_RAKER};`}
25
+ <Styled.Container
26
+ border={`1px solid ${themeValues.background};`}
32
27
  borderRadius="8px"
33
28
  dataQa={`link-card-${title}`}
34
29
  width="100%"
@@ -36,23 +31,9 @@ const LinkCard = ({
36
31
  minWidth={isMobile ? "240px" : "288px"}
37
32
  minHeight="141px"
38
33
  padding="24px"
39
- extraStyles={`
40
- display: flex;
41
- flex-direction: column;
42
- align-items: flex-start;
43
- width: 100%;
44
- gap: 40px;
45
- flex-shrink: 0;
46
- align-self: stretch;
47
- ${extraStyles}
48
- `}
49
- hoverStyles={`${activeAndHoverStyles}
50
- border: 0;
51
- ${extraHoverStyles}
52
- `}
53
- activeStyles={`${activeAndHoverStyles}
54
- ${extraActiveStyles}
55
- `}
34
+ extraStyles={extraStyles}
35
+ hoverStyles={extraHoverStyles}
36
+ activeStyles={extraActiveStyles}
56
37
  onClick={onClick}
57
38
  >
58
39
  <Stack
@@ -63,42 +44,19 @@ const LinkCard = ({
63
44
  fullHeight
64
45
  >
65
46
  <Box padding={0} width="100%">
66
- <Heading
47
+ <Styled.Title
67
48
  variant="h6"
68
49
  weight={FONT_WEIGHT_SEMIBOLD}
69
50
  color={themeValues.color}
70
51
  margin={0}
71
- extraStyles={`
72
- display: -webkit-box;
73
- -webkit-box-orient: vertical;
74
- -webkit-line-clamp: 2;
75
- align-self: stretch;
76
- overflow: hidden;
77
- text-overflow: ellipsis;
78
- font-size: 16px;
79
- line-height: 150%;
80
- background-color: transparent;
81
- `}
82
52
  >
83
53
  {title}
84
- </Heading>
54
+ </Styled.Title>
85
55
  </Box>
86
56
  <Box padding={"0 0 40px"} width="100%">
87
- <Paragraph
88
- variant="pS"
89
- color={themeValues.color}
90
- extraStyles="overflow: hidden;
91
- text-overflow: ellipsis;
92
- display: -webkit-box;
93
- -webkit-box-orient: vertical;
94
- -webkit-line-clamp: 2;
95
- align-self: stretch;
96
- font-size: 14px;
97
- line-height: 150%;
98
- letter-spacing: 0.14px;"
99
- >
57
+ <Styled.Subtitle variant="pS" color={themeValues.color}>
100
58
  {subtitle}
101
- </Paragraph>
59
+ </Styled.Subtitle>
102
60
  </Box>
103
61
  <Box
104
62
  background="transparent"
@@ -106,18 +64,15 @@ const LinkCard = ({
106
64
  padding="0"
107
65
  width="100%"
108
66
  >
109
- <Stack
110
- direction="row"
111
- childGap="6px"
112
- justify="space-between"
113
- extraStyles={`width: 100%; align-items: flex-end;`}
114
- >
115
- {showLeft && leftContent ? leftContent : <></>}
67
+ <Styled.Footer direction="row" childGap="6px" justify="space-between">
68
+ {/* To keep rightContent aligned right, use an empty Box as leftContent if none is provided */}
69
+ {showLeft && !leftContent && <Box />}
70
+ {showLeft && leftContent}
116
71
  {showRight && rightContent}
117
- </Stack>
72
+ </Styled.Footer>
118
73
  </Box>
119
74
  </Stack>
120
- </Box>
75
+ </Styled.Container>
121
76
  );
122
77
  };
123
78
 
@@ -0,0 +1,65 @@
1
+ import styled from "styled-components";
2
+ import Heading from "../../atoms/heading";
3
+ import Paragraph from "../../atoms/paragraph";
4
+ import Stack from "../../atoms/layouts/Stack";
5
+ import { Box } from "../../atoms/layouts";
6
+ import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
7
+
8
+ export const Container = styled(Box)`
9
+ display: flex;
10
+ flex-direction: column;
11
+ align-items: flex-start;
12
+ width: 100%;
13
+ gap: 40px;
14
+ flex-shrink: 0;
15
+ align-self: stretch;
16
+
17
+ &:hover,
18
+ &:active {
19
+ cursor: pointer;
20
+ border-radius: 8px;
21
+ box-shadow: 0px 0px 0px 0px rgba(41, 42, 51, 0.1),
22
+ 0px 5px 11px 0px rgba(41, 42, 51, 0.1),
23
+ 0px 4px 19px 0px rgba(41, 42, 51, 0.09),
24
+ 0px 27px 26px 0px rgba(41, 42, 51, 0.05),
25
+ 0px 56px 31px 0px rgba(41, 42, 51, 0.01),
26
+ 0px 80px 33px 0px rgba(41, 42, 51, 0);
27
+ }
28
+
29
+ &:hover:not(:active) {
30
+ border: 0;
31
+ }
32
+
33
+ &:active {
34
+ border: 1px solid ${ROYAL_BLUE_VIVID};
35
+ }
36
+ `;
37
+
38
+ export const Title = styled(Heading)`
39
+ display: -webkit-box;
40
+ -webkit-box-orient: vertical;
41
+ -webkit-line-clamp: 2;
42
+ align-self: stretch;
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ font-size: 16px;
46
+ line-height: 150%;
47
+ background-color: transparent;
48
+ `;
49
+
50
+ export const Subtitle = styled(Paragraph)`
51
+ overflow: hidden;
52
+ text-overflow: ellipsis;
53
+ display: -webkit-box;
54
+ -webkit-box-orient: vertical;
55
+ -webkit-line-clamp: 2;
56
+ align-self: stretch;
57
+ font-size: 14px;
58
+ line-height: 150 %;
59
+ letter-spacing: 0.14px;
60
+ `;
61
+
62
+ export const Footer = styled(Stack)`
63
+ align-items: center;
64
+ width: 100%;
65
+ `;
@@ -1,11 +1,7 @@
1
- import {
2
- CORNFLOWER_BLUE,
3
- ROYAL_BLUE_VIVID,
4
- WHITE
5
- } from "../../../constants/colors";
1
+ import { ROYAL_BLUE_VIVID, MOON_RAKER } from "../../../constants/colors";
6
2
 
7
- const background = { default: `${WHITE}`, hover: `${CORNFLOWER_BLUE}` };
8
- const color = { default: `${ROYAL_BLUE_VIVID}` };
3
+ const background = { default: MOON_RAKER };
4
+ const color = { default: ROYAL_BLUE_VIVID };
9
5
 
10
6
  export const fallbackValues = {
11
7
  background,