@thecb/components 6.3.1-beta.5 → 6.3.1-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "6.3.1-beta.5",
3
+ "version": "6.3.1-beta.6",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -31,7 +31,10 @@ const Card = ({
31
31
  padding = "24px"
32
32
  }) => {
33
33
  const numberOfChildren =
34
- children.length + (imgSrc ? 1 : 0) + (text ? 1 : 0) + (headerText ? 1 : 0);
34
+ (typeof children === "Array" ? children.length : 1) +
35
+ (text ? 1 : 0) +
36
+ (imgSrc ? 1 : 0) +
37
+ (headerText ? 1 : 0);
35
38
 
36
39
  return (
37
40
  <BoxWithShadow
@@ -63,16 +66,15 @@ const Card = ({
63
66
  src={imgSrc}
64
67
  />
65
68
  )}
66
- <Box padding={padding}>
67
- {text && (
68
- <CardText
69
- titleText={titleText}
70
- text={text}
71
- titleVariant={titleVariant}
72
- />
73
- )}
74
- {children}
75
- </Box>
69
+ {text && (
70
+ <CardText
71
+ padding={padding}
72
+ titleText={titleText}
73
+ text={text}
74
+ titleVariant={titleVariant}
75
+ />
76
+ )}
77
+ {children}
76
78
  </Stack>
77
79
  </Cover>
78
80
  </BoxWithShadow>
@@ -5,32 +5,36 @@ import withWindowSize from "../../withWindowSize";
5
5
 
6
6
  import { fallbackValues } from "./CardText.theme";
7
7
 
8
+ import Box from "../layouts/Box";
8
9
  import Cover from "../layouts/Cover";
9
10
  import Paragraph from "../paragraph";
10
11
  import Stack from "../layouts/Stack";
11
12
  import Title from "../title";
12
13
 
13
14
  export const CardText = ({
15
+ padding,
14
16
  text,
15
17
  titleText,
16
18
  titleVariant = "small",
17
19
  themeValues
18
20
  }) => {
19
21
  return (
20
- <Cover>
21
- <Stack>
22
- {titleText && (
23
- <Title
24
- variant={titleVariant}
25
- color={themeValues.titleColor}
26
- weight={themeValues?.titleWeight}
27
- >
28
- {titleText}
29
- </Title>
30
- )}
31
- <Paragraph color={themeValues.textColor}>{text}</Paragraph>
32
- </Stack>
33
- </Cover>
22
+ <Box padding={padding}>
23
+ <Cover>
24
+ <Stack>
25
+ {titleText && (
26
+ <Title
27
+ variant={titleVariant}
28
+ color={themeValues.titleColor}
29
+ weight={themeValues?.titleWeight}
30
+ >
31
+ {titleText}
32
+ </Title>
33
+ )}
34
+ <Paragraph color={themeValues.textColor}>{text}</Paragraph>
35
+ </Stack>
36
+ </Cover>
37
+ </Box>
34
38
  );
35
39
  };
36
40