@bytebrand/fe-ui-core 4.8.54 → 4.8.55
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.
- package/.husky/pre-push +4 -0
- package/.storybook/addons.js +4 -0
- package/.storybook/config.js +64 -0
- package/.storybook/postcss.config.js +6 -0
- package/.storybook/preview-head.html +10 -0
- package/.storybook/webpack.config.js +130 -0
- package/__tests__/components/Checkout/OrderOverviewItem/OrderOverviewItem.test.tsx +42 -0
- package/__tests__/components/Checkout/PaymentTypeCard/PaymentTypeCard.test.tsx +50 -0
- package/__tests__/components/Checkout/RadioGroup.test.tsx +95 -0
- package/__tests__/components/Checkout/ServiceCardWrapper.test.tsx +53 -0
- package/__tests__/components/Checkout/Switcher.test.tsx +43 -0
- package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +613 -0
- package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +335 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/AdditionalOrderInfo.test.tsx +127 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCar.test.tsx +58 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCard.test.tsx +74 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusSection.test.tsx +62 -0
- package/__tests__/components/UserDasboardPage/sections/RequestedCarsSection/RequestedCarsSection.test.tsx +117 -0
- package/__tests__/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.test.tsx +58 -0
- package/__tests__/components/VehicleSmallCard/VehicleInfo.test.tsx +88 -0
- package/__tests__/components/VehicleSmallCard/VehicleTitle.test.tsx +91 -0
- package/__tests__/components/_common/Badge/Badge.test.tsx +15 -0
- package/__tests__/components/_common/IconSVG/IconSVG.test.tsx +23 -0
- package/__tests__/components/_common/Image/Image.test.tsx +82 -0
- package/__tests__/components/_common/MaterialAutocomplete/MaterialAutocomplete.test.tsx +49 -0
- package/__tests__/components/_common/MaterialDatePicker/MaterialDatePicker.test.tsx +54 -0
- package/__tests__/components/_common/MaterialField/MaterialField.test.tsx +58 -0
- package/__tests__/components/_common/StarButton/StarButton.test.tsx +46 -0
- package/__tests__/mockedData/financingConfig.js +202 -0
- package/__tests__/mockedData/mockedPendingRequestedCar.js +69 -0
- package/__tests__/utils/CommonUtils/addPrefixToKeys.test.ts +18 -0
- package/__tests__/utils/CommonUtils/arrToObj.test.js +32 -0
- package/__tests__/utils/CommonUtils/checkRangeValuesOnEqual.test.ts +17 -0
- package/__tests__/utils/CommonUtils/fixNumber.test.ts +20 -0
- package/__tests__/utils/CommonUtils/formatMileage.test.ts +8 -0
- package/__tests__/utils/CommonUtils/getChipFilterValue.test.ts +22 -0
- package/__tests__/utils/CommonUtils/getFormattedNumber.test.ts +19 -0
- package/__tests__/utils/CommonUtils/getFormattedPrice.test.ts +19 -0
- package/__tests__/utils/CommonUtils/getGroupValuesForQuery.test.ts +51 -0
- package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +64 -0
- package/__tests__/utils/CommonUtils/getPriceRating.test.ts +26 -0
- package/__tests__/utils/CommonUtils/getPriceRatingConfig.test.ts +33 -0
- package/__tests__/utils/CommonUtils/preloadNearbyImages.test.ts +9 -0
- package/__tests__/utils/CommonUtils/sliceLessThan.test.ts +23 -0
- package/__tests__/utils/CommonUtils/sliceMoreThan.test.ts +23 -0
- package/media/locales/de/promoSlider.json +1 -0
- package/media/locales/en/promoSlider.json +1 -0
- package/package.json +117 -120
- package/source/components/AccordionWidget/AccordionWidget.styl +1 -0
- package/source/components/AccordionWidget/AccordionWidget.tsx +8 -4
- package/source/components/AdvantageItem/AdvantageItem.story.js +23 -0
- package/source/components/Alternative/Dealer.story.js +32 -0
- package/source/components/Alternative/Dealer.story.styl +3 -0
- package/source/components/Breadcrumbs/Breadcrumbs.story.js +40 -0
- package/source/components/Breadcrumbs/FirstInfoBlock/FirstInfoBlock.story.js +45 -0
- package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.js +243 -0
- package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.styl +21 -0
- package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.js +105 -0
- package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.styl +37 -0
- package/source/components/Checkout/Switcher/Switcher.story.js +41 -0
- package/source/components/Checkout/Switcher/Switcher.story.styl +2 -0
- package/source/components/CompactSearchWidget/CompactSearchWidget.story.js +187 -0
- package/source/components/ContactForm/ContactForm.story.js +94 -0
- package/source/components/ContactForm/ContactForm.story.styl +0 -0
- package/source/components/ContactInfo/ContactInfo.story.js +58 -0
- package/source/components/CustomerQuote/CustomerQuote.story.js +41 -0
- package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.js +73 -0
- package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.styl +5 -0
- package/source/components/FormattedNumber/FormattedNumber.story.js +114 -0
- package/source/components/InfoBlocks/InfoBlockWrapper.story.js +101 -0
- package/source/components/InfoBlocks/InfoBlockWrapper.story.styl +46 -0
- package/source/components/OfferPanel/AboAccordion/AboFaq/AboFaq.story.js +97 -0
- package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +2 -2
- package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.styl +24 -0
- package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +0 -1
- package/source/components/OfferPanel/OfferPanel.story.js +139 -0
- package/source/components/OfferPanel/OfferPanel.tsx +1 -1
- package/source/components/OfferPanel/RangeGroup/RangeGroup.story.js +35 -0
- package/source/components/OfferPanel/RangeGroup/RangeGroup.story.styl +3 -0
- package/source/components/PriceRating/PriceRating.story.js +39 -0
- package/source/components/PriceRating/PriceRating.story.styl +2 -0
- package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.js +78 -0
- package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.styl +11 -0
- package/source/components/RateSearchValue/RateSearchValue.story.js +78 -0
- package/source/components/RateSearchValue/RateSearchValue.story.styl +2 -0
- package/source/components/RateSearchWidget/RateSearchWidget.story.js +57 -0
- package/source/components/RateSearchWidget/RateSearchWidget.story.styl +12 -0
- package/source/components/SearchFilters/FiltersFactory.story.js +273 -0
- package/source/components/SearchPage/Filters/MakeModel/MakeModel.story.js +12 -0
- package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.js +834 -0
- package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.styl +40 -0
- package/source/components/SearchWidget/SearchWidget.story.js +191 -0
- package/source/components/SearchWidget/SearchWidget.story.styl +6 -0
- package/source/components/Stepper/Stepper.story.js +119 -0
- package/source/components/Stepper/Stepper.story.styl +41 -0
- package/source/components/Theme.story.js +36 -0
- package/source/components/Theme.story.styl +85 -0
- package/source/components/TickerText/TickerText.story.js +17 -0
- package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.story.js +95 -0
- package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.story.js +97 -0
- package/source/components/Vehicle/VehicleConsumption/VehicleConsumption.story.js +31 -0
- package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.story.js +247 -0
- package/source/components/VehicleCompared/CompareGeneral/CompareGeneral.story.js +30 -0
- package/source/components/VehicleCompared/ComparePrice/ComparePrice.story.js +18 -0
- package/source/components/VehicleCompared/CompareTitle/CompareTitle.story.js +19 -0
- package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.story.js +44 -0
- package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +23 -11
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +2 -0
- package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +7 -4
- package/source/components/VehiclePromoSlider/VehiclePromoInfo/VehiclePromoInfo.story.js +42 -0
- package/source/components/VehiclePromoSlider/VehiclePromoSlide/VehiclePromoSlide.story.js +62 -0
- package/source/components/VehiclePromoSlider/VehiclePromoSlider.story.js +42 -0
- package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.styl +5 -0
- package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +3 -1
- package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +1 -1
- package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +24 -11
- package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
- package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.styl +4 -1
- package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.tsx +3 -2
- package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -1
- package/source/components/VehicleSmallCard/VehicleSmallCard.story.js +412 -0
- package/source/components/VehicleSmallCard/VehicleSmallCard.story.styl +56 -0
- package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +14 -3
- package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js +199 -0
- package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl +40 -0
- package/source/components/_common/Accordion/Accordion.story.js +36 -0
- package/source/components/_common/Badge/Badge.story.js +27 -0
- package/source/components/_common/Badge/Badge.story.styl +5 -0
- package/source/components/_common/Bubble/Bubble.story.js +52 -0
- package/source/components/_common/Button/Button.story.js +52 -0
- package/source/components/_common/Button/Button.story.styl +5 -0
- package/source/components/_common/ButtonOld/Button.story.js +54 -0
- package/source/components/_common/ButtonOld/Button.story.styl +5 -0
- package/source/components/_common/Checkbox/Checkbox.story.js +85 -0
- package/source/components/_common/Checkbox/Checkbox.story.styl +14 -0
- package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.js +126 -0
- package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.styl +14 -0
- package/source/components/_common/Chip/Chip.story.js +43 -0
- package/source/components/_common/ChipList/ChipList.story.js +36 -0
- package/source/components/_common/DropDown/DropDown.story.js +35 -0
- package/source/components/_common/ExpandablePanel/ExpandablePanel.story.js +41 -0
- package/source/components/_common/Histogram/Histogram.story.js +51 -0
- package/source/components/_common/IconSVG/IconSVG.story.js +21 -0
- package/source/components/_common/IconSVG/IconSVG.story.styl +25 -0
- package/source/components/_common/Image/Image.story.js +142 -0
- package/source/components/_common/Image/Image.story.styl +18 -0
- package/source/components/_common/ImagesSet/ImagesSet.story.js +34 -0
- package/source/components/_common/ImagesSet/ImagesSet.story.styl +4 -0
- package/source/components/_common/Loader/Loader.story.js +21 -0
- package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.story.js +49 -0
- package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.styled.tsx +4 -1
- package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.js +45 -0
- package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.styl +6 -0
- package/source/components/_common/MaterialField/MaterialField.story.js +87 -0
- package/source/components/_common/MaterialField/MaterialField.story.styl +34 -0
- package/source/components/_common/MaterialSelect/MaterialSelect.story.js +52 -0
- package/source/components/_common/MaterialSelect/MaterialSelect.story.styl +6 -0
- package/source/components/_common/MaterialStepButton/MaterialStepButton.story.js +47 -0
- package/source/components/_common/MaterialStepButton/MaterialStepButton.story.styl +6 -0
- package/source/components/_common/MaterialSwitch/MaterialSwitch.story.js +17 -0
- package/source/components/_common/MaterialTooltip/MaterialTooltip.story.js +10 -0
- package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +4 -3
- package/source/components/_common/Modal/Modal.story.js +37 -0
- package/source/components/_common/MuiGroupedSelect/MuiGroupedSelect.story.js +21 -0
- package/source/components/_common/PropertySelector/PSGroup.story.js +93 -0
- package/source/components/_common/PropertySelector/PSGroup.story.styl +25 -0
- package/source/components/_common/PropertySelector/ProperySelector.story.js +83 -0
- package/source/components/_common/Radio/FormRadioGroup.story.js +28 -0
- package/source/components/_common/Radio/FormRadioGroup.story.styl +2 -0
- package/source/components/_common/Radio/Radio.story.js +54 -0
- package/source/components/_common/Radio/RadioGroup.story.js +90 -0
- package/source/components/_common/Radio/RadioGroup.story.styl +39 -0
- package/source/components/_common/Range/Range.story.js +46 -0
- package/source/components/_common/Range/Range.story.styl +5 -0
- package/source/components/_common/SliderArrow/SliderArrow.story.js +18 -0
- package/source/components/_common/Tabs/Tabs.story.js +56 -0
- package/source/components/_common/TimePicker/TimePicker.story.js +37 -0
- package/source/components/_common/Tooltip/Tooltip.story.js +28 -0
- package/source/components/_common/UserMenu/MaterialMenu.story.js +73 -0
- package/source/components/_common/VehicleSlider/VehicleSlider.story.js +99 -0
- package/source/components/_common/VehicleSlider/VehicleSlider.story.styl +0 -0
- package/source/components/_common/withLabel/withLabel.story.js +62 -0
- package/source/components/_common/withPopover/withPopover.story.js +48 -0
- package/source/components/_common/withPopover/withPopover.story.styl +54 -0
- package/source/components/_common/withStats/withStats.story.js +75 -0
- package/source/components/_common/withStats/withStats.styl +10 -0
- package/source/components/_common/withStats/withStats.tsx +2 -11
- package/source/framework/DataTransformers.ts +1 -0
- package/source/framework/constants/common.ts +8 -4
- package/source/framework/types/types.ts +1 -0
- package/source/framework/vehiclesProps/decoratedLightProps.tsx +48 -12
- package/source/framework/vehiclesProps/decoratedProps.tsx +35 -8
- package/source/locales/data.ts +3 -0
|
@@ -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
|
+
// ));
|