@bytebrand/fe-ui-core 4.8.48 → 4.8.50

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 (189) 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 +3 -5
  49. package/source/components/AccordionWidget/AccordionWidget.styl +1 -0
  50. package/source/components/AccordionWidget/AccordionWidget.tsx +8 -4
  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/OfferPanel.story.js +139 -0
  74. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.js +35 -0
  75. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.styl +3 -0
  76. package/source/components/PriceRating/PriceRating.story.js +39 -0
  77. package/source/components/PriceRating/PriceRating.story.styl +2 -0
  78. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.js +78 -0
  79. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.styl +11 -0
  80. package/source/components/RateSearchValue/RateSearchValue.story.js +78 -0
  81. package/source/components/RateSearchValue/RateSearchValue.story.styl +2 -0
  82. package/source/components/RateSearchWidget/RateSearchWidget.story.js +57 -0
  83. package/source/components/RateSearchWidget/RateSearchWidget.story.styl +12 -0
  84. package/source/components/SearchFilters/FiltersFactory.story.js +273 -0
  85. package/source/components/SearchPage/Filters/MakeModel/MakeModel.story.js +12 -0
  86. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.js +834 -0
  87. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.styl +40 -0
  88. package/source/components/SearchWidget/SearchWidget.story.js +191 -0
  89. package/source/components/SearchWidget/SearchWidget.story.styl +6 -0
  90. package/source/components/Stepper/Stepper.story.js +119 -0
  91. package/source/components/Stepper/Stepper.story.styl +41 -0
  92. package/source/components/Theme.story.js +36 -0
  93. package/source/components/Theme.story.styl +85 -0
  94. package/source/components/TickerText/TickerText.story.js +17 -0
  95. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.story.js +95 -0
  96. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.story.js +97 -0
  97. package/source/components/Vehicle/VehicleConsumption/VehicleConsumption.story.js +31 -0
  98. package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.story.js +247 -0
  99. package/source/components/VehicleCompared/CompareGeneral/CompareGeneral.story.js +30 -0
  100. package/source/components/VehicleCompared/ComparePrice/ComparePrice.story.js +18 -0
  101. package/source/components/VehicleCompared/CompareTitle/CompareTitle.story.js +19 -0
  102. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.story.js +44 -0
  103. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +23 -11
  104. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
  105. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +1 -0
  106. package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +48 -45
  107. package/source/components/VehiclePromoSlider/VehiclePromoInfo/VehiclePromoInfo.story.js +42 -0
  108. package/source/components/VehiclePromoSlider/VehiclePromoSlide/VehiclePromoSlide.story.js +62 -0
  109. package/source/components/VehiclePromoSlider/VehiclePromoSlider.story.js +42 -0
  110. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.styl +5 -0
  111. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +3 -1
  112. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +1 -1
  113. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +24 -11
  114. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
  115. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.styl +4 -1
  116. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.tsx +3 -2
  117. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -1
  118. package/source/components/VehicleSmallCard/VehicleSmallCard.story.js +412 -0
  119. package/source/components/VehicleSmallCard/VehicleSmallCard.story.styl +56 -0
  120. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +14 -3
  121. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js +199 -0
  122. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl +40 -0
  123. package/source/components/_common/Accordion/Accordion.story.js +36 -0
  124. package/source/components/_common/Badge/Badge.story.js +27 -0
  125. package/source/components/_common/Badge/Badge.story.styl +5 -0
  126. package/source/components/_common/Bubble/Bubble.story.js +52 -0
  127. package/source/components/_common/Button/Button.story.js +52 -0
  128. package/source/components/_common/Button/Button.story.styl +5 -0
  129. package/source/components/_common/ButtonOld/Button.story.js +54 -0
  130. package/source/components/_common/ButtonOld/Button.story.styl +5 -0
  131. package/source/components/_common/Checkbox/Checkbox.story.js +85 -0
  132. package/source/components/_common/Checkbox/Checkbox.story.styl +14 -0
  133. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.js +126 -0
  134. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.styl +14 -0
  135. package/source/components/_common/Chip/Chip.story.js +43 -0
  136. package/source/components/_common/ChipList/ChipList.story.js +36 -0
  137. package/source/components/_common/DropDown/DropDown.story.js +35 -0
  138. package/source/components/_common/ExpandablePanel/ExpandablePanel.story.js +41 -0
  139. package/source/components/_common/Histogram/Histogram.story.js +51 -0
  140. package/source/components/_common/IconSVG/IconSVG.story.js +21 -0
  141. package/source/components/_common/IconSVG/IconSVG.story.styl +25 -0
  142. package/source/components/_common/Image/Image.story.js +142 -0
  143. package/source/components/_common/Image/Image.story.styl +18 -0
  144. package/source/components/_common/ImagesSet/ImagesSet.story.js +34 -0
  145. package/source/components/_common/ImagesSet/ImagesSet.story.styl +4 -0
  146. package/source/components/_common/Loader/Loader.story.js +21 -0
  147. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.story.js +49 -0
  148. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.styled.tsx +4 -1
  149. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.js +45 -0
  150. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.styl +6 -0
  151. package/source/components/_common/MaterialField/MaterialField.story.js +87 -0
  152. package/source/components/_common/MaterialField/MaterialField.story.styl +34 -0
  153. package/source/components/_common/MaterialSelect/MaterialSelect.story.js +52 -0
  154. package/source/components/_common/MaterialSelect/MaterialSelect.story.styl +6 -0
  155. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.js +47 -0
  156. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.styl +6 -0
  157. package/source/components/_common/MaterialSwitch/MaterialSwitch.story.js +17 -0
  158. package/source/components/_common/MaterialTooltip/MaterialTooltip.story.js +10 -0
  159. package/source/components/_common/Modal/Modal.story.js +37 -0
  160. package/source/components/_common/MuiGroupedSelect/MuiGroupedSelect.story.js +21 -0
  161. package/source/components/_common/PropertySelector/PSGroup.story.js +93 -0
  162. package/source/components/_common/PropertySelector/PSGroup.story.styl +25 -0
  163. package/source/components/_common/PropertySelector/ProperySelector.story.js +83 -0
  164. package/source/components/_common/Radio/FormRadioGroup.story.js +28 -0
  165. package/source/components/_common/Radio/FormRadioGroup.story.styl +2 -0
  166. package/source/components/_common/Radio/Radio.story.js +54 -0
  167. package/source/components/_common/Radio/RadioGroup.story.js +90 -0
  168. package/source/components/_common/Radio/RadioGroup.story.styl +39 -0
  169. package/source/components/_common/Range/Range.story.js +46 -0
  170. package/source/components/_common/Range/Range.story.styl +5 -0
  171. package/source/components/_common/SliderArrow/SliderArrow.story.js +18 -0
  172. package/source/components/_common/Tabs/Tabs.story.js +56 -0
  173. package/source/components/_common/TimePicker/TimePicker.story.js +37 -0
  174. package/source/components/_common/Tooltip/Tooltip.story.js +28 -0
  175. package/source/components/_common/UserMenu/MaterialMenu.story.js +73 -0
  176. package/source/components/_common/VehicleSlider/VehicleSlider.story.js +99 -0
  177. package/source/components/_common/VehicleSlider/VehicleSlider.story.styl +0 -0
  178. package/source/components/_common/withLabel/withLabel.story.js +62 -0
  179. package/source/components/_common/withPopover/withPopover.story.js +48 -0
  180. package/source/components/_common/withPopover/withPopover.story.styl +54 -0
  181. package/source/components/_common/withStats/withStats.story.js +75 -0
  182. package/source/components/_common/withStats/withStats.tsx +1 -1
  183. package/source/framework/DataTransformers.ts +1 -0
  184. package/source/framework/constants/common.ts +8 -4
  185. package/source/framework/types/types.ts +1 -0
  186. package/source/framework/vehiclesProps/decoratedLightProps.tsx +48 -12
  187. package/source/framework/vehiclesProps/decoratedProps.tsx +35 -8
  188. package/source/locales/data.ts +3 -0
  189. package/bytebrand-fe-ui-core-4.8.47.tgz +0 -0
@@ -1,45 +1,48 @@
1
- import * as React from 'react';
2
- import FormattedNumber from '../../FormattedNumber/FormattedNumber';
3
- import Badge from '../../_common/Badge/Badge';
4
-
5
- import styles from './PriceData.styl';
6
-
7
- interface IProps {
8
- t: (phrase: string, config?: any) => string;
9
- showNewLabel: boolean;
10
- historyPriceDifference: number;
11
- historyPriceDifferencePerCent: number;
12
- activeTab?: number;
13
- showDownPayment: boolean;
14
- financingFirstInstallment?: number | null;
15
- leasingFirstInstallment?: number | null;
16
- }
17
-
18
- const MIN_PERCENT = 5;
19
- const MIN_PRICE_DIFFERENCE = 500;
20
- const EUR = `\u20AC`;
21
-
22
- const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, activeTab, financingFirstInstallment, leasingFirstInstallment }) => {
23
- const relevantFirstInstallment = activeTab === 0 ? financingFirstInstallment : activeTab === 1 ? leasingFirstInstallment : null;
24
- const showZeroDownPayment = showDownPayment && relevantFirstInstallment === 0;
25
- return (
26
- <div className={styles.topWrapper}>
27
- {showNewLabel && <Badge type='blue' className={styles.new}>{t('slider.new')}</Badge>}
28
- {!!historyPriceDifference && historyPriceDifference >= MIN_PRICE_DIFFERENCE && (
29
- <Badge type='green' className={styles.priceDifference}>
30
- <FormattedNumber value={historyPriceDifference} numbersAfterDot={0}/>
31
- {` ${EUR} ${t('slider.save')}`}
32
- </Badge>
33
- )}
34
- {showZeroDownPayment &&
35
- <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`0${EUR} ${t('slider.firstInstallment')}`}</Badge>}
36
- {historyPriceDifferencePerCent >= MIN_PERCENT && (
37
- <Badge type='red' className={styles.priceDifferencePerCent}>
38
- -{historyPriceDifferencePerCent}%
39
- </Badge>
40
- )}
41
- </div>
42
- );
43
- };
44
-
45
- export default PriceData;
1
+ import * as React from 'react';
2
+ import FormattedNumber from '../../FormattedNumber/FormattedNumber';
3
+ import Badge from '../../_common/Badge/Badge';
4
+
5
+ import styles from './PriceData.styl';
6
+
7
+ interface IProps {
8
+ t: (phrase: string, config?: any) => string;
9
+ showNewLabel: boolean;
10
+ historyPriceDifference: number;
11
+ historyPriceDifferencePerCent: number;
12
+ financingConfig?: any;
13
+ activeTab?: number;
14
+ showDownPayment: boolean;
15
+ financingFirstInstallment?: number | null;
16
+ leasingFirstInstallment?: number | null;
17
+ }
18
+
19
+ const MIN_PERCENT = 5;
20
+ const MIN_PRICE_DIFFERENCE = 500;
21
+ const EUR = `€`;
22
+
23
+ const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, activeTab, financingFirstInstallment, leasingFirstInstallment }) => {
24
+ const showDownPaymentBadge = showDownPayment && (
25
+ (activeTab === 0 && financingFirstInstallment === 0) ||
26
+ (activeTab === 1 && leasingFirstInstallment === 0)
27
+ );
28
+ return (
29
+ <div className={styles.topWrapper}>
30
+ {showNewLabel && <Badge type='blue' className={styles.new}>{t('slider.new')}</Badge>}
31
+ {!!historyPriceDifference && historyPriceDifference >= MIN_PRICE_DIFFERENCE && (
32
+ <Badge type='green' className={styles.priceDifference}>
33
+ <FormattedNumber value={historyPriceDifference} numbersAfterDot={0}/>
34
+ {` ${EUR} ${t('slider.save')}`}
35
+ </Badge>
36
+ )}
37
+ {showDownPaymentBadge &&
38
+ <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`0${EUR} ${t('slider.firstInstallment')}`}</Badge>}
39
+ {historyPriceDifferencePerCent >= MIN_PERCENT && (
40
+ <Badge type='red' className={styles.priceDifferencePerCent}>
41
+ -{historyPriceDifferencePerCent}%
42
+ </Badge>
43
+ )}
44
+ </div>
45
+ );
46
+ };
47
+
48
+ export default PriceData;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { action } from '@storybook/addon-actions';
4
+
5
+ import VehiclePromoInfo from './VehiclePromoInfo';
6
+
7
+ // Stateful container for testing interaction
8
+ class VehiclePromoInfoContainer extends React.Component {
9
+ render() {
10
+ const { t } = this.props;
11
+
12
+ const props = {
13
+ t: key => key,
14
+ price: {
15
+ wasPrice: 18660,
16
+ currentSalesPrice: 18440,
17
+ historyPriceDifferencePerCent: 2,
18
+ purchasePrice: 0,
19
+ vatRate: 19
20
+ },
21
+ consumption: { consumptionCombined: 6.1 },
22
+ environmentEmissions: { co2: 159 },
23
+ monthlyInstallment: 269.8,
24
+ oldMonthlyInstallment: 259.8,
25
+ onButtonClick: action('offer button click'),
26
+ onFinancingDetailsClick: action('financing button click')
27
+ };
28
+
29
+ return (
30
+ <div style={{ marginTop: 100 }}>
31
+ <VehiclePromoInfo {...props} />
32
+ </div>
33
+ );
34
+ }
35
+ }
36
+
37
+ storiesOf('VehiclePromoInfo', module)
38
+ .add('Default', () => (
39
+ <div>
40
+ <VehiclePromoInfoContainer />
41
+ </div>
42
+ ));
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { action } from '@storybook/addon-actions';
4
+
5
+ import VehiclePromoSlide from './VehiclePromoSlide';
6
+
7
+ // Stateful container for testing interaction
8
+ class VehiclePromoSlideContainer extends React.Component {
9
+ render() {
10
+ const { t } = this.props;
11
+
12
+ const props = {
13
+ t: key => key,
14
+ _id: 'e18efa30-a4d2-48d7-b0d7-d1701731af2a',
15
+ title: 'BMW 114',
16
+ showNewLabel: true,
17
+ vehicleLink:
18
+ '',
19
+ src:
20
+ 'https://images.auto.de/carimage/858c5bae-12d2-4180-ad01-6576c2160dc0/WF-8oH7LX-iw/medium-transparent',
21
+ environmentEmissions:
22
+ { energyEfficiencyClass: 'energyEff',
23
+ co2: 115,
24
+ emissionClass: 'emissionClass',
25
+ emissionSticker: 'emissionSticker' },
26
+ consumption:
27
+ { consumptionUnit: 'unit',
28
+ fuel: 'petrol',
29
+ consumptionCombined: 4.9 },
30
+ price:
31
+ { currency: 'EUR',
32
+ wasPrice: 14789,
33
+ currentSalesPrice: 100000,
34
+ vatRate: 19,
35
+ recomendedRetailPrice: 120000,
36
+ retailToCurrentPriceDifference: -20000,
37
+ historyPriceDifferencePerCent: 17,
38
+ historyPriceDifference: 20000,
39
+ mlCurrentSalesPricePredicted: 98000,
40
+ mlCurrentSalesPriceDiffPercent: 2.0408163265306145 },
41
+ monthlyInstallment: 714.69,
42
+ oldMonthlyInstallment: 1082.29,
43
+ bubblesColor: '#fd5a1c',
44
+ bubbleContent: 'Super Angebot!',
45
+ onButtonClick: action('offer button click'),
46
+ onFinancingDetailsClick: action('financing button click')
47
+ };
48
+
49
+ return (
50
+ <div style={{ marginTop: 100 }}>
51
+ <VehiclePromoSlide {...props} />
52
+ </div>
53
+ );
54
+ }
55
+ }
56
+
57
+ storiesOf('VehiclePromoSlide', module)
58
+ .add('Default', () => (
59
+ <div>
60
+ <VehiclePromoSlideContainer />
61
+ </div>
62
+ ));
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { action } from '@storybook/addon-actions';
4
+
5
+ import cars from './cars'; // fake data from top api request
6
+
7
+ import VehiclePromoSlider from './VehiclePromoSlider';
8
+
9
+ const defaultSliderStateProps = {
10
+ t: key => key,
11
+ cars
12
+ };
13
+
14
+ const withHandlersSliderStateProps = {
15
+ t: key => key,
16
+ cars,
17
+ onButtonClick: action('offer button click'),
18
+ onFinancingDetailsClick: action('financing button click')
19
+ };
20
+
21
+ // Stateful container for testing interaction
22
+ class VehiclePromoSliderContainer extends React.Component {
23
+ render() {
24
+ return (
25
+ <div style={{ marginTop: 100 }}>
26
+ <VehiclePromoSlider {...this.props} />
27
+ </div>
28
+ );
29
+ }
30
+ }
31
+
32
+ storiesOf('VehiclePromoSlider', module)
33
+ .add('Default', () => (
34
+ <div style={{ width: '90vw', height: '75vh' }}>
35
+ <VehiclePromoSliderContainer {...defaultSliderStateProps} />
36
+ </div>
37
+ ))
38
+ .add('With Handlers', () => (
39
+ <div style={{ width: '90vw', height: '75vh' }}>
40
+ <VehiclePromoSliderContainer {...withHandlersSliderStateProps} />
41
+ </div>
42
+ ));
@@ -70,6 +70,11 @@
70
70
  +media-tablet-landscape-up()
71
71
  font-size: 9px;
72
72
 
73
+ &.priceItemCategoryLanding,
74
+ &.priceItemCategoryMain
75
+ +media-tablet-landscape-up()
76
+ font-size: 10px;
77
+
73
78
  & > span:hover
74
79
  background: rgba(196, 196, 196, 0.6);
75
80
 
@@ -88,7 +88,9 @@ class VehiclePriceItem extends React.Component<IVehiclePriceItemProps> {
88
88
  const priceItemCategoryClassName = classnames(
89
89
  styles.priceItemCategory,
90
90
  { [styles.priceItemCategorySearch]: vehicleComponentName === 'search' || vehicleComponentName === 'myVehicles' },
91
- { [styles.priceItemCategoryComparable]: vehicleComponentName === 'comparable' || vehicleComponentName === 'landing' || vehicleComponentName === 'main' }
91
+ { [styles.priceItemCategoryComparable]: vehicleComponentName === 'comparable' },
92
+ { [styles.priceItemCategoryLanding]: vehicleComponentName === 'landing' },
93
+ { [styles.priceItemCategoryMain]: vehicleComponentName === 'main' }
92
94
  );
93
95
 
94
96
  return (
@@ -12,7 +12,7 @@
12
12
  grid-area: info;
13
13
 
14
14
  & > .consumptionCombined
15
- font-size: 10px
15
+ font-size: 9px
16
16
 
17
17
  +media-tablet-landscape-down()
18
18
  padding: 0 10px;
@@ -1,6 +1,7 @@
1
1
  /* tslint:disable */
2
2
  import * as React from 'react';
3
3
  import classnames from 'classnames';
4
+ import _get from 'lodash/get';
4
5
  import styles from './VehicleInfo.styl';
5
6
  import PriceRating from '../../../PriceRating/PriceRating';
6
7
  import { Visible, Hidden } from 'react-grid-system';
@@ -43,7 +44,8 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
43
44
  consumption,
44
45
  location,
45
46
  offer,
46
- engineData
47
+ engineData,
48
+ leasing
47
49
  } = props;
48
50
  const firstRegistrationDate = regDate && regDate !== 0 ? regDate : 'N/A';
49
51
 
@@ -65,7 +67,8 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
65
67
  },
66
68
  environmentEmissions: {
67
69
  co2: environmentEmissions.co2,
68
- wltpCo2: environmentEmissions.wltpCo2
70
+ wltpCo2: environmentEmissions.wltpCo2,
71
+ wltpEnergyEfficiencyClass: environmentEmissions.wltpEnergyEfficiencyClass
69
72
  },
70
73
  consumption: {
71
74
  fuel: consumption.fuel,
@@ -80,14 +83,19 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
80
83
 
81
84
  const decoratedProps = getDecoratedProps(dataDecoratedProps, t, language);
82
85
  const renderProperty = (renderProperties: any, vehicleComponentName?: any) => {
83
- const mainPropertiesList = renderProperties(dataDecoratedProps.consumption.fuel, combineRefAlternative).map((prop: string) => ({
84
- icon: decoratedProps[prop].icon,
85
- description: decoratedProps[prop].value,
86
- className: styles[decoratedProps[prop].name],
87
- classNameIcon: (vehicleComponentName === 'search' || 'myVehicles' || 'favorite' || 'recently') && styles.carIconSearch,
88
- smalltext: (decoratedProps[prop].name === 'consumptionCombined') && (vehicleComponentName !== 'search'),
89
- hybridPlugin: engineData.hybridPlugin && decoratedProps[prop].name === 'consumptionCombined' && vehicleComponentName !== 'search'
90
- }));
86
+ const mainPropertiesList = renderProperties(dataDecoratedProps.consumption.fuel, combineRefAlternative).map((prop: string) => {
87
+ const isConsumption = decoratedProps[prop].name === 'consumptionCombined';
88
+ // On non-SRL cards drop the fuel-pump icon next to the consumption row to free up space for the CO2-class line.
89
+ const hideConsumptionIcon = isConsumption && vehicleComponentName !== 'search';
90
+ return {
91
+ icon: hideConsumptionIcon ? '' : decoratedProps[prop].icon,
92
+ description: decoratedProps[prop].value,
93
+ className: styles[decoratedProps[prop].name],
94
+ classNameIcon: (vehicleComponentName === 'search' || 'myVehicles' || 'favorite' || 'recently') && styles.carIconSearch,
95
+ smalltext: isConsumption && (vehicleComponentName !== 'search'),
96
+ hybridPlugin: engineData.hybridPlugin && isConsumption && vehicleComponentName !== 'search'
97
+ };
98
+ });
91
99
 
92
100
  return mainPropertiesList.map((property: any, index: number) => (
93
101
  <VehicleProperty {...property} key={index} />
@@ -149,7 +157,12 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
149
157
  ),
150
158
  ...routeObj,
151
159
  className: wrapClasses,
152
- onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
160
+ onClick: () => localStorage.setItem(
161
+ 'activeTabCDP',
162
+ _get(leasing, 'isActive', false)
163
+ ? t('vehicleProps:title.leasing')
164
+ : t('vehicleProps:title.financing')
165
+ ),
153
166
  href: url,
154
167
  target,
155
168
  rel
@@ -62,8 +62,9 @@
62
62
  font-size: 12px;
63
63
  height: 42px;
64
64
 
65
- &.vehiclePriceTitleLanding
66
- font-size: 11px;
65
+ &.vehiclePriceTitleLanding,
66
+ &.vehiclePriceTitleMain
67
+ font-size: 10px;
67
68
  height: 38px;
68
69
 
69
70
  .addOfferButton
@@ -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 => {