@bytebrand/fe-ui-core 4.8.111 → 4.8.112

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.
Files changed (198) hide show
  1. package/.husky/pre-push +4 -0
  2. package/.storybook/addons.js +4 -0
  3. package/.storybook/config.js +64 -0
  4. package/.storybook/postcss.config.js +6 -0
  5. package/.storybook/preview-head.html +10 -0
  6. package/.storybook/webpack.config.js +130 -0
  7. package/__tests__/components/Checkout/OrderOverviewItem/OrderOverviewItem.test.tsx +42 -0
  8. package/__tests__/components/Checkout/PaymentTypeCard/PaymentTypeCard.test.tsx +50 -0
  9. package/__tests__/components/Checkout/RadioGroup.test.tsx +95 -0
  10. package/__tests__/components/Checkout/ServiceCardWrapper.test.tsx +53 -0
  11. package/__tests__/components/Checkout/Switcher.test.tsx +43 -0
  12. package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +613 -0
  13. package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +335 -0
  14. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/AdditionalOrderInfo.test.tsx +127 -0
  15. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCar.test.tsx +58 -0
  16. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCard.test.tsx +74 -0
  17. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusSection.test.tsx +62 -0
  18. package/__tests__/components/UserDasboardPage/sections/RequestedCarsSection/RequestedCarsSection.test.tsx +117 -0
  19. package/__tests__/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.test.tsx +58 -0
  20. package/__tests__/components/VehicleSmallCard/VehicleInfo.test.tsx +88 -0
  21. package/__tests__/components/VehicleSmallCard/VehicleTitle.test.tsx +91 -0
  22. package/__tests__/components/_common/Badge/Badge.test.tsx +15 -0
  23. package/__tests__/components/_common/IconSVG/IconSVG.test.tsx +23 -0
  24. package/__tests__/components/_common/Image/Image.test.tsx +82 -0
  25. package/__tests__/components/_common/MaterialAutocomplete/MaterialAutocomplete.test.tsx +49 -0
  26. package/__tests__/components/_common/MaterialDatePicker/MaterialDatePicker.test.tsx +54 -0
  27. package/__tests__/components/_common/MaterialField/MaterialField.test.tsx +58 -0
  28. package/__tests__/components/_common/StarButton/StarButton.test.tsx +46 -0
  29. package/__tests__/mockedData/financingConfig.js +202 -0
  30. package/__tests__/mockedData/mockedPendingRequestedCar.js +69 -0
  31. package/__tests__/utils/CommonUtils/addPrefixToKeys.test.ts +18 -0
  32. package/__tests__/utils/CommonUtils/arrToObj.test.js +32 -0
  33. package/__tests__/utils/CommonUtils/checkRangeValuesOnEqual.test.ts +17 -0
  34. package/__tests__/utils/CommonUtils/fixNumber.test.ts +20 -0
  35. package/__tests__/utils/CommonUtils/formatMileage.test.ts +8 -0
  36. package/__tests__/utils/CommonUtils/getChipFilterValue.test.ts +22 -0
  37. package/__tests__/utils/CommonUtils/getFormattedNumber.test.ts +19 -0
  38. package/__tests__/utils/CommonUtils/getFormattedPrice.test.ts +19 -0
  39. package/__tests__/utils/CommonUtils/getGroupValuesForQuery.test.ts +51 -0
  40. package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +64 -0
  41. package/__tests__/utils/CommonUtils/getPriceRating.test.ts +26 -0
  42. package/__tests__/utils/CommonUtils/getPriceRatingConfig.test.ts +33 -0
  43. package/__tests__/utils/CommonUtils/preloadNearbyImages.test.ts +9 -0
  44. package/__tests__/utils/CommonUtils/sliceLessThan.test.ts +23 -0
  45. package/__tests__/utils/CommonUtils/sliceMoreThan.test.ts +23 -0
  46. package/media/locales/de/promoSlider.json +1 -0
  47. package/media/locales/en/promoSlider.json +1 -0
  48. package/package.json +118 -120
  49. package/source/components/AccordionWidget/AccordionWidget.styl +13 -1
  50. package/source/components/AccordionWidget/AccordionWidget.tsx +49 -8
  51. package/source/components/AdvantageItem/AdvantageItem.story.js +23 -0
  52. package/source/components/Alternative/Dealer.story.js +32 -0
  53. package/source/components/Alternative/Dealer.story.styl +3 -0
  54. package/source/components/Breadcrumbs/Breadcrumbs.story.js +40 -0
  55. package/source/components/Breadcrumbs/FirstInfoBlock/FirstInfoBlock.story.js +45 -0
  56. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.js +243 -0
  57. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.styl +21 -0
  58. package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.js +105 -0
  59. package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.styl +37 -0
  60. package/source/components/Checkout/Switcher/Switcher.story.js +41 -0
  61. package/source/components/Checkout/Switcher/Switcher.story.styl +2 -0
  62. package/source/components/CompactSearchWidget/CompactSearchWidget.story.js +187 -0
  63. package/source/components/ContactForm/ContactForm.story.js +94 -0
  64. package/source/components/ContactForm/ContactForm.story.styl +0 -0
  65. package/source/components/ContactInfo/ContactInfo.story.js +58 -0
  66. package/source/components/CustomerQuote/CustomerQuote.story.js +41 -0
  67. package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.js +73 -0
  68. package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.styl +5 -0
  69. package/source/components/FormattedNumber/FormattedNumber.story.js +114 -0
  70. package/source/components/InfoBlocks/InfoBlockWrapper.story.js +101 -0
  71. package/source/components/InfoBlocks/InfoBlockWrapper.story.styl +46 -0
  72. package/source/components/OfferPanel/AboAccordion/AboFaq/AboFaq.story.js +97 -0
  73. package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +2 -2
  74. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.styl +24 -0
  75. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -2
  76. package/source/components/OfferPanel/OfferPanel.story.js +139 -0
  77. package/source/components/OfferPanel/OfferPanel.tsx +1 -1
  78. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.js +35 -0
  79. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.styl +3 -0
  80. package/source/components/PriceRating/PriceRating.story.js +39 -0
  81. package/source/components/PriceRating/PriceRating.story.styl +2 -0
  82. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.js +78 -0
  83. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.styl +11 -0
  84. package/source/components/RateSearchValue/RateSearchValue.story.js +78 -0
  85. package/source/components/RateSearchValue/RateSearchValue.story.styl +2 -0
  86. package/source/components/RateSearchWidget/RateSearchWidget.story.js +57 -0
  87. package/source/components/RateSearchWidget/RateSearchWidget.story.styl +12 -0
  88. package/source/components/SearchFilters/FiltersFactory.story.js +273 -0
  89. package/source/components/SearchPage/Filters/MakeModel/MakeModel.story.js +12 -0
  90. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.js +834 -0
  91. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.styl +40 -0
  92. package/source/components/SearchWidget/SearchWidget.story.js +191 -0
  93. package/source/components/SearchWidget/SearchWidget.story.styl +6 -0
  94. package/source/components/Stepper/Stepper.story.js +119 -0
  95. package/source/components/Stepper/Stepper.story.styl +41 -0
  96. package/source/components/Theme.story.js +36 -0
  97. package/source/components/Theme.story.styl +85 -0
  98. package/source/components/TickerText/TickerText.story.js +17 -0
  99. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.story.js +95 -0
  100. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.story.js +97 -0
  101. package/source/components/Vehicle/VehicleConsumption/VehicleConsumption.story.js +31 -0
  102. package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.story.js +247 -0
  103. package/source/components/VehicleCompared/CompareGeneral/CompareGeneral.story.js +30 -0
  104. package/source/components/VehicleCompared/ComparePrice/ComparePrice.story.js +18 -0
  105. package/source/components/VehicleCompared/CompareTitle/CompareTitle.story.js +19 -0
  106. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.story.js +44 -0
  107. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +23 -11
  108. package/source/components/VehicleDetailedSidebar/partials/Properties.styl +5 -0
  109. package/source/components/VehicleDetailedSidebar/partials/Properties.tsx +56 -18
  110. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
  111. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +2 -6
  112. package/source/components/VehiclePromoSlider/VehiclePromoInfo/VehiclePromoInfo.story.js +42 -0
  113. package/source/components/VehiclePromoSlider/VehiclePromoSlide/VehiclePromoSlide.story.js +62 -0
  114. package/source/components/VehiclePromoSlider/VehiclePromoSlider.story.js +42 -0
  115. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.styl +42 -0
  116. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +23 -11
  117. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +60 -5
  118. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +36 -12
  119. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
  120. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +18 -7
  121. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.styl +4 -1
  122. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.tsx +3 -2
  123. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -1
  124. package/source/components/VehicleSmallCard/VehicleSmallCard.story.js +412 -0
  125. package/source/components/VehicleSmallCard/VehicleSmallCard.story.styl +56 -0
  126. package/source/components/VehicleSmallCard/VehicleSmallCard.styl +67 -2
  127. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +49 -3
  128. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js +199 -0
  129. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl +40 -0
  130. package/source/components/_common/Accordion/Accordion.story.js +36 -0
  131. package/source/components/_common/Badge/Badge.story.js +27 -0
  132. package/source/components/_common/Badge/Badge.story.styl +5 -0
  133. package/source/components/_common/Bubble/Bubble.story.js +52 -0
  134. package/source/components/_common/Button/Button.story.js +52 -0
  135. package/source/components/_common/Button/Button.story.styl +5 -0
  136. package/source/components/_common/ButtonOld/Button.story.js +54 -0
  137. package/source/components/_common/ButtonOld/Button.story.styl +5 -0
  138. package/source/components/_common/Checkbox/Checkbox.story.js +85 -0
  139. package/source/components/_common/Checkbox/Checkbox.story.styl +14 -0
  140. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.js +126 -0
  141. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.styl +14 -0
  142. package/source/components/_common/Chip/Chip.story.js +43 -0
  143. package/source/components/_common/ChipList/ChipList.story.js +36 -0
  144. package/source/components/_common/DropDown/DropDown.story.js +35 -0
  145. package/source/components/_common/ExpandablePanel/ExpandablePanel.story.js +41 -0
  146. package/source/components/_common/Histogram/Histogram.story.js +51 -0
  147. package/source/components/_common/IconSVG/IconSVG.story.js +21 -0
  148. package/source/components/_common/IconSVG/IconSVG.story.styl +25 -0
  149. package/source/components/_common/Image/Image.story.js +142 -0
  150. package/source/components/_common/Image/Image.story.styl +18 -0
  151. package/source/components/_common/ImagesSet/ImagesSet.story.js +34 -0
  152. package/source/components/_common/ImagesSet/ImagesSet.story.styl +4 -0
  153. package/source/components/_common/Loader/Loader.story.js +21 -0
  154. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.story.js +49 -0
  155. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.styled.tsx +4 -1
  156. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.js +45 -0
  157. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.styl +6 -0
  158. package/source/components/_common/MaterialField/MaterialField.story.js +87 -0
  159. package/source/components/_common/MaterialField/MaterialField.story.styl +34 -0
  160. package/source/components/_common/MaterialSelect/MaterialSelect.story.js +52 -0
  161. package/source/components/_common/MaterialSelect/MaterialSelect.story.styl +6 -0
  162. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.js +47 -0
  163. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.styl +6 -0
  164. package/source/components/_common/MaterialSwitch/MaterialSwitch.story.js +17 -0
  165. package/source/components/_common/MaterialTooltip/MaterialTooltip.story.js +10 -0
  166. package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +4 -3
  167. package/source/components/_common/Modal/Modal.story.js +37 -0
  168. package/source/components/_common/MuiGroupedSelect/MuiGroupedSelect.story.js +21 -0
  169. package/source/components/_common/PropertySelector/PSGroup.story.js +93 -0
  170. package/source/components/_common/PropertySelector/PSGroup.story.styl +25 -0
  171. package/source/components/_common/PropertySelector/ProperySelector.story.js +83 -0
  172. package/source/components/_common/Radio/FormRadioGroup.story.js +28 -0
  173. package/source/components/_common/Radio/FormRadioGroup.story.styl +2 -0
  174. package/source/components/_common/Radio/Radio.story.js +54 -0
  175. package/source/components/_common/Radio/RadioGroup.story.js +90 -0
  176. package/source/components/_common/Radio/RadioGroup.story.styl +39 -0
  177. package/source/components/_common/Range/Range.story.js +46 -0
  178. package/source/components/_common/Range/Range.story.styl +5 -0
  179. package/source/components/_common/SliderArrow/SliderArrow.story.js +18 -0
  180. package/source/components/_common/Tabs/Tabs.story.js +56 -0
  181. package/source/components/_common/TimePicker/TimePicker.story.js +37 -0
  182. package/source/components/_common/Tooltip/Tooltip.story.js +28 -0
  183. package/source/components/_common/UserMenu/MaterialMenu.story.js +73 -0
  184. package/source/components/_common/VehicleSlider/VehicleSlider.story.js +99 -0
  185. package/source/components/_common/VehicleSlider/VehicleSlider.story.styl +0 -0
  186. package/source/components/_common/withLabel/withLabel.story.js +62 -0
  187. package/source/components/_common/withPopover/withPopover.story.js +48 -0
  188. package/source/components/_common/withPopover/withPopover.story.styl +54 -0
  189. package/source/components/_common/withStats/withStats.story.js +75 -0
  190. package/source/components/_common/withStats/withStats.styl +10 -0
  191. package/source/framework/DataTransformers.ts +2 -0
  192. package/source/framework/constants/common.ts +8 -4
  193. package/source/framework/types/types.ts +1 -0
  194. package/source/framework/vehiclesProps/decoratedLightProps.tsx +109 -18
  195. package/source/framework/vehiclesProps/decoratedProps.tsx +68 -9
  196. package/source/framework/vehiclesProps/vehicleDetails.ts +3 -1
  197. package/source/locales/data.ts +13 -3
  198. package/bytebrand-fe-ui-core-4.8.110.tgz +0 -0
@@ -47,6 +47,10 @@ export interface IVehiclePriceSectionProps {
47
47
  onAddOfferToMainSlideClick?: (id: string, mainImageId: string, price: number, financingConfig: any) => void;
48
48
  combineRefAlternative?: boolean;
49
49
  typeAlternative?: string;
50
+ // ADV-88: hide the "monatlich z.B."/"monthly e.g." column header for the task's cars
51
+ // (new plug-in hybrids that get the externalised consumption row) so the price column
52
+ // moves up. Passed true from VehicleSmallCard only when the consumption row is shown.
53
+ suppressMonthlyFrom?: boolean;
50
54
  }
51
55
 
52
56
  // interface IPriceData {
@@ -95,7 +99,6 @@ const VehiclePrice: React.FC<IVehiclePriceSectionProps> = (props: IVehiclePriceS
95
99
  routeObj,
96
100
  toggleCarToCompare,
97
101
  toCompare,
98
- priceSubMtl,
99
102
  classButton,
100
103
  onRemoveClick,
101
104
  showCompareCheckboxes,
@@ -114,6 +117,7 @@ const VehiclePrice: React.FC<IVehiclePriceSectionProps> = (props: IVehiclePriceS
114
117
  } = {},
115
118
  common: { isStrikeShown },
116
119
  typeAlternative,
120
+ suppressMonthlyFrom,
117
121
  margin
118
122
  } = props;
119
123
 
@@ -144,24 +148,31 @@ const VehiclePrice: React.FC<IVehiclePriceSectionProps> = (props: IVehiclePriceS
144
148
  vehicleComponentName === 'landing' ||
145
149
  vehicleComponentName === 'main' ? 'outlined' : 'contained';
146
150
 
151
+ // ADV-70 (design): the monthly label ("mtl."/"mth.") is shown BEFORE every monthly rate on
152
+ // all card surfaces (SRL desktop+mobile, comparable, home, landing) — derive it from the
153
+ // localized priceSub key instead of the consumer-passed priceSubMtl (which is null on mobile),
154
+ // so it renders consistently everywhere. VehiclePriceItem strips the leading "/".
155
+ const monthlyPrefix = (t && t('vehicleProps:value.priceSub')) || '';
156
+
147
157
  const priceItemsGlobal = [
148
158
  {
149
159
  perMonthOld: oldMonthlyInstallment,
150
160
  perMonthCurrent: monthlyInstallment,
151
161
  title: t('vehicleProps:title.financing'),
152
- prefixOldPrice: vehicleComponentName === 'search' && !isMobileOnly && t('vehicleProps:value.prefixOldPrice'),
162
+ // ADV-88 (design): drop the "z.B."/"e.g." prefix on the SRL card — the monthly label carries the meaning.
163
+ prefixOldPrice: false,
153
164
  postfix: '3',
154
- priceSub: priceSubMtl,
165
+ priceSub: monthlyPrefix,
155
166
  tooltipDescription: !combineRefAlternative && t('vehicleProps:title.financingDescription')
156
167
  },
157
168
  {
158
169
  perMonthOld: lOldMonthlyInstallment,
159
170
  perMonthCurrent: lMonthlyInstallment,
160
- prefixOldPrice: vehicleComponentName === 'search' && !isMobileOnly && t('vehicleProps:value.prefixOldPrice'),
171
+ prefixOldPrice: false,
161
172
  postfix: '1,3',
162
173
  isPriceDisable: !isLeasingActive,
163
174
  title: t('vehicleProps:title.leasing'),
164
- priceSub: priceSubMtl,
175
+ priceSub: monthlyPrefix,
165
176
  tooltipDescription: !combineRefAlternative && t('vehicleProps:title.leasingDescription')
166
177
  }
167
178
  ];
@@ -223,10 +234,10 @@ const VehiclePrice: React.FC<IVehiclePriceSectionProps> = (props: IVehiclePriceS
223
234
  formControlClassName={styles.wrapCheckbox}
224
235
  />
225
236
  )}
226
- {vehicleComponentName !== 'favorite' && vehicleComponentName !== 'search' && !isMobileOnly && (
237
+ {!suppressMonthlyFrom && vehicleComponentName !== 'favorite' && vehicleComponentName !== 'search' && !isMobileOnly && (
227
238
  <span className={vehiclePriceTitleClassName}>{t('vehicleProps:title.monthlyFrom')}</span>
228
239
  )}
229
- {isMobileOnly && !showCompareCheckboxes && (
240
+ {!suppressMonthlyFrom && isMobileOnly && !showCompareCheckboxes && (
230
241
  <span className={vehiclePriceTitleClassName}>{t('vehicleProps:title.monthlyFrom')}</span>
231
242
  )}
232
243
  {priceData.map((props: any) => (
@@ -11,7 +11,7 @@
11
11
 
12
12
  .smallProp
13
13
  span
14
- font-size: 10px !important
14
+ font-size: 9px !important
15
15
 
16
16
  .pluginVal
17
17
  span
@@ -26,5 +26,8 @@
26
26
  +media-tablet-landscape-up()
27
27
  margin-right: 10px
28
28
 
29
+ .noIcon
30
+ padding-left: 5px
31
+
29
32
  [class*='smallText']
30
33
  font-size:10px;
@@ -19,12 +19,13 @@ class VehicleProperty extends React.Component<IVehicleProperty, {}> {
19
19
 
20
20
  render(): React.ReactNode {
21
21
  const { className, classNameIcon, icon, description, smalltext, hybridPlugin } = this.props;
22
- const propertyClass: string = `${styles.carProp} ${className ? className : ''} ${smalltext ? styles.smallProp : ''} ${hybridPlugin ? styles.pluginVal : ''}`;
22
+ const noIcon: boolean = !icon;
23
+ const propertyClass: string = `${styles.carProp} ${className ? className : ''} ${smalltext ? styles.smallProp : ''} ${hybridPlugin ? styles.pluginVal : ''} ${noIcon ? styles.noIcon : ''}`;
23
24
  const propertyClassIcon: string = `${styles.carIcon} ${classNameIcon ? classNameIcon : ''}`;
24
25
 
25
26
  return (
26
27
  <div className={propertyClass}>
27
- <IconSVG className={propertyClassIcon} name={icon} customDimensions />
28
+ {!noIcon && <IconSVG className={propertyClassIcon} name={icon} customDimensions />}
28
29
  <span>{description}</span>
29
30
  </div>
30
31
  );
@@ -48,7 +48,7 @@ const VehicleTitle: React.FC<IVehicleTitleProps> = ({
48
48
  event.preventDefault();
49
49
  event.stopPropagation();
50
50
  event.nativeEvent.stopImmediatePropagation();
51
- onFavoriteClick(event, id);
51
+ if (onFavoriteClick) onFavoriteClick(event, id);
52
52
  };
53
53
 
54
54
  const renderFavoriteIcon = (): React.ReactNode => {
@@ -0,0 +1,412 @@
1
+ import React from 'react';
2
+ import i18next from 'i18next';
3
+ import { Resizable } from 're-resizable';
4
+ import classnames from 'classnames';
5
+ // import * as CheckboxTree from 'react-checkbox-tree';
6
+ import { withNamespaces } from 'react-i18next';
7
+ import { storiesOf } from '@storybook/react';
8
+ import { action } from '@storybook/addon-actions';
9
+ // import { CircularProgressbar, buildStyles } from 'react-circular-progressbar';
10
+ import VehicleSmallCard from './VehicleSmallCard.tsx';
11
+ import styles from './VehicleSmallCard.story.styl';
12
+
13
+
14
+ i18next.addResourceBundle('de', 'vehicleProps', {
15
+ value: {
16
+ mileage: "{{mileage}} km",
17
+ consumption: "{{consumption}}l/100km",
18
+ consumptionPower: "{{consumption}}kWh/100km",
19
+ consumptionPowerCombined: "{{consumption}}kWh/100km (komb)*",
20
+ consumptionGas: "{{consumption}}kg/100km",
21
+ consumptionCombined: "{{consumption}}l/100km",
22
+ power: "{{powerKW}}\u00A0kW ({{powerPS}}\u00A0PS)",
23
+ powerPS: "{{powerPS}} PS",
24
+ deliveryPeriodMonths: "{{count}} Monat\nab Bestellung",
25
+ deliveryPeriodDays: "{{count}} Tag\nab Bestellung",
26
+ co2Combined: "{{co2}}g CO2/km (komb)*",
27
+ co2: "{{co2}} g/km ",
28
+ na: "N/A"
29
+ },
30
+ priceRating: {
31
+ noRating: 'KEINE BEWERTUNG',
32
+ highPrice: 'HOHER PREIS',
33
+ increasedPrice: 'ERHÖHTER PREIS',
34
+ fairPrice: 'FAIRER PREIS',
35
+ goodPrice: 'GUTER PREIS',
36
+ topPrice: 'TOP PREIS'
37
+ },
38
+ promoSlider: {
39
+ consumptionCombined: `{{consumptionCombined}} l/100km (komb)*`,
40
+ co2: `{{co2}} g CO2/km (komb)*`,
41
+ new: 'neu'
42
+ },
43
+ title: {
44
+ addOfferToMainSlide: 'Zum Schieberegler hinzufügen',
45
+ toOffer: 'zum Angebot',
46
+ monthlyFrom: 'monatlich ab',
47
+ financing: 'Finanzierung',
48
+ leasing: 'Leasing',
49
+ abo: 'Abo',
50
+ buy: 'Kaufen',
51
+ margeInkl: "inkl. Marge",
52
+ marge: "Unsere Marge",
53
+ financingDescription: `Bei der Finanzierung zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil.
54
+ Zum Vertragsende können Sie entscheiden, ob Sie den Restbetrag ablösen oder weiter finanzieren wollen.`,
55
+ leasingDescription: `Beim Leasing zahlen Sie lediglich die Zinsen des Darlehens und einen geringen
56
+ Tilgungsanteil. Zum Vertragsende geben Sie das Auto einfach wieder zurück.`,
57
+ aboDescription: `Bei diesem Auto-Abo ist bereits alles an Bord. Teil- und
58
+ Vollkasko sowie Haftpflicht sind inklusive, ebenso wie Wartungs- und Verschleißreparaturen.
59
+ Sie zahlen also nur Ihre Rate und Kraftstoff.`,
60
+ buyDescription: `Nach Kaufabschluss haben Sie die sofortigen
61
+ Eigentumsrechte und keine Finanzierungskosten. Als Eigentümer können Sie Ihr Fahrzeug zu
62
+ eigenen Konditionen weiter verkaufen und Änderungen vornehmen.`
63
+ }
64
+ });
65
+
66
+ const resizablePropsSlider = {
67
+ minWidth: 150,
68
+ defaultSize: { width: 360, height: 'auto' }
69
+ };
70
+ const resizableProps = {
71
+ className: styles.resizable,
72
+ minWidth: 150,
73
+ defaultSize: { width: 360, height: 'auto' }
74
+ };
75
+
76
+ const resizablePropsComparable = {
77
+ className: styles.resizable,
78
+ minWidth: 150,
79
+ defaultSize: { width: 230, height: 'auto' }
80
+ };
81
+
82
+ const resizablePropsSearch = {
83
+ className: styles.resizable,
84
+ defaultSize: { width: 803, height: 283 }
85
+ };
86
+
87
+ const resizablePropsAlternative = {
88
+ className: styles.resizable,
89
+ defaultSize: { width: 803 } // height: 265
90
+ };
91
+
92
+ const IMAGE_URL = 'https://picsum.photos/400/300/?random';
93
+ const images = [];
94
+ for (let i = 0; i <= 10; i++) {
95
+ images.push({ url: `${IMAGE_URL}&tag=${Math.random()}`, description: '' });
96
+ }
97
+
98
+
99
+
100
+
101
+ const VehicleSmallCardStory = withNamespaces('vehicleProps')(({ t }) => {
102
+
103
+ const renderCircularProgressbar = (percentage) => {
104
+ const checkPercentage = percentage < 50 ?
105
+ '#EE0202' :
106
+ (percentage >= 50 && percentage < 80) ?
107
+ '#00B800' :
108
+ '#005CCB';
109
+ return (
110
+ <div className={
111
+ classnames(
112
+ styles.progressWrap,
113
+ { [styles.progressWrapFull]: percentage === 100 },
114
+ { [styles.progressWrapMin]: percentage < 10 }
115
+ )
116
+ }>
117
+ <CircularProgressbar
118
+ value={percentage}
119
+ text={`${percentage}`}
120
+ styles={buildStyles({
121
+ textSize: '32px',
122
+ pathColor: checkPercentage,
123
+ textColor: checkPercentage,
124
+ trailColor: '#D5D5D5'
125
+ })}
126
+ />
127
+ </div>
128
+ );
129
+ };
130
+
131
+ const cardPropsSlider = {
132
+ t,
133
+ language: 'de',
134
+ vehicleComponentName: 'landing',
135
+ isAlternative: false,
136
+ showSlider: true,
137
+ showNewLabel: true,
138
+ slider: {
139
+ mainImageUrl: 'http://placehold.jp/400x300.png?text=mainImage',
140
+ images,
141
+ arrowsSize: 'md',
142
+ onFirstChange: action('first change')
143
+ },
144
+ stats: {
145
+ imagesCount: 100,
146
+ isFavoured: true,
147
+ statsData: {
148
+ totalCarImpCount: 10,
149
+ totalFavCount: 20,
150
+ },
151
+ statsSize: 'xs'
152
+ },
153
+ title: {
154
+ make: 'Audi',
155
+ model: 'A4',
156
+ },
157
+ info: {
158
+ mileage: 10464,
159
+ regDate: 1535760000,
160
+ gearbox: 'selector_gearbox_automatic'
161
+ },
162
+ environmentEmissions: {
163
+ co2: 8.7
164
+ },
165
+ consumption: {
166
+ consumptionCombined: 9.6,
167
+ consumptionPowerCombined: 3.6,
168
+ fuel: 'selector_fuel_electrical'
169
+ },
170
+ engineData: {
171
+ cubicCapacity: 1968,
172
+ cylinders: 0,
173
+ particulateFilterDiesel: true,
174
+ powerKW: 140,
175
+ powerPS: 190,
176
+ startStopSystem: true,
177
+ },
178
+ offer : {
179
+ availabilityFrom: null,
180
+ availabilityMode: "selector_availabilityMode_always",
181
+ deliveryPeriod: "selector_unknown"
182
+ },
183
+ financing: {
184
+ annualPercentageRate: "",
185
+ bank: "",
186
+ closingCosts: null,
187
+ conditions: null,
188
+ finalInstallment: null,
189
+ financingBank: "",
190
+ firstInstallment: 0,
191
+ grossLoanAmount: "",
192
+ monthlyInstallment: 108,
193
+ netLoanAmount: "",
194
+ nominalInterestRate: "",
195
+ paybackPeriod: "24",
196
+ paymentProtectionInsurance: "",
197
+ platformFinancingId: null,
198
+ transportationCosts: "",
199
+ typeOfNominalInterestRate: null
200
+ },
201
+ leasing: {
202
+ RWG: 10,
203
+ addServicesCost: 799,
204
+ annualMileage: null,
205
+ closingCosts: null,
206
+ financialInstitution: null,
207
+ firstInstallment: null,
208
+ leasingMode: "default",
209
+ maxAge: null,
210
+ maxMileage: null,
211
+ nominalInterestRate: null,
212
+ paybackPeriod: null,
213
+ paymentProtectionInsurance: null,
214
+ purchasePrice: null,
215
+ santanderPayBackMin: 250,
216
+ transportationCost: null
217
+ },
218
+ price: {
219
+ common: {
220
+ isStrikeShown: true
221
+ },
222
+ monthlyInstallment: 29,
223
+ oldMonthlyInstallment: 49,
224
+ isStrikeShown: true,
225
+ currency: "EUR",
226
+ currentSalesPrice: 16160,
227
+ historyPriceDifference: 5629.6,
228
+ historyPriceDifferencePerCent: 26,
229
+ mlCurrentSalesPriceCategory: null,
230
+ mlCurrentSalesPriceDiffPercent: null,
231
+ mlCurrentSalesPricePredicted: 100,
232
+ totalCurrent: 50,
233
+ originalSalesPrice: 13467,
234
+ priceDate: null,
235
+ priceId: null,
236
+ recomendedRetailPrice: null,
237
+ retailToCurrentPriceDifference: 0,
238
+ vatDeductible: null,
239
+ vatRate: 7,
240
+ wasPrice: 10000,
241
+ financing: {
242
+ monthlyInstallment: 49,
243
+ oldMonthlyInstallment: 69,
244
+ isActive: true
245
+ },
246
+ leasing: {
247
+ monthlyInstallment: 49,
248
+ oldMonthlyInstallment: 69,
249
+ isActive: true
250
+ },
251
+ buy: {
252
+ currentSalesPriceExtra: 16110,
253
+ highestPriceExtra: 19349
254
+ }
255
+ },
256
+ seoText: 'Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008,Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008',
257
+ onFinancingClick: action('financing click'),
258
+ onContainerClick: action('container click'),
259
+ onFavoriteClick: action('favorite click'),
260
+ };
261
+
262
+ const cardProps = {
263
+ ...cardPropsSlider,
264
+ vehicleComponentName: 'main',
265
+ seoText: '',
266
+ slider: {},
267
+ info: {
268
+ mileage: 10464,
269
+ regDate: 1535760000,
270
+ gearbox: 'selector_gearbox_automatic'
271
+ },
272
+ environmentEmissions: {
273
+ co2: 8.7
274
+ },
275
+ consumption: {
276
+ consumptionCombined: 9.6,
277
+ consumptionPowerCombined: 3.6,
278
+ fuel: 'selector_fuel_hybridElectricalPetrol'
279
+ },
280
+ };
281
+
282
+ const cardPropsComparable = {
283
+ ...cardPropsSlider,
284
+ slider: {},
285
+ vehicleComponentName: 'comparable',
286
+ seoText: ''
287
+ };
288
+
289
+ const cardPropsSearch = {
290
+ ...cardPropsSlider,
291
+ vehicleComponentName: 'search',
292
+ seoText: '',
293
+ showSlider: true,
294
+ title: {
295
+ ...cardPropsSlider.title,
296
+ option: '110 kW (150 PS)',
297
+ isSponsored: true
298
+ },
299
+ slider: {
300
+ mainImageUrl: 'http://placehold.jp/400x300.png?text=mainImage',
301
+ images,
302
+ arrowsSize: 'md',
303
+ getCarImagesData: () => new Promise(resolve => resolve(images)),
304
+ onFirstChange: action('first change')
305
+ },
306
+ isDealerSuperAdmin: true
307
+ };
308
+
309
+ const cardPropsAlternative = {
310
+ ...cardPropsSlider,
311
+ vehicleComponentName: 'search',
312
+ seoText: '',
313
+ showSlider: true,
314
+ isAlternative: true,
315
+ title: {
316
+ ...cardPropsSlider.title,
317
+ option: '110 kW (150 PS)',
318
+ isSponsored: true
319
+ },
320
+ info: {
321
+ ...cardPropsSlider.info,
322
+ location: {
323
+ city: 'Lviv',
324
+ countryCode: 'UA',
325
+ street: 'Stepana Bandery',
326
+ zipCode: 64380
327
+ }
328
+ },
329
+ slider: {
330
+ mainImageUrl: 'http://placehold.jp/400x300.png?text=mainImage',
331
+ images,
332
+ arrowsSize: 'md',
333
+ onFirstChange: action('first change')
334
+ },
335
+ isDealerSuperAdmin: true
336
+ };
337
+
338
+ const cardPropsReference = {
339
+ ...cardPropsSlider,
340
+ vehicleComponentName: 'search',
341
+ seoText: '',
342
+ showSlider: true,
343
+ isAlternative: true,
344
+ isReferenceSearch: true,
345
+ CircularProgressbar: () => renderCircularProgressbar(8),
346
+ title: {
347
+ ...cardPropsSlider.title,
348
+ option: '110 kW (150 PS)',
349
+ isSponsored: true
350
+ },
351
+ info: {
352
+ ...cardPropsSlider.info,
353
+ location: {
354
+ city: 'Lviv',
355
+ countryCode: 'UA',
356
+ street: 'Stepana Bandery',
357
+ zipCode: 64380
358
+ }
359
+ },
360
+ slider: {
361
+ mainImageUrl: 'http://placehold.jp/400x300.png?text=mainImage',
362
+ images,
363
+ arrowsSize: 'md',
364
+ onFirstChange: action('first change')
365
+ },
366
+ isDealerSuperAdmin: false
367
+ };
368
+
369
+ return (
370
+ <>
371
+ <div className={styles.wrapper}>
372
+ <p>Landing with slider</p>
373
+ <Resizable {...resizablePropsSlider}>
374
+ <VehicleSmallCard {...cardPropsSlider} />
375
+ </Resizable>
376
+ </div>
377
+ <div className={styles.wrapper}>
378
+ <p>Main without slider</p>
379
+ <Resizable {...resizableProps}>
380
+ <VehicleSmallCard {...cardProps} />
381
+ </Resizable>
382
+ </div>
383
+ <div className={styles.wrapper}>
384
+ <Resizable {...resizablePropsComparable}>
385
+ <p>Comparable cars</p>
386
+ <VehicleSmallCard {...cardPropsComparable} />
387
+ </Resizable>
388
+ </div>
389
+ <div className={styles.wrapper}>
390
+ <p>Search cars</p>
391
+ <Resizable {...resizablePropsSearch}>
392
+ <VehicleSmallCard {...cardPropsSearch} />
393
+ </Resizable>
394
+ </div>
395
+ <div className={styles.wrapper}>
396
+ <p>Alternative cars</p>
397
+ <Resizable {...resizablePropsAlternative}>
398
+ <VehicleSmallCard {...cardPropsAlternative} />
399
+ </Resizable>
400
+ </div>
401
+ <div className={styles.wrapper}>
402
+ <p>Reference search cars</p>
403
+ <Resizable {...resizablePropsAlternative}>
404
+ <VehicleSmallCard {...cardPropsReference} />
405
+ </Resizable>
406
+ </div>
407
+ </>
408
+ );
409
+
410
+ });
411
+
412
+ storiesOf('VehicleSmallCard', module).add('VehicleSmallCard', () => <VehicleSmallCardStory />);
@@ -0,0 +1,56 @@
1
+ @import '../../theme/theme.styl';
2
+
3
+ .wrapper
4
+ // position: fixed
5
+ width: 100%
6
+ height: 100%
7
+ left: 0px
8
+ top: 0px
9
+ display: flex
10
+ flex-direction: column;
11
+ background-color #fff
12
+ font-family: $font-style-arial
13
+ padding 0 10px;
14
+ // &>:first-child
15
+ // border-right: 1px solid $grey-e
16
+ // margin-right: 10px
17
+
18
+ .propsContainer
19
+ overflow-y: auto
20
+
21
+ .title
22
+ text-align: center
23
+ font-size: 22px
24
+ font-weight: bold
25
+
26
+ .input
27
+ display: inline-block !important
28
+ margin-left: 10px
29
+ position: absolute
30
+ right: 0
31
+
32
+ :global
33
+ .react-checkbox-tree
34
+ width: 550px
35
+ margin-right: 10px
36
+ padding-right: 10px
37
+ .rct-node
38
+ margin: 10px 0
39
+ position: relative
40
+
41
+ .progressWrap
42
+ width: 30px;
43
+ height: 30px;
44
+ position: absolute;
45
+ top: 0;
46
+ z-index: 2;
47
+
48
+ & [class*='CircularProgressbar-text']
49
+ transform: translate(-18%, 10px);
50
+
51
+ &.progressWrapFull
52
+ & [class*='CircularProgressbar-text']
53
+ transform: translate(-27%, 10px);
54
+ &.progressWrapMin
55
+ & [class*='CircularProgressbar-text']
56
+ transform: translate(-10%, 10px);
@@ -131,7 +131,8 @@
131
131
 
132
132
  &.vehicleWrapMain
133
133
  box-sizing: border-box;
134
- grid-template-columns: 55% 45%;
134
+ // mobile home/comparable: equal info|price columns (was 55/45).
135
+ grid-template-columns: 50% 50%;
135
136
  border: 1px solid #DFDFDF;
136
137
  margin-bottom: 5px;
137
138
  border-radius: 10px;
@@ -145,7 +146,11 @@
145
146
  padding: 0 16px;
146
147
 
147
148
  +media-tablet-landscape-up()
148
- grid-template-columns: 120px 1fr;
149
+ // narrow 4-up home card (~256px): the price section (rates + "Zum Angebot" button) needs
150
+ // ~150px or it overflows the frame, so give the price column the larger share and the info
151
+ // (left) column the smaller one; minmax(0,…) keeps both tracks inside the card so nothing
152
+ // is clipped and the info spec text wraps instead of spilling out.
153
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
149
154
  border: 1px solid rgba(76, 78, 100, 0.12);
150
155
  border-radius: 10px;
151
156
  margin-bottom: 0;
@@ -216,6 +221,66 @@
216
221
  .gridAreaImage
217
222
  grid-area: image;
218
223
 
224
+ // ADV-70: plug-in consumption/CO2 line — dedicated full-width row BELOW the specs table /
225
+ // price block ("Zum Angebot") and ABOVE the equipment text, in small grey text. The
226
+ // .vehicleWrapNewPlugin grid inserts a full-width 'consumption' row for every externalised
227
+ // card type (search / landing / main / comparable).
228
+ .vehicle.vehicleWrapNewPlugin
229
+ grid-template-areas:
230
+ 'title title'\
231
+ 'image image'\
232
+ 'info price'\
233
+ 'consumption consumption'\
234
+ 'seoText seoText'
235
+
236
+ // SRL/search 3-column desktop: the consumption line sits in the INFO column only
237
+ // (starts AND ends under the spec block, not under the image and not into the price
238
+ // column). image + price span rows 2-3 so the "Zum Angebot" button bottom-aligns
239
+ // with the consumption line.
240
+ &.vehicleWrapSearch
241
+ +media-tablet-landscape-up()
242
+ grid-template-areas:
243
+ 'title title price'\
244
+ 'image info price'\
245
+ 'image consumption price'
246
+ // No divider on the DESKTOP search card — the consumption sits inside the info
247
+ // column (button-aligned) where a top line is unwanted; keep it on mobile only.
248
+ & > .gridAreaConsumption
249
+ border-top: 0;
250
+ margin-top: 0;
251
+
252
+ // Favorites desktop: consumption sits in the info column between the image and the
253
+ // price/buttons column, button-aligned — same as the SRL card.
254
+ &.vehicleWrapFavorite
255
+ +media-tablet-landscape-up()
256
+ grid-template-areas:
257
+ 'title title price'\
258
+ 'image info price'\
259
+ 'image consumption price'
260
+
261
+ .gridAreaConsumption
262
+ grid-area: consumption;
263
+ width: 100%;
264
+ box-sizing: border-box;
265
+ // ADV-88: a divider above the externalised consumption/CO2 line on EVERY card surface
266
+ // it appears on (landing / main = home+CDP-comparable / search / favorite). The element
267
+ // only renders for new plug-in hybrids, so the line shows exactly for the task's cars;
268
+ // it spans the full row width where the row is full-width (mobile + main/landing), and
269
+ // the info-column width on the desktop search/favorite layout. Sets the line apart from
270
+ // the spec/price/"Zum Angebot" block above it.
271
+ border-top: 1px solid rgba(76, 78, 100, 0.12);
272
+ // a few px of space ABOVE the divider so the line doesn't hug the price/"Zum Angebot" block.
273
+ margin-top: 6px;
274
+ padding: 6px 10px 2px 10px;
275
+ font-size: 9px;
276
+ line-height: 1.4;
277
+ color: rgba(76, 78, 100, 0.87);
278
+ word-break: break-word;
279
+
280
+ span
281
+ font-size: 9px !important;
282
+ line-height: 1.4 !important;
283
+
219
284
  .wrapAlternativeData
220
285
  display flex
221
286
  font-size: 12px;