@bytebrand/fe-ui-core 4.8.54 → 4.8.56

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 (194) 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 +117 -120
  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/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/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
  109. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +2 -0
  110. package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +7 -4
  111. package/source/components/VehiclePromoSlider/VehiclePromoInfo/VehiclePromoInfo.story.js +42 -0
  112. package/source/components/VehiclePromoSlider/VehiclePromoSlide/VehiclePromoSlide.story.js +62 -0
  113. package/source/components/VehiclePromoSlider/VehiclePromoSlider.story.js +42 -0
  114. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.styl +5 -0
  115. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +3 -1
  116. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +1 -1
  117. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +24 -11
  118. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
  119. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.styl +4 -1
  120. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.tsx +3 -2
  121. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -1
  122. package/source/components/VehicleSmallCard/VehicleSmallCard.story.js +412 -0
  123. package/source/components/VehicleSmallCard/VehicleSmallCard.story.styl +56 -0
  124. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +14 -3
  125. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js +199 -0
  126. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl +40 -0
  127. package/source/components/_common/Accordion/Accordion.story.js +36 -0
  128. package/source/components/_common/Badge/Badge.story.js +27 -0
  129. package/source/components/_common/Badge/Badge.story.styl +5 -0
  130. package/source/components/_common/Bubble/Bubble.story.js +52 -0
  131. package/source/components/_common/Button/Button.story.js +52 -0
  132. package/source/components/_common/Button/Button.story.styl +5 -0
  133. package/source/components/_common/ButtonOld/Button.story.js +54 -0
  134. package/source/components/_common/ButtonOld/Button.story.styl +5 -0
  135. package/source/components/_common/Checkbox/Checkbox.story.js +85 -0
  136. package/source/components/_common/Checkbox/Checkbox.story.styl +14 -0
  137. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.js +126 -0
  138. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.styl +14 -0
  139. package/source/components/_common/Chip/Chip.story.js +43 -0
  140. package/source/components/_common/ChipList/ChipList.story.js +36 -0
  141. package/source/components/_common/DropDown/DropDown.story.js +35 -0
  142. package/source/components/_common/ExpandablePanel/ExpandablePanel.story.js +41 -0
  143. package/source/components/_common/Histogram/Histogram.story.js +51 -0
  144. package/source/components/_common/IconSVG/IconSVG.story.js +21 -0
  145. package/source/components/_common/IconSVG/IconSVG.story.styl +25 -0
  146. package/source/components/_common/Image/Image.story.js +142 -0
  147. package/source/components/_common/Image/Image.story.styl +18 -0
  148. package/source/components/_common/ImagesSet/ImagesSet.story.js +34 -0
  149. package/source/components/_common/ImagesSet/ImagesSet.story.styl +4 -0
  150. package/source/components/_common/Loader/Loader.story.js +21 -0
  151. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.story.js +49 -0
  152. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.styled.tsx +4 -1
  153. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.js +45 -0
  154. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.styl +6 -0
  155. package/source/components/_common/MaterialField/MaterialField.story.js +87 -0
  156. package/source/components/_common/MaterialField/MaterialField.story.styl +34 -0
  157. package/source/components/_common/MaterialSelect/MaterialSelect.story.js +52 -0
  158. package/source/components/_common/MaterialSelect/MaterialSelect.story.styl +6 -0
  159. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.js +47 -0
  160. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.styl +6 -0
  161. package/source/components/_common/MaterialSwitch/MaterialSwitch.story.js +17 -0
  162. package/source/components/_common/MaterialTooltip/MaterialTooltip.story.js +10 -0
  163. package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +4 -3
  164. package/source/components/_common/Modal/Modal.story.js +37 -0
  165. package/source/components/_common/MuiGroupedSelect/MuiGroupedSelect.story.js +21 -0
  166. package/source/components/_common/PropertySelector/PSGroup.story.js +93 -0
  167. package/source/components/_common/PropertySelector/PSGroup.story.styl +25 -0
  168. package/source/components/_common/PropertySelector/ProperySelector.story.js +83 -0
  169. package/source/components/_common/Radio/FormRadioGroup.story.js +28 -0
  170. package/source/components/_common/Radio/FormRadioGroup.story.styl +2 -0
  171. package/source/components/_common/Radio/Radio.story.js +54 -0
  172. package/source/components/_common/Radio/RadioGroup.story.js +90 -0
  173. package/source/components/_common/Radio/RadioGroup.story.styl +39 -0
  174. package/source/components/_common/Range/Range.story.js +46 -0
  175. package/source/components/_common/Range/Range.story.styl +5 -0
  176. package/source/components/_common/SliderArrow/SliderArrow.story.js +18 -0
  177. package/source/components/_common/Tabs/Tabs.story.js +56 -0
  178. package/source/components/_common/TimePicker/TimePicker.story.js +37 -0
  179. package/source/components/_common/Tooltip/Tooltip.story.js +28 -0
  180. package/source/components/_common/UserMenu/MaterialMenu.story.js +73 -0
  181. package/source/components/_common/VehicleSlider/VehicleSlider.story.js +99 -0
  182. package/source/components/_common/VehicleSlider/VehicleSlider.story.styl +0 -0
  183. package/source/components/_common/withLabel/withLabel.story.js +62 -0
  184. package/source/components/_common/withPopover/withPopover.story.js +48 -0
  185. package/source/components/_common/withPopover/withPopover.story.styl +54 -0
  186. package/source/components/_common/withStats/withStats.story.js +75 -0
  187. package/source/components/_common/withStats/withStats.styl +10 -0
  188. package/source/components/_common/withStats/withStats.tsx +2 -11
  189. package/source/framework/DataTransformers.ts +1 -0
  190. package/source/framework/constants/common.ts +8 -4
  191. package/source/framework/types/types.ts +1 -0
  192. package/source/framework/vehiclesProps/decoratedLightProps.tsx +48 -12
  193. package/source/framework/vehiclesProps/decoratedProps.tsx +35 -8
  194. package/source/locales/data.ts +3 -0
@@ -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);
@@ -12,6 +12,7 @@ import VehicleTitle from './VehicleData/VehicleTitle/VehicleTitle';
12
12
  import SeoText from './SeoText/SeoText';
13
13
  import VehicleInfo from './VehicleData/VehicleInfo/VehicleInfo';
14
14
  import VehiclePrice from './VehicleData/VehiclePrice/VehiclePrice';
15
+ import { PLACEHOLDER_IMAGE_SMALL_URL } from '../../framework/constants/common';
15
16
  import {
16
17
  IVehicleInfo,
17
18
  IPrice,
@@ -281,7 +282,12 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
281
282
  target,
282
283
  rel,
283
284
  className: `${styles.redirectClassLink} ${styles.gridAreaTitle}`,
284
- onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
285
+ onClick: () => localStorage.setItem(
286
+ 'activeTabCDP',
287
+ _get(price, 'leasing.isActive', false)
288
+ ? t('vehicleProps:title.leasing')
289
+ : t('vehicleProps:title.financing')
290
+ ),
285
291
  href: url
286
292
  })}
287
293
 
@@ -334,7 +340,12 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
334
340
  target,
335
341
  rel,
336
342
  className: `${styles.redirectClassLink} ${styles.gridAreaImage}`,
337
- onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
343
+ onClick: () => localStorage.setItem(
344
+ 'activeTabCDP',
345
+ _get(price, 'leasing.isActive', false)
346
+ ? t('vehicleProps:title.leasing')
347
+ : t('vehicleProps:title.financing')
348
+ ),
338
349
  href: url
339
350
  })}
340
351
  <VehicleInfo {...vehicleInfoProps} />
@@ -366,7 +377,7 @@ VehicleSmallCard.defaultProps = {
366
377
  baseUrl: '',
367
378
  typeAlternative: '',
368
379
  offerSource: '',
369
- src: 'https://images.auto.de/noimage/small',
380
+ src: PLACEHOLDER_IMAGE_SMALL_URL,
370
381
  environmentEmissions: null,
371
382
  language: 'en',
372
383
  consumption: null,
@@ -0,0 +1,199 @@
1
+ import React from 'react';
2
+ import i18next from 'i18next';
3
+ import { Resizable } from 're-resizable';
4
+ // import * as CheckboxTree from 'react-checkbox-tree';
5
+ import { withNamespaces } from 'react-i18next';
6
+ import { storiesOf } from '@storybook/react';
7
+ import { action } from '@storybook/addon-actions';
8
+
9
+ import VehicleSmallCardForDealerships from './VehicleSmallCardForDealerships.tsx';
10
+ import styles from './VehicleSmallCardForDealerships.story.styl';
11
+
12
+
13
+ i18next.addResourceBundle('de', 'vehicleProps', {
14
+ value: {
15
+ mileage: "{{mileage}} km",
16
+ consumption: "{{consumption}}l/100km",
17
+ consumptionPower: "{{consumption}}kWh/100km",
18
+ consumptionPowerCombined: "{{consumption}}kWh/100km (komb)*",
19
+ consumptionGas: "{{consumption}}kg/100km",
20
+ consumptionCombined: "{{consumption}}l/100km",
21
+ power: "{{powerKW}}\u00A0kW ({{powerPS}}\u00A0PS)",
22
+ powerPS: "{{powerPS}} PS",
23
+ deliveryPeriodMonths: "{{count}} Monat\nab Bestellung",
24
+ deliveryPeriodDays: "{{count}} Tag\nab Bestellung",
25
+ co2Combined: "{{co2}}g CO2/km (komb)*",
26
+ co2: "{{co2}} g/km ",
27
+ na: "N/A"
28
+ },
29
+ priceRating: {
30
+ noRating: 'KEINE BEWERTUNG',
31
+ highPrice: 'HOHER PREIS',
32
+ increasedPrice: 'ERHÖHTER PREIS',
33
+ fairPrice: 'FAIRER PREIS',
34
+ goodPrice: 'GUTER PREIS',
35
+ topPrice: 'TOP PREIS'
36
+ },
37
+ promoSlider: {
38
+ consumptionCombined: `{{consumptionCombined}} l/100km (komb)*`,
39
+ co2: `{{co2}} g CO2/km (komb)*`,
40
+ new: 'neu'
41
+ },
42
+ title: {
43
+ addOfferToMainSlide: 'Zum Schieberegler hinzufügen',
44
+ toOffer: 'zum Angebot',
45
+ monthlyFrom: 'monatlich ab',
46
+ financing: 'Finanzierung',
47
+ leasing: 'Leasing',
48
+ abo: 'Abo',
49
+ buy: 'Kaufen',
50
+ financingDescription: `Bei der Finanzierung zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil.
51
+ Zum Vertragsende können Sie entscheiden, ob Sie den Restbetrag ablösen oder weiter finanzieren wollen.`,
52
+ leasingDescription: `Beim Leasing zahlen Sie lediglich die Zinsen des Darlehens und einen geringen
53
+ Tilgungsanteil. Zum Vertragsende geben Sie das Auto einfach wieder zurück.`,
54
+ aboDescription: `Bei diesem Auto-Abo ist bereits alles an Bord. Teil- und
55
+ Vollkasko sowie Haftpflicht sind inklusive, ebenso wie Wartungs- und Verschleißreparaturen.
56
+ Sie zahlen also nur Ihre Rate und Kraftstoff.`,
57
+ buyDescription: `Nach Kaufabschluss haben Sie die sofortigen
58
+ Eigentumsrechte und keine Finanzierungskosten. Als Eigentümer können Sie Ihr Fahrzeug zu
59
+ eigenen Konditionen weiter verkaufen und Änderungen vornehmen.`
60
+ }
61
+ });
62
+
63
+ const resizableProps = {
64
+ minWidth: 150,
65
+ defaultSize: { width: 360, height: 'auto' }
66
+ };
67
+
68
+ const IMAGE_URL = 'https://picsum.photos/400/300/?random';
69
+ const images = [];
70
+ for (let i = 0; i <= 10; i++) {
71
+ images.push({ url: `${IMAGE_URL}&tag=${Math.random()}`, description: '' });
72
+ }
73
+
74
+ const VehicleSmallCardStory = withNamespaces('vehicleProps')(({ t }) => {
75
+ const dealershipsProps = {
76
+ language: 'de',
77
+ vehicleComponentName: 'landing',
78
+ showSlider: true,
79
+ showNewLabel: true,
80
+ src: 'http://placehold.jp/400x300.png?text=mainImage',
81
+ stats: {
82
+ imagesCount: 100,
83
+ isFavoured: true,
84
+ statsData: {
85
+ totalCarImpCount: 10,
86
+ totalFavCount: 20,
87
+ },
88
+ statsSize: 'xs'
89
+ },
90
+ title: {
91
+ make: 'Audi',
92
+ model: 'A4',
93
+ subModel: 'Shooting Brake',
94
+ },
95
+ info: {
96
+ mileage: 10464,
97
+ regDate: 1535760000,
98
+ gearbox: 'selector_gearbox_automatic'
99
+ },
100
+ environmentEmissions: {
101
+ co2: 8.7
102
+ },
103
+ consumption: {
104
+ consumptionCombined: 9.6,
105
+ consumptionPowerCombined: null,
106
+ fuel: 'selector_fuel_hybridElectricalDiesel'
107
+ },
108
+ engineData: {
109
+ cubicCapacity: 1968,
110
+ cylinders: 0,
111
+ particulateFilterDiesel: true,
112
+ powerKW: 140,
113
+ powerPS: 190,
114
+ startStopSystem: true,
115
+ },
116
+ offer : {
117
+ availabilityFrom: null,
118
+ availabilityMode: "selector_availabilityMode_always",
119
+ deliveryPeriod: "selector_unknown"
120
+ },
121
+ price: {
122
+ monthlyInstallment: 29,
123
+ oldMonthlyInstallment: 49,
124
+ isStrikeShown: true,
125
+ currency: "EUR",
126
+ currentSalesPrice: 16160,
127
+ historyPriceDifference: 5629.6,
128
+ historyPriceDifferencePerCent: 26,
129
+ mlCurrentSalesPriceCategory: null,
130
+ mlCurrentSalesPriceDiffPercent: null,
131
+ mlCurrentSalesPricePredicted: 100,
132
+ totalCurrent: 50,
133
+ originalSalesPrice: 13467,
134
+ priceDate: null,
135
+ priceId: null,
136
+ recomendedRetailPrice: null,
137
+ retailToCurrentPriceDifference: 0,
138
+ vatDeductible: null,
139
+ vatRate: 7,
140
+ wasPrice: 10000,
141
+ financing: {
142
+ annualPercentageRate: "",
143
+ bank: "",
144
+ closingCosts: null,
145
+ conditions: null,
146
+ finalInstallment: null,
147
+ financingBank: "",
148
+ firstInstallment: 0,
149
+ grossLoanAmount: "",
150
+ monthlyInstallment: 108,
151
+ netLoanAmount: "",
152
+ nominalInterestRate: "",
153
+ paybackPeriod: "24",
154
+ paymentProtectionInsurance: "",
155
+ platformFinancingId: null,
156
+ transportationCosts: "",
157
+ typeOfNominalInterestRate: null
158
+ },
159
+ leasing: {
160
+ RWG: 10,
161
+ addServicesCost: 799,
162
+ annualMileage: null,
163
+ closingCosts: null,
164
+ financialInstitution: null,
165
+ firstInstallment: null,
166
+ leasingMode: "default",
167
+ maxAge: null,
168
+ maxMileage: null,
169
+ nominalInterestRate: null,
170
+ paybackPeriod: null,
171
+ paymentProtectionInsurance: null,
172
+ purchasePrice: null,
173
+ santanderPayBackMin: 250,
174
+ transportationCost: null
175
+ },
176
+ buy: {
177
+ currentSalesPriceExtra: 16110,
178
+ highestPriceExtra: 19349
179
+ }
180
+ },
181
+ 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',
182
+ onFinancingClick: action('financing click'),
183
+ onContainerClick: action('container click'),
184
+ onFavoriteClick: action('favorite click'),
185
+ };
186
+
187
+ return (
188
+ <>
189
+ <div className={styles.wrapper}>
190
+ <Resizable {...resizableProps}>
191
+ <VehicleSmallCardForDealerships {...dealershipsProps} />
192
+ </Resizable>
193
+ </div>
194
+ </>
195
+ );
196
+
197
+ });
198
+
199
+ storiesOf('VehicleSmallCardForDealerships', module).add('VehicleSmallCardForDealerships', () => <VehicleSmallCardStory />);