@thecb/components 9.1.0-beta.0 → 9.1.0-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "9.1.0-beta.0",
3
+ "version": "9.1.0-beta.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  import { Cluster, Stack } from "../layouts";
3
3
  import Paragraph from "../paragraph";
4
+ import Text from "../text";
4
5
  import { themeComponent } from "../../../util/themeUtils";
5
6
  import { fallbackValues } from "./LineItem.theme";
7
+ import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
6
8
 
7
9
  const LineItem = ({
8
10
  description,
@@ -13,14 +15,30 @@ const LineItem = ({
13
15
  visibleFields = [],
14
16
  displayQuantity = null
15
17
  }) => {
18
+ const formatAttrKeys = key => {
19
+ const keyWithoutUnderscores = key.replace(/_/g, " ");
20
+ const capitalizedKey = keyWithoutUnderscores
21
+ .split(" ")
22
+ .map(word => word.charAt(0).toUpperCase())
23
+ .join(" ");
24
+ return capitalizedKey;
25
+ };
26
+
16
27
  const visibleCustomAttrs = customAttributes
17
- ?.filter(attr => visibleFields.includes(attr.key))
28
+ ?.filter(
29
+ attr => visibleFields.includes(attr.key) && attr.key !== "description"
30
+ )
18
31
  ?.map(attr => (
19
32
  <Paragraph
20
33
  variant={themeValues.paragraphVariant}
21
34
  weight="400"
22
35
  key={attr.key}
23
- >{`${attr.key}: ${attr.value}`}</Paragraph>
36
+ >
37
+ <Text weight={FONT_WEIGHT_SEMIBOLD}>{`${formatAttrKeys(
38
+ attr.key
39
+ )}:`}</Text>
40
+ <Text>{` ${attr.value}`}</Text>
41
+ </Paragraph>
24
42
  ));
25
43
 
26
44
  return (