@bytebrand/fe-ui-core 4.2.43 → 4.2.45

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": "@bytebrand/fe-ui-core",
3
- "version": "4.2.43",
3
+ "version": "4.2.45",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -73,9 +73,9 @@
73
73
  .labelContent
74
74
  flex: 1 1 auto
75
75
  color: $grey-3;
76
- @media (min-width: 1040px) and (max-width: 1112px)
76
+ @media (min-width: 990px) and (max-width: 1112px)
77
77
  max-width: 230px
78
- padding:0px!important
78
+ padding-right: 10px !important;
79
79
 
80
80
  .icon
81
81
  display: block
@@ -16,4 +16,7 @@
16
16
  flex-shrink: 0
17
17
 
18
18
  +media-tablet-landscape-up()
19
- margin-right: 10px
19
+ margin-right: 10px
20
+
21
+ [class*='smallText']
22
+ font-size:10px;
@@ -48,6 +48,24 @@ export const getPowerLabel = (powerKW: number, powerPS: number): string => {
48
48
 
49
49
  return powerKWpowerPS;
50
50
  };
51
+ const wrapValue = (value:string): React.ReactNode => {
52
+ const regex = /-?\d+(\,\d+)?/; // match any digit
53
+ const matches = value.match(regex); // get an array of all digits found
54
+
55
+ if (matches && matches.length > 0) { // If at least one number is found in the input string
56
+ const index = value.indexOf(matches[0]) + matches[0].length;
57
+ const beforeText = value.slice(0, index);
58
+ const afterText = value.slice(index);
59
+
60
+ return (
61
+ <>
62
+ {beforeText}
63
+ <span className='smallText'>{afterText}</span>
64
+ </>
65
+ ); // Return a JSX element with a span wrapper around the text after the number
66
+ }
67
+ return <>{value}</>; // If no numbers are found in the input string, return the original string without any modification
68
+ };
51
69
 
52
70
  const getDecoratedProps = (
53
71
  car: ICar, // @TODO should have a proper interface
@@ -750,15 +768,13 @@ const getDecoratedProps = (
750
768
  const co2Value = Number.isFinite(co2)
751
769
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
752
770
  : t('vehicleProps:value.na');
753
-
754
771
  const hybridPlugin = car.engineData.hybridPlugin;
755
-
756
772
  return Number.isFinite(consumptionCombined) && Number.isFinite(consumptionPowerCombined)
757
773
  ? <React.Fragment>
758
- {consumptionPowerCombined && hybridPlugin ? consumptionPowerCombinedContent : ''}
774
+ {consumptionPowerCombined && hybridPlugin ? wrapValue(consumptionPowerCombinedContent) : ''}
759
775
  {consumptionPowerCombined && hybridPlugin ? <br /> : ''}
760
- {consumptionCombinedContent} <br />
761
- {co2Value}
776
+ {wrapValue(consumptionCombinedContent)} <br />
777
+ {wrapValue(co2Value)}
762
778
  </React.Fragment>
763
779
  : t('vehicleProps:value.na');
764
780
  }