@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
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+
3
+ import { storiesOf } from '@storybook/react';
4
+ import Tooltip from './Tooltip';
5
+
6
+
7
+ const description = {
8
+ financing: `Bei der Finanzierung zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil. Zum Vertragsende können Sie entscheiden, ob Sie den Restbetrag ablösen oder weiter finanzieren wollen.`,
9
+ leasing: `Beim Leasing zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil. Zum Vertragsende geben Sie das Auto einfach wieder zurück.`,
10
+ abo: `Bei diesem Auto-Abo ist bereits alles an Bord. Teil-und Vollkasko sowie Haftpflicht sind inklusive, ebenso wie Wartungs- und Verschleißreparaturen. Sie zahlen also nur Ihre Rate und Kraftstoff.`,
11
+ kaufen: `Nach Kaufabschluss haben Sie die sofortigen Eigentumsrechte und keine Finanzierungskosten. Als Eigentümer können Sie Ihr Fahrzeug zueigenen Konditionen weiter verkaufen und Änderungen vornehmen.`,
12
+ };
13
+
14
+ storiesOf('_Common_UI', module).add('Tooltip', () => (
15
+ <div>
16
+ <Tooltip description={description.financing} />
17
+ <br />
18
+ <Tooltip description={description.leasing} positionX='left' />
19
+ <br />
20
+ <Tooltip description={description.abo} positionX='center' />
21
+ <br />
22
+ <Tooltip description={description.kaufen} positionY='top' positionX='right' />
23
+ <br />
24
+ <Tooltip description={description.kaufen} positionY='top' positionX='center' />
25
+ <br />
26
+ <Tooltip description={description.kaufen} positionY='top' positionX='left' />
27
+ </div>
28
+ ));
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+
3
+ import { storiesOf } from '@storybook/react';
4
+ import MaterialMenu from './MaterialMenu';
5
+
6
+ const superAdmin = false;
7
+
8
+ const userMenuItems = [
9
+ {
10
+ icon: 'dashboardIcon',
11
+ label: 'Dashboard'
12
+ },
13
+ {
14
+ icon: 'userProfileIcon',
15
+ label: 'Profile'
16
+ },
17
+ {
18
+ icon: 'addressIcon',
19
+ label: 'Address'
20
+ },
21
+ {
22
+ icon: 'myVehiclesIcon',
23
+ label: 'My Vehicles'
24
+ },
25
+ {
26
+ icon: 'savedSearchsIcon',
27
+ label: 'Saved searchs'
28
+ },
29
+ {
30
+ icon: 'favoritesIcon',
31
+ label: 'Favorites',
32
+ amount: 0
33
+ },
34
+ !superAdmin && {
35
+ icon: 'dealersIcon',
36
+ label: 'Dealers',
37
+ amount: 1234,
38
+ divider: true,
39
+ nestedItems: [
40
+ {
41
+ icon: 'supportCallbackIcon',
42
+ label: 'Support & Call back',
43
+ divider: true,
44
+ },
45
+ {
46
+ icon: 'supportCallbackIcon',
47
+ label: 'Support & Call back',
48
+ divider: true,
49
+ },
50
+ {
51
+ icon: 'supportCallbackIcon',
52
+ label: 'Support & Call back',
53
+ divider: true,
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ icon: 'imageSettingsIcon',
59
+ label: 'Image Settings'
60
+ },
61
+ !superAdmin && {
62
+ icon: 'supportCallbackIcon',
63
+ label: 'Support & Call back',
64
+ divider: true
65
+ },
66
+ {
67
+ icon: 'logoutIcon',
68
+ label: 'Logout'
69
+ },
70
+
71
+ ];
72
+
73
+ storiesOf('_Common_UI', module).add('UserMenu', () => <MaterialMenu menuItems={userMenuItems} headerComponent='Firstname Lastname' />);
@@ -0,0 +1,99 @@
1
+ import React from 'react';
2
+ import styles from './VehicleSlider.story.styl'
3
+ import { storiesOf } from '@storybook/react';
4
+
5
+ import VehicleSlider from './VehicleSlider.tsx';
6
+ import VehicleSliderForSRL from './VehicleSliderForSRL.tsx';
7
+
8
+ import withStats from '../withStats/withStats.tsx';
9
+ import withLabel from '../withLabel/withLabel.tsx';
10
+
11
+ import { COLUMN_STYLES, CONTAINER_STYLES, ROW_STYLES } from '../../../framework/constants';
12
+
13
+ const IMAGE_URL = 'https://picsum.photos/400/300/?random';
14
+ const images = [];
15
+ const imagesForSRL = [];
16
+
17
+ for (let i = 0; i <= 10; i++) {
18
+ images.push({ url: `${IMAGE_URL}&tag=${Math.random()}`, description: '' });
19
+ }
20
+
21
+ for (let i = 0; i <= 10; i++) {
22
+ imagesForSRL.push({ imageUrlSmall: `${IMAGE_URL}&tag=${Math.random()}` });
23
+ }
24
+
25
+ const DecoratedSlider = withLabel(withStats(VehicleSlider));
26
+ const DecoratedSliderForSRL = withLabel(withStats(VehicleSliderForSRL));
27
+
28
+ export class ImageWithStatsContainer extends React.Component {
29
+ state = {
30
+ isFavoured: false
31
+ };
32
+
33
+ onFavoriteClick = () => {
34
+ this.setState({ isFavoured: !this.state.isFavoured })
35
+ };
36
+
37
+ render() {
38
+ const statsProps = {
39
+ isFavoured: this.state.isFavoured,
40
+ imagesCount: images.length,
41
+ statsData: {
42
+ totalCarImpCount: 15,
43
+ totalFavCount: 20
44
+ },
45
+ statsSize: 'xs',
46
+ onFavoriteClick: this.onFavoriteClick,
47
+ };
48
+
49
+ const sliderProps = {
50
+ images,
51
+ wrapperClassName: styles.slider
52
+ };
53
+
54
+ const sliderSRLProps = {
55
+ images: imagesForSRL,
56
+ wrapperClassName: styles.slider
57
+ };
58
+
59
+ return (
60
+ <div style={CONTAINER_STYLES}>
61
+ <div style={COLUMN_STYLES}>
62
+ <div style={ROW_STYLES}>
63
+ <div className={styles.row}>
64
+ <div className={styles.col}>
65
+ <h2 className={styles.title}>{'Slider props: { isLarge: true }'}</h2>
66
+ <div className={styles.row}>
67
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
68
+ <VehicleSlider images={images} wrapperClassName={styles.slider} size='lg' />
69
+ </div>
70
+ </div>
71
+ </div>
72
+ <div className={styles.col}>
73
+ <h2 className={styles.title}>Slider with Stats</h2>
74
+ <div className={styles.row}>
75
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
76
+ <DecoratedSlider {...statsProps} {...sliderProps} />
77
+ </div>
78
+ </div>
79
+ </div>
80
+ <div className={styles.col}>
81
+ <h2 className={styles.title}>Slider with Stats for SRL</h2>
82
+ <div className={styles.row}>
83
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
84
+ <DecoratedSliderForSRL {...statsProps} {...sliderSRLProps} />
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ );
93
+ }
94
+ }
95
+
96
+ storiesOf('_Common_UI', module)
97
+ .add('VehicleSlider', () => (
98
+ <ImageWithStatsContainer />
99
+ ));
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import styles from '../Image/Image.story.styl'
3
+ import { storiesOf } from '@storybook/react';
4
+
5
+ import Image from '../Image/Image.tsx';
6
+ import withLabel from './withLabel.tsx'
7
+ import withStats from '../withStats/withStats.tsx'
8
+ import { COLUMN_STYLES, CONTAINER_STYLES, ROW_STYLES } from '../../../framework/constants';
9
+
10
+ const SRC_HORIZONTAL = 'https://placekitten.com/400/300';
11
+
12
+ const ImageWithLabel = withLabel(Image);
13
+ const DecoratedImage = withLabel(withStats(Image));
14
+
15
+ export class ImageWithLabelContainer extends React.Component {
16
+ state = {
17
+ isFavoured: false
18
+ };
19
+
20
+ onFavoriteClick = () => {
21
+ this.setState({ isFavoured: !this.state.isFavoured })
22
+ };
23
+
24
+ render() {
25
+ const statsProps = {
26
+ isFavoured: this.state.isFavoured,
27
+ imagesCount: 10,
28
+ statsData: {
29
+ totalCarImpCount: 15,
30
+ totalFavCount: 20
31
+ },
32
+ statsSize: 'xs',
33
+ onFavoriteClick: this.onFavoriteClick
34
+ };
35
+
36
+ return (
37
+ <div className={styles.row}>
38
+ <div className={styles.col}>
39
+ <h2 className={styles.title}>XS Size</h2>
40
+ <div className={styles.row}>
41
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
42
+ <ImageWithLabel labelVisible={true} src={SRC_HORIZONTAL} width='100%' ratioW={4} ratioH={3} />
43
+ </div>
44
+ </div>
45
+ </div>
46
+ <div className={styles.col}>
47
+ <h2 className={styles.title}>MD Size</h2>
48
+ <div className={styles.row}>
49
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
50
+ <DecoratedImage src={SRC_HORIZONTAL} width='100%' ratioW={4} ratioH={3} {...statsProps} />
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ );
56
+ }
57
+ }
58
+
59
+ storiesOf('_Common_UI', module)
60
+ .add('withLabel', () => (
61
+ <ImageWithLabelContainer />
62
+ ));
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import { storiesOf } from '@storybook/react';
4
+ import withPopover from './withPopover';
5
+ import styles from './withPopover.story.styl'
6
+
7
+ const Target = ({ isPopoverShown, text }) => {
8
+ const className = classnames(styles.target, { [styles.targetOpen]: isPopoverShown });
9
+ return <div className={className}>{text}</div>;
10
+ };
11
+
12
+ const Popover = ({ isPopoverShown, text }) => {
13
+ const className = classnames(styles.popover, { [styles.popoverOpen]: isPopoverShown });
14
+ return <div className={className}>{text}</div>;
15
+ };
16
+
17
+ const TargetWithPopover = withPopover(Target, Popover);
18
+
19
+ export class WithPopoverContainer extends React.Component {
20
+ state = {
21
+ type: 'click'
22
+ };
23
+
24
+ onCheckboxChange = () => {
25
+ this.setState({ type: this.state.type === 'click' ? 'hover' : 'click' });
26
+ };
27
+
28
+ render() {
29
+ const targetWithPopoverProps = {
30
+ targetProps: { text: 'Target' },
31
+ popoverProps: { text: 'Popover' },
32
+ type: this.state.type
33
+ };
34
+
35
+ return (
36
+ <React.Fragment>
37
+ <label className={styles.label}>
38
+ <input type='checkbox' value={this.state.showOnHover} onChange={this.onCheckboxChange} />
39
+ <span>Open on hover</span>
40
+ </label>
41
+ <TargetWithPopover {...targetWithPopoverProps} />
42
+ </React.Fragment>
43
+ );
44
+ }
45
+ }
46
+
47
+ storiesOf('_Common_UI', module)
48
+ .add('withPopover', () => <WithPopoverContainer />);
@@ -0,0 +1,54 @@
1
+ @import '../../../theme/theme.styl'
2
+
3
+ .label
4
+ display: block
5
+ font-family: $font-style-arial
6
+ margin-bottom: 20px
7
+
8
+ .target
9
+ position: relative
10
+ font-family: $font-style-arial
11
+ width: 150px
12
+ height: 30px
13
+ line-height: 30px
14
+ text-align: center
15
+ border 1px solid $grey-b
16
+ border-radius: 3px
17
+ transition: all 0.2s ease-in-out
18
+ cursor: pointer
19
+ &:hover
20
+ background-color: $grey-f2
21
+
22
+ .targetOpen
23
+ color: $primary
24
+ font-weight: bold
25
+ border-color: $primary
26
+ &:after
27
+ content: ''
28
+ position: absolute
29
+ display: block
30
+ width: 100%
31
+ height: 15px
32
+
33
+ .popover
34
+ position: relative
35
+ box-sizing: border-box
36
+ color: white
37
+ font-size: 25px
38
+ font-weight: bold
39
+ border 3px solid $yellow-f1
40
+ position: absolute
41
+ top: 45px
42
+ width: 250px
43
+ height: 100px
44
+ line-height: 100px
45
+ text-align: center
46
+ border-radius: 3px
47
+ background-color: $grassGreen
48
+ visibility: hidden
49
+ opacity: 0
50
+ transition: all 0.2s ease-in-out
51
+
52
+ .popoverOpen
53
+ visibility: visible
54
+ opacity: 1
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import styles from '../Image/Image.story.styl'
3
+
4
+ import { storiesOf } from '@storybook/react';
5
+
6
+ import Image from '../Image/Image.tsx';
7
+ import withStats from './withStats.tsx'
8
+ import { COLUMN_STYLES, CONTAINER_STYLES, ROW_STYLES } from '../../../framework/constants';
9
+
10
+ const SRC_HORIZONTAL = 'https://placekitten.com/400/300';
11
+
12
+ const ImageWithStats = withStats(Image);
13
+
14
+ export class ImageWithStatsContainer extends React.Component {
15
+ state = {
16
+ isFavoured: false
17
+ };
18
+
19
+ onFavoriteClick = () => {
20
+ this.setState({ isFavoured: !this.state.isFavoured })
21
+ };
22
+
23
+ render() {
24
+ const basicProps = {
25
+ isFavoured: this.state.isFavoured,
26
+ imagesCount: 10,
27
+ statsData: {
28
+ totalCarImpCount: 15,
29
+ totalFavCount: 20
30
+ },
31
+ statsSize: 'xs',
32
+ showNewLabel: true,
33
+ price: {
34
+ historyPriceDifference: 500,
35
+ historyPriceDifferencePerCent: 25
36
+ },
37
+ onFavoriteClick: this.onFavoriteClick
38
+ };
39
+
40
+ const xsProps = { ...basicProps, ...{ statsSize: 'xs' } };
41
+ const mdProps = { ...basicProps, ...{ statsSize: 'md', price: { historyPriceDifference: 499, historyPriceDifferencePerCent: 25 } } };
42
+
43
+ return (
44
+ <div style={CONTAINER_STYLES}>
45
+ <div style={COLUMN_STYLES}>
46
+ <div style={ROW_STYLES}>
47
+ <div className={styles.row}>
48
+ <div className={styles.col}>
49
+ <h2 className={styles.title}>XS Size</h2>
50
+ <div className={styles.row}>
51
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
52
+ <ImageWithStats src={SRC_HORIZONTAL} width='100%' ratioW={4} ratioH={3} {...xsProps} />
53
+ </div>
54
+ </div>
55
+ </div>
56
+ <div className={styles.col}>
57
+ <h2 className={styles.title}>MD Size ({'price difference < 500'})</h2>
58
+ <div className={styles.row}>
59
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
60
+ <ImageWithStats src={SRC_HORIZONTAL} width='100%' ratioW={4} ratioH={3} {...mdProps} />
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ );
69
+ }
70
+ }
71
+
72
+ storiesOf('_Common_UI', module)
73
+ .add('withStats', () => (
74
+ <ImageWithStatsContainer />
75
+ ));
@@ -161,7 +161,7 @@ const withStats = (WrappedComponent: any) => ({
161
161
  </Badge>
162
162
  )}
163
163
  {showDownPayment && (
164
- <Badge type='lightBlue' className={styles.badgeItem}>
164
+ <Badge type='blue' className={styles.badgeItem}>
165
165
  <span className={styles.badgeFull}>{downPaymentText}</span>
166
166
  <span className={styles.badgeShort}>{downPaymentShortText}</span>
167
167
  </Badge>
@@ -69,6 +69,7 @@ export const transformDataForDecoratedCar = (car: any) => {
69
69
  bootCapacity: _get(car, 'sizeVolumeWeight.cargoCapacity', null),
70
70
  capacityLoad: _get(car, 'sizeVolumeWeight.completeCapacity', null),
71
71
  wltpCo2: _get(car, 'environmentEmissions.wltpCo2', null),
72
+ wltpEnergyEfficiencyClass: _get(car, 'environmentEmissions.wltpEnergyEfficiencyClass', null),
72
73
  pluginHybrid: _get(car, 'engineData.pluginHybrid', null),
73
74
  wltpCombined: _get(car, 'consumption.wltpCombined', null),
74
75
  wltpPowerCombined: _get(car, 'consumption.wltpPowerCombined', null),
@@ -1,8 +1,12 @@
1
- export const SITE_DOMAIN: string = 'https://www.auto.de';
1
+ const _rawHost = typeof window !== 'undefined' ? window.location.host.replace('www.', '') : 'auto.de';
2
+ const _isIP = /^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(_rawHost);
3
+ const _imgBase = _isIP ? 'https://images.auto.de' : 'https://images.' + _rawHost;
2
4
 
3
- export const PLACEHOLDER_IMAGE: string = 'https://images.auto.de/noimage/';
4
- export const PLACEHOLDER_IMAGE_SMALL_URL: string = `https://images.auto.de/noimage/noimage/small`;
5
- export const PLACEHOLDER_IMAGE_LARGE_URL: string = `https://images.auto.de/noimage/noimage/large`;
5
+ export const SITE_DOMAIN: string = typeof window !== 'undefined' ? 'https://' + window.location.host : 'https://www.auto.de';
6
+
7
+ export const PLACEHOLDER_IMAGE: string = _imgBase + '/noimage/';
8
+ export const PLACEHOLDER_IMAGE_SMALL_URL: string = _imgBase + '/noimage/small';
9
+ export const PLACEHOLDER_IMAGE_LARGE_URL: string = _imgBase + '/noimage/large';
6
10
 
7
11
  export const QUOTES_SLIDES_TO_SHOW_DEFAULT = 3;
8
12
 
@@ -115,6 +115,7 @@ export interface IVehicleInfo {
115
115
  url?: string;
116
116
  target?: string;
117
117
  rel?: string;
118
+ leasing?: ILeasing;
118
119
  }
119
120
 
120
121
  export interface IVehicleTitleProps {