@thecb/components 7.13.3 → 7.13.4-beta.1
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 +80 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +80 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/cardAlt/CardAlt.js +113 -0
- package/src/components/atoms/cardAlt/index.js +3 -0
- package/src/components/atoms/index.js +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
|
|
3
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
+
import withWindowSize from "../../withWindowSize";
|
|
5
|
+
|
|
6
|
+
import { fallbackValues } from "../card/Card.theme";
|
|
7
|
+
|
|
8
|
+
import Box from "../layouts/Box";
|
|
9
|
+
import BoxWithShadow from "../box-with-shadow";
|
|
10
|
+
import Center from "../layouts/Center";
|
|
11
|
+
import Cover from "../layouts/Cover";
|
|
12
|
+
import Stack from "../layouts/Stack";
|
|
13
|
+
|
|
14
|
+
import CardImage from "../card/CardImage.styled";
|
|
15
|
+
import CardText from "../card/CardText";
|
|
16
|
+
import CardHeader from "../card/CardHeader";
|
|
17
|
+
|
|
18
|
+
const CardAlt = ({
|
|
19
|
+
borderRadius = "4px",
|
|
20
|
+
extraStyles,
|
|
21
|
+
headerAs = "h2",
|
|
22
|
+
headerText,
|
|
23
|
+
headerVariant = "small",
|
|
24
|
+
imgSrc,
|
|
25
|
+
Image,
|
|
26
|
+
imgHeight = "150px",
|
|
27
|
+
imgObjectFit = "none",
|
|
28
|
+
imgAltText,
|
|
29
|
+
padding = "24px",
|
|
30
|
+
text,
|
|
31
|
+
titleText,
|
|
32
|
+
titleVariant = "small",
|
|
33
|
+
themeValues,
|
|
34
|
+
width = "276px",
|
|
35
|
+
children
|
|
36
|
+
}) => {
|
|
37
|
+
const hasImage = Image || imgSrc;
|
|
38
|
+
const numberOfChildren =
|
|
39
|
+
(Array.isArray(children) ? children.length : 1) +
|
|
40
|
+
(text ? 1 : 0) +
|
|
41
|
+
(hasImage ? 1 : 0) +
|
|
42
|
+
(headerText ? 1 : 0);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<BoxWithShadow
|
|
46
|
+
variant="baseStandard"
|
|
47
|
+
background={themeValues.backgroundColor}
|
|
48
|
+
borderRadius={borderRadius}
|
|
49
|
+
padding="0"
|
|
50
|
+
margin="0"
|
|
51
|
+
minWidth={width}
|
|
52
|
+
extraStyles={extraStyles}
|
|
53
|
+
>
|
|
54
|
+
<Cover singleChild fillCenter>
|
|
55
|
+
<Stack
|
|
56
|
+
fullHeight
|
|
57
|
+
childGap="0"
|
|
58
|
+
bottomItem={numberOfChildren}
|
|
59
|
+
direction="row"
|
|
60
|
+
>
|
|
61
|
+
{headerText && (
|
|
62
|
+
<CardHeader
|
|
63
|
+
headerText={headerText}
|
|
64
|
+
headerColor={themeValues.headerColor}
|
|
65
|
+
headerVariant={headerVariant}
|
|
66
|
+
backgroundColor={themeValues.headerBackgroundColor}
|
|
67
|
+
borderRadius={borderRadius}
|
|
68
|
+
padding={padding}
|
|
69
|
+
as={headerAs}
|
|
70
|
+
></CardHeader>
|
|
71
|
+
)}
|
|
72
|
+
{Image && !imgSrc && (
|
|
73
|
+
<Box
|
|
74
|
+
minHeight={imgHeight}
|
|
75
|
+
padding="0"
|
|
76
|
+
background={themeValues.imageBackgroundColor}
|
|
77
|
+
>
|
|
78
|
+
<Cover minHeight={imgHeight} singleChild>
|
|
79
|
+
<Center intrinsic>
|
|
80
|
+
<Image alt={imgAltText} />
|
|
81
|
+
</Center>
|
|
82
|
+
</Cover>
|
|
83
|
+
</Box>
|
|
84
|
+
)}
|
|
85
|
+
{imgSrc && (
|
|
86
|
+
<CardImage
|
|
87
|
+
height={imgHeight}
|
|
88
|
+
objectFit={imgObjectFit}
|
|
89
|
+
backgroundColor={themeValues.imageBackgroundColor}
|
|
90
|
+
src={imgSrc}
|
|
91
|
+
alt={imgAltText}
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
{text && (
|
|
95
|
+
<CardText
|
|
96
|
+
padding={padding}
|
|
97
|
+
titleText={titleText}
|
|
98
|
+
text={text}
|
|
99
|
+
titleVariant={titleVariant}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
102
|
+
{children}
|
|
103
|
+
</Stack>
|
|
104
|
+
</Cover>
|
|
105
|
+
</BoxWithShadow>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export default themeComponent(
|
|
110
|
+
withWindowSize(CardAlt),
|
|
111
|
+
"CardAlt",
|
|
112
|
+
fallbackValues
|
|
113
|
+
);
|
|
@@ -45,6 +45,7 @@ export { default as Title } from "./title";
|
|
|
45
45
|
export { default as ToggleSwitch } from "./toggle-switch";
|
|
46
46
|
export { default as TypeaheadInput } from "./typeahead-input";
|
|
47
47
|
export { default as Card } from "./card";
|
|
48
|
+
export { default as CardAlt } from "./cardAlt";
|
|
48
49
|
export { default as NavTabs } from "./nav-tabs";
|
|
49
50
|
export { default as LoadingLine } from "./loading-line";
|
|
50
51
|
export * from "./table";
|