@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,12 @@
1
+ @import '../../theme/theme.styl';
2
+
3
+ .wrapper
4
+ display: flex
5
+ align-items: flex-start
6
+
7
+ .item
8
+ max-width: 280px
9
+ margin: 10px
10
+
11
+ .accentClassName
12
+ background-color: $grey-f2
@@ -0,0 +1,273 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { action } from '@storybook/addon-actions';
4
+ import DropDown from './../_common/DropDown/DropDown';
5
+ import { FiltersFactory } from './FiltersFactory';
6
+ import FilterBlock from './common/FilterBlock/FilterBlock';
7
+ import { DAMAGED_OPTIONS, DOORS, OWNERS_OPTIONS, STATE_OPTIONS } from '../../framework/constants/Search';
8
+ import {
9
+ BODY_TYPES,
10
+ DRIVE_TYPES,
11
+ EMISSION_CLASS,
12
+ EMISSION_STICKERS,
13
+ EXTERIOR_COLORS,
14
+ FUEL_TYPES, HIGHLIGHTS_TYPES, INTERIOR_COLORS, INTERIOR_TYPES, TRANSMISSION_TYPES
15
+ } from '../../framework/constants/selectors';
16
+ import { FIRST_REGISTRATION_HISTOGRAM, MILEAGE_HISTOGRAM, POWER_HISTOGRAM, PRICE_HISTOGRAM } from '../../framework/data';
17
+ import { MMS_GROUPS } from '../../framework/constants/filters';
18
+
19
+ const t = (phrase, options = {}) => {
20
+ const dictionary = {
21
+ 'filters.rateTitle': 'Price/Rate',
22
+ 'filters.price': 'Price',
23
+ 'filters.rate': 'Rate',
24
+ 'rateSearchWidget.changeRateLink': 'open',
25
+ 'rateSearchWidget.any': 'any',
26
+ 'rateSearchWidget.defaultValue': 'any, 60 Months',
27
+ 'rateSearchWidget.monthsValue': 'Months Value',
28
+ };
29
+ return dictionary[phrase];
30
+ };
31
+
32
+ const HIGHLIGHTS = {
33
+ aggregation: {},
34
+ values: [],
35
+ options: HIGHLIGHTS_TYPES
36
+ };
37
+
38
+ const FILTERS = {
39
+ CONSUMPTION: {
40
+ values: { from: 1, to: 18 },
41
+ options: [{ from: 1, to: 18 }],
42
+ onChange: action('change consumption'),
43
+ t: () => ''
44
+ },
45
+ DAMAGED: {
46
+ values: '',
47
+ options: DAMAGED_OPTIONS,
48
+ onChange: action('change damaged'),
49
+ t: () => ''
50
+ },
51
+ DOORS: {
52
+ values: '',
53
+ options: DOORS,
54
+ onChange: action('change seats'),
55
+ t: () => ''
56
+ },
57
+ DRIVE_TYPE: {
58
+ aggregation: {},
59
+ values: [],
60
+ options: DRIVE_TYPES,
61
+ onChange: action('change drive type'),
62
+ t: () => ''
63
+ },
64
+ EMISSION_CLASS: {
65
+ values: '',
66
+ options: EMISSION_CLASS,
67
+ onChange: action('change emission class'),
68
+ t: () => ''
69
+ },
70
+ EMISSION_STICKER: {
71
+ value: '',
72
+ options: EMISSION_STICKERS,
73
+ onChange: action('change emission sticker'),
74
+ t: () => ''
75
+ },
76
+ EXTERIOR_COLOR: {
77
+ name: 'EXTERIOR_COLOR',
78
+ values: [],
79
+ options: EXTERIOR_COLORS,
80
+ onChange: action('change exterior color'),
81
+ t: () => ''
82
+ },
83
+ FIRST_REGISTRATION: {
84
+ name: 'FIRST_REGISTRATION',
85
+ values: { from: 1970, to: 2019 },
86
+ controls: { from: '', to: '' },
87
+ options: FIRST_REGISTRATION_HISTOGRAM,
88
+ onChange: action('change first registration'),
89
+ onChangeControls: action('change first registration'),
90
+ t: () => ''
91
+ },
92
+ FUEL: {
93
+ aggregation: {},
94
+ values: [],
95
+ options: FUEL_TYPES,
96
+ onChange: action('change fuel'),
97
+ t: () => ''
98
+ },
99
+ HIGHLIGHTS: {
100
+ HIGHLIGHTS: HIGHLIGHTS,
101
+ onFilterChange: action('change highlights'),
102
+ t: () => ''
103
+ },
104
+ INTERIOR_COLOR: {
105
+ name: 'INTERIOR_COLOR',
106
+ values: [],
107
+ options: INTERIOR_COLORS,
108
+ onChange: action('change interior color'),
109
+ t: () => ''
110
+ },
111
+ INTERIOR_TYPE: {
112
+ aggregation: {},
113
+ values: [],
114
+ options: INTERIOR_TYPES,
115
+ onChange: action('change interior material'),
116
+ t: () => ''
117
+ },
118
+ MAKE_MODEL: {
119
+ MMS_GROUPS,
120
+ BODY_TYPE: {
121
+ options: BODY_TYPES,
122
+ values: []
123
+ },
124
+ onAddMmsGroup: () => { },
125
+ onRemoveMmsGroup: (index) => { },
126
+ onChange: (field, value, index, isSeries) => { },
127
+ t: () => { }
128
+ },
129
+ MILEAGE: {
130
+ name: 'MILEAGE',
131
+ values: { from: 0, to: 150000 },
132
+ controls: { from: '', to: '' },
133
+ options: MILEAGE_HISTOGRAM,
134
+ onChange: action('change mileage'),
135
+ onChangeControls: action('change mileage'),
136
+ t: () => ''
137
+ },
138
+ OWNERS: {
139
+ value: '',
140
+ options: OWNERS_OPTIONS,
141
+ onChange: action('change owner'),
142
+ t: () => ''
143
+ },
144
+ POWER: {
145
+ name: 'POWER',
146
+ values: { from: 0, to: 600 },
147
+ controls: { from: '', to: '' },
148
+ options: POWER_HISTOGRAM,
149
+ onChange: action('change power'),
150
+ onChangeControls: action('change power'),
151
+ t: () => ''
152
+ },
153
+ COST: {
154
+ COST_TYPE: {
155
+ options: ['price', 'rate'],
156
+ values: 'rate'
157
+ },
158
+ PRICE: {
159
+ options: PRICE_HISTOGRAM,
160
+ values: { from: 0, to: 90000 },
161
+ controls: { from: '', to: '' }
162
+ },
163
+ RATE: {
164
+ values: { monthlyInstallmentFrom: 'any', monthlyInstallmentTo: 'any', firstInstallment: 0, paybackPeriod: 60 }
165
+ },
166
+ onChange: action('change'),
167
+ onChangeControls: action('change'),
168
+ getRateSearchPrice: (value) => ({ from: 1000, to: 5000 }),
169
+ t
170
+ },
171
+ PRICE: {
172
+ name: 'PRICE',
173
+ values: { from: 0, to: 90000 },
174
+ controls: { from: '', to: '' },
175
+ options: PRICE_HISTOGRAM,
176
+ onChange: action('change price'),
177
+ onChangeControls: action('change price'),
178
+ t: () => ''
179
+ },
180
+ RATE: {
181
+ values: { monthlyInstallmentFrom: 'any', monthlyInstallmentTo: 'any', firstInstallment: 0, paybackPeriod: 60 },
182
+ isRateWidgetOpened: false,
183
+ onRateWidgetOpen: action('widget open'),
184
+ onRateWidgetClose: action('widget close'),
185
+ onRateChange: action('change rate'),
186
+ t
187
+ },
188
+ SEATS: {
189
+ values: { from: 1, to: 12 },
190
+ options: [{ from: 1, to: 12 }],
191
+ onChange: action('change seats'),
192
+ t: () => ''
193
+ },
194
+ STATE_OPTIONS: {
195
+ fieldValues: [],
196
+ fieldOptions: STATE_OPTIONS,
197
+ onChange: action('change state'),
198
+ t: () => ''
199
+ },
200
+ TRANSMISSION: {
201
+ aggregation: {},
202
+ values: [],
203
+ options: TRANSMISSION_TYPES,
204
+ onChange: action('change transmission type'),
205
+ t: () => ''
206
+ }
207
+ };
208
+
209
+ const containerStyles = {
210
+ width: '280px'
211
+ };
212
+
213
+ const filterStyles = {
214
+ marginTop: '20px',
215
+ paddingTop: '20px',
216
+ borderTop: '1px solid #005CCB'
217
+ };
218
+
219
+ // Stateful container for testing interaction
220
+ class FiltersContainer extends React.Component {
221
+ constructor(props) {
222
+ super(props);
223
+
224
+ this.state = {
225
+ activeFilter: 'CONSUMPTION'
226
+ }
227
+ }
228
+
229
+ changeActiveFilter = (filter) => {
230
+ this.setState(() => ({
231
+ activeFilter: filter.value
232
+ }));
233
+ };
234
+
235
+ getOptions = (options) => options.map((option) => ({
236
+ value: option,
237
+ label: option
238
+ }));
239
+
240
+ render() {
241
+ const { activeFilter } = this.state;
242
+
243
+ const filterProps = FILTERS[activeFilter];
244
+ const filters = Object.keys(FILTERS);
245
+ const component = FiltersFactory[activeFilter](filterProps);
246
+
247
+ const ddProps = {
248
+ options: this.getOptions(filters),
249
+ onChange: this.changeActiveFilter
250
+ };
251
+
252
+ return (
253
+ <div>
254
+ <DropDown {...ddProps} />
255
+ <div style={filterStyles}>
256
+ <FilterBlock expand={true}>
257
+ {component}
258
+ </FilterBlock>
259
+ </div>
260
+ </div>
261
+ )
262
+
263
+ }
264
+ }
265
+
266
+ storiesOf('FiltersFactory', module)
267
+ .add('All available filters', () => (
268
+ <div style={containerStyles}>
269
+ <FiltersContainer />
270
+ </div>
271
+ ));
272
+
273
+
@@ -0,0 +1,12 @@
1
+ // import React from 'react';
2
+ // import { Resizable } from 're-resizable';
3
+ // import { storiesOf } from '@storybook/react';
4
+ // import { action } from '@storybook/addon-actions';
5
+
6
+ // import VehicleSmallCardForDealerships from './VehicleSmallCardForDealerships.tsx';
7
+ // import styles from './VehicleSmallCardForDealerships.story.styl';
8
+
9
+ // storiesOf('MakeModel', module)
10
+ // .add('MakeModel', () => (
11
+ // <MakeModelStory />
12
+ // ));