@thecb/components 10.11.2 → 10.12.0
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 +36 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.esm.js +36 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/card/Card.js +9 -0
- package/src/components/atoms/card/CardText.js +34 -11
- package/src/components/atoms/card/index.d.ts +7 -1
package/package.json
CHANGED
|
Binary file
|
|
@@ -14,6 +14,7 @@ import Stack from "../layouts/Stack";
|
|
|
14
14
|
import CardImage from "./CardImage.styled";
|
|
15
15
|
import CardText from "./CardText";
|
|
16
16
|
import CardHeader from "./CardHeader";
|
|
17
|
+
import { noop } from "../../../util/general";
|
|
17
18
|
|
|
18
19
|
const Card = ({
|
|
19
20
|
borderRadius = "4px",
|
|
@@ -26,8 +27,12 @@ const Card = ({
|
|
|
26
27
|
imgHeight = "150px",
|
|
27
28
|
imgObjectFit = "none",
|
|
28
29
|
imgAltText,
|
|
30
|
+
onQuitClick = noop,
|
|
29
31
|
padding = "24px",
|
|
32
|
+
showQuitLink = false,
|
|
30
33
|
text,
|
|
34
|
+
textAs = "p",
|
|
35
|
+
titleAs = "h2",
|
|
31
36
|
titleText,
|
|
32
37
|
titleVariant = "small",
|
|
33
38
|
themeValues,
|
|
@@ -90,9 +95,13 @@ const Card = ({
|
|
|
90
95
|
<Box padding="0" width="100%" extraStyles="flex-basis: 100%;">
|
|
91
96
|
{text && (
|
|
92
97
|
<CardText
|
|
98
|
+
onQuitClick={onQuitClick}
|
|
93
99
|
padding={padding}
|
|
100
|
+
showQuitLink={showQuitLink}
|
|
101
|
+
titleAs={titleAs}
|
|
94
102
|
titleText={titleText}
|
|
95
103
|
text={text}
|
|
104
|
+
textAs={textAs}
|
|
96
105
|
titleVariant={titleVariant}
|
|
97
106
|
/>
|
|
98
107
|
)}
|
|
@@ -10,10 +10,16 @@ import Cover from "../layouts/Cover";
|
|
|
10
10
|
import Paragraph from "../paragraph";
|
|
11
11
|
import Stack from "../layouts/Stack";
|
|
12
12
|
import Title from "../title";
|
|
13
|
+
import IconQuitLarge from "../../atoms/icons/IconQuitLarge";
|
|
14
|
+
import { Cluster } from "../layouts";
|
|
13
15
|
|
|
14
16
|
export const CardText = ({
|
|
17
|
+
showQuitLink,
|
|
18
|
+
onQuitClick,
|
|
19
|
+
titleAs,
|
|
15
20
|
padding,
|
|
16
21
|
text,
|
|
22
|
+
textAs = "p",
|
|
17
23
|
titleText,
|
|
18
24
|
titleVariant = "small",
|
|
19
25
|
themeValues
|
|
@@ -22,17 +28,34 @@ export const CardText = ({
|
|
|
22
28
|
<Box padding={padding}>
|
|
23
29
|
<Cover>
|
|
24
30
|
<Stack>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
<Cluster justify="space-between" align="center" overflow={true}>
|
|
32
|
+
{titleText && (
|
|
33
|
+
<Title
|
|
34
|
+
as={titleAs}
|
|
35
|
+
variant={titleVariant}
|
|
36
|
+
color={themeValues.titleColor}
|
|
37
|
+
weight={themeValues.titleWeight}
|
|
38
|
+
>
|
|
39
|
+
{titleText}
|
|
40
|
+
</Title>
|
|
41
|
+
)}
|
|
42
|
+
{showQuitLink && (
|
|
43
|
+
<Box
|
|
44
|
+
padding="0"
|
|
45
|
+
onClick={onQuitClick}
|
|
46
|
+
onKeyDown={e => e.key === "Enter" && onQuitClick()}
|
|
47
|
+
role="button"
|
|
48
|
+
tabIndex={0}
|
|
49
|
+
aria-label={`Close Card: ${titleText}`}
|
|
50
|
+
extraStyles="cursor: pointer;"
|
|
51
|
+
>
|
|
52
|
+
<IconQuitLarge />
|
|
53
|
+
</Box>
|
|
54
|
+
)}
|
|
55
|
+
</Cluster>
|
|
56
|
+
<Paragraph as={textAs} color={themeValues.textColor}>
|
|
57
|
+
{text}
|
|
58
|
+
</Paragraph>
|
|
36
59
|
</Stack>
|
|
37
60
|
</Cover>
|
|
38
61
|
</Box>
|
|
@@ -2,8 +2,10 @@ import React from "react";
|
|
|
2
2
|
import Expand from "../../../util/expand";
|
|
3
3
|
|
|
4
4
|
export interface CardProps {
|
|
5
|
-
text?: string;
|
|
5
|
+
text?: string | React.ReactNode;
|
|
6
|
+
textAs?: string;
|
|
6
7
|
titleText?: string;
|
|
8
|
+
titleAs?: string;
|
|
7
9
|
titleVariant?: string;
|
|
8
10
|
extraStyles?: string;
|
|
9
11
|
imgSrc?: string;
|
|
@@ -27,6 +29,10 @@ export interface CardProps {
|
|
|
27
29
|
borderRadius?: string;
|
|
28
30
|
width?: string;
|
|
29
31
|
padding?: string;
|
|
32
|
+
showQuitLink?: boolean;
|
|
33
|
+
onQuitClick?: (
|
|
34
|
+
event: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>
|
|
35
|
+
) => void;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
export const Card: React.FC<Expand<CardProps> &
|