@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,139 @@
|
|
|
1
|
+
import React, { useReducer, useState } from 'react';
|
|
2
|
+
import { Resizable } from 're-resizable';
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
// Components
|
|
5
|
+
import OfferPanel from './OfferPanel';
|
|
6
|
+
|
|
7
|
+
const resizableProps = {
|
|
8
|
+
minWidth: 250,
|
|
9
|
+
defaultSize: { width: 320, height: 400 }
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const slidersConfig = {
|
|
13
|
+
financing_purchasePrice: {
|
|
14
|
+
caption: 'Anzahlung und PKW-Ankauf',
|
|
15
|
+
min: 0, max: 1500, step: 100, unit: '€'
|
|
16
|
+
},
|
|
17
|
+
financing_firstInstallment: {
|
|
18
|
+
caption: 'Laufleistung / Jahr',
|
|
19
|
+
min: 0, max: 10000, step: 100, unit: 'km'
|
|
20
|
+
},
|
|
21
|
+
financing_annualMileage: {
|
|
22
|
+
caption: 'Laufleistung / Jahr',
|
|
23
|
+
min: 10000, max: 50000, step: 5000, unit: 'km'
|
|
24
|
+
},
|
|
25
|
+
financingPaybackPeriod: {
|
|
26
|
+
caption: 'duration',
|
|
27
|
+
min: 30, max: 60, step: 6, unit: 'months'
|
|
28
|
+
},
|
|
29
|
+
leasing_firstInstallment: {
|
|
30
|
+
caption: 'Laufleistung / Jahr',
|
|
31
|
+
min: 0, max: 10000, step: 100, unit: 'km'
|
|
32
|
+
},
|
|
33
|
+
leasing_annualMileage: {
|
|
34
|
+
caption: 'Laufleistung / Jahr',
|
|
35
|
+
min: 10000, max: 50000, step: 5000, unit: 'km'
|
|
36
|
+
},
|
|
37
|
+
leasingPaybackPeriod: {
|
|
38
|
+
caption: 'duration',
|
|
39
|
+
min: 30, max: 60, step: 6, unit: 'months'
|
|
40
|
+
},
|
|
41
|
+
abo_firstInstallment: {
|
|
42
|
+
caption: 'Laufleistung / Jahr',
|
|
43
|
+
min: 0, max: 10000, step: 100, unit: 'km'
|
|
44
|
+
},
|
|
45
|
+
abo_annualMileage: {
|
|
46
|
+
caption: 'Laufleistung / Jahr',
|
|
47
|
+
min: 10000, max: 50000, step: 5000, unit: 'km'
|
|
48
|
+
},
|
|
49
|
+
aboPaybackPeriod: {
|
|
50
|
+
caption: 'duration',
|
|
51
|
+
min: 30, max: 60, step: 6, unit: 'months'
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const initialSlidersState = {
|
|
56
|
+
transportationCost: '499',
|
|
57
|
+
hasFinalInstallment: true,
|
|
58
|
+
purchasePrice: 1000,
|
|
59
|
+
firstInstallment: 2000,
|
|
60
|
+
paybackPeriod: 24,
|
|
61
|
+
finalAdvice: false,
|
|
62
|
+
transferInstallments: true,
|
|
63
|
+
additionalService: false,
|
|
64
|
+
finTransportation: '20.79',
|
|
65
|
+
finAddServices: '499',
|
|
66
|
+
// financingProps: {
|
|
67
|
+
priceTabIndex: 0,
|
|
68
|
+
// firstInstallment,
|
|
69
|
+
// annualMileage,
|
|
70
|
+
// paybackPeriod,
|
|
71
|
+
// priceTabIndex,
|
|
72
|
+
// finAddServices,
|
|
73
|
+
// finTransportation,
|
|
74
|
+
// finWithAddServices,
|
|
75
|
+
// finWithTransportation,
|
|
76
|
+
// withFinalInstallment,
|
|
77
|
+
// transportationCost: 499,
|
|
78
|
+
addServicesCost: 799,
|
|
79
|
+
buy: {
|
|
80
|
+
transportationCost: 499,
|
|
81
|
+
addServicesCost: 799
|
|
82
|
+
},
|
|
83
|
+
leasing: {
|
|
84
|
+
annualMileage: 25000,
|
|
85
|
+
firstInstallment: 3000,
|
|
86
|
+
paybackPeriod: 60,
|
|
87
|
+
transportationCost: 499,
|
|
88
|
+
addServicesCost: 799,
|
|
89
|
+
transferInstallments: false,
|
|
90
|
+
additionalService: true,
|
|
91
|
+
},
|
|
92
|
+
abo: {
|
|
93
|
+
annualMileage: 25000,
|
|
94
|
+
firstInstallment: 3000,
|
|
95
|
+
paybackPeriod: 9,
|
|
96
|
+
transportationCost: 499,
|
|
97
|
+
addServicesCost: 799,
|
|
98
|
+
transferInstallments: false,
|
|
99
|
+
additionalService: true,
|
|
100
|
+
}
|
|
101
|
+
// }
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const reducer = (state, action) => ({ ...state, [action.type]: action.payload });
|
|
105
|
+
|
|
106
|
+
const t = phrase => ({
|
|
107
|
+
'modals:financing.financingModel': 'Financing model',
|
|
108
|
+
'modals:financing.withFinalRate': 'with final rate',
|
|
109
|
+
'modals:financing.withoutFinalRate': 'without final rate',
|
|
110
|
+
'modals:financing.runningTime': 'Laufzeit',
|
|
111
|
+
'modals:financing.runningTimeSub': '(Monate)',
|
|
112
|
+
'modals:financing.finalAdvice': 'Mit Schlussrate',
|
|
113
|
+
'modals:financing.transferInstallments': 'Überführungskosten in Rate einberechnen',
|
|
114
|
+
'modals:financing.transferInstallmentsTooltip': 'Die Kosten für die Überführung Ihres Fahrzeugs wird in die zu zahlenden Raten mit einberechnet.',
|
|
115
|
+
'modals:financing.additionalServiceRate': 'Lieferung nach Hause',
|
|
116
|
+
'modals:financing.additionalServiceTooltip': 'The recurring costs for the transfer of your car will be calculated in the monthly rate.'
|
|
117
|
+
}[phrase]);
|
|
118
|
+
|
|
119
|
+
const OfferPanelWrapper = () => {
|
|
120
|
+
const [state, dispatch] = useReducer(reducer, initialSlidersState);
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
const props = {
|
|
124
|
+
t,
|
|
125
|
+
slidersConfig,
|
|
126
|
+
financingProps: state,
|
|
127
|
+
priceTabIndex: 3,
|
|
128
|
+
onChange: (value, name) => dispatch({ type: name, payload: value })
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<Resizable {...resizableProps}>
|
|
133
|
+
<OfferPanel {...props} />
|
|
134
|
+
</Resizable>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
storiesOf('OfferPanel', module)
|
|
139
|
+
.add('OfferPanel', () => <OfferPanelWrapper />);
|
|
@@ -71,7 +71,7 @@ const OfferPanel: FC<IFinancingPanel> = ({
|
|
|
71
71
|
|
|
72
72
|
{priceTabIndex === THREE
|
|
73
73
|
? <div className={styles.aboAccordionWrapper}><AboAccordion /></div>
|
|
74
|
-
: <div className={styles.offerCheckboxGroup}><OfferCheckboxGroup {...{ transferInstallments, additionalService }} /></div>}
|
|
74
|
+
: <div className={styles.offerCheckboxGroup}><OfferCheckboxGroup {...{ transferInstallments, additionalService, priceTabIndex }} /></div>}
|
|
75
75
|
</>
|
|
76
76
|
}
|
|
77
77
|
</form>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import RangeGroup from './RangeGroup';
|
|
6
|
+
|
|
7
|
+
import styles from './RangeGroup.story.styl';
|
|
8
|
+
|
|
9
|
+
const RangeGroupWrapper = () => {
|
|
10
|
+
const [value, setValue] = useState(300);
|
|
11
|
+
|
|
12
|
+
const onChange = (value) => {
|
|
13
|
+
|
|
14
|
+
setValue(value);
|
|
15
|
+
action('onChange');
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const props = {
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
min: 0,
|
|
22
|
+
max: 10000,
|
|
23
|
+
step: 100,
|
|
24
|
+
onAfterChange: action('onAfterChange')
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className={styles.container}>
|
|
29
|
+
<RangeGroup {...props} />
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
storiesOf('_Common_UI', module)
|
|
35
|
+
.add('RangeGroup', () => <RangeGroupWrapper />);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import PriceRating from './PriceRating';
|
|
6
|
+
|
|
7
|
+
import styles from './PriceRating.story.styl';
|
|
8
|
+
|
|
9
|
+
const t = (phrase) => {
|
|
10
|
+
const dict = {
|
|
11
|
+
noRating: 'No rating',
|
|
12
|
+
highPrice: 'High price',
|
|
13
|
+
increasedPrice: 'Increased price',
|
|
14
|
+
fairPrice: 'Fair price',
|
|
15
|
+
goodPrice: 'Good price',
|
|
16
|
+
topPrice: 'Top price'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return dict[phrase];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const props = {
|
|
23
|
+
t,
|
|
24
|
+
className: styles.item,
|
|
25
|
+
onClick: action('click')
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
storiesOf('Price review', module)
|
|
29
|
+
.add('PriceRating', () => (
|
|
30
|
+
<div>
|
|
31
|
+
<PriceRating className={styles.item} t={t} />
|
|
32
|
+
<PriceRating { ...props } darkBackground={true} />
|
|
33
|
+
<PriceRating { ...props } rating={1} />
|
|
34
|
+
<PriceRating { ...props } rating={2} />
|
|
35
|
+
<PriceRating { ...props } rating={3} />
|
|
36
|
+
<PriceRating { ...props } rating={4} />
|
|
37
|
+
<PriceRating { ...props } rating={5} />
|
|
38
|
+
</div>
|
|
39
|
+
));
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Resizable } from 're-resizable';
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
|
|
5
|
+
import PriceRatingDetailed from './PriceRatingDetailed';
|
|
6
|
+
import { getPriceRatingConfig, getPriceRating } from '../../framework/utils/CommonUtils';
|
|
7
|
+
|
|
8
|
+
import styles from './PriceRatingDetailed.story.styl';
|
|
9
|
+
|
|
10
|
+
const resizableProps = {
|
|
11
|
+
minWidth: 150,
|
|
12
|
+
defaultSize: { width: 550, height: 500 }
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const t = (phrase) => {
|
|
16
|
+
const dict = {
|
|
17
|
+
noRating: 'No rating',
|
|
18
|
+
highPrice: 'High',
|
|
19
|
+
increasedPrice: 'Increased price',
|
|
20
|
+
fairPrice: 'Fair price',
|
|
21
|
+
goodPrice: 'Good price',
|
|
22
|
+
topPrice: 'Top price',
|
|
23
|
+
|
|
24
|
+
noRatingCompact: 'No rating',
|
|
25
|
+
highPriceCompact: 'High',
|
|
26
|
+
increasedPriceCompact: 'Increased',
|
|
27
|
+
fairPriceCompact: 'Fair',
|
|
28
|
+
goodPriceCompact: 'Good',
|
|
29
|
+
topPriceCompact: 'Top',
|
|
30
|
+
|
|
31
|
+
priceTo: 'to'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return dict[phrase];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const Wrapper = () => {
|
|
38
|
+
const [currentSalesPrice, changeCurrentSalesPrice] = useState(9000);
|
|
39
|
+
const [predictablePrice, changePredictablePrice] = useState(12000);
|
|
40
|
+
|
|
41
|
+
const priceProps = {
|
|
42
|
+
t,
|
|
43
|
+
className: styles.item,
|
|
44
|
+
price: +currentSalesPrice,
|
|
45
|
+
ratingConfig: getPriceRatingConfig(+currentSalesPrice, +predictablePrice),
|
|
46
|
+
rating: getPriceRating(+currentSalesPrice, +predictablePrice)
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div>
|
|
51
|
+
<div className={styles.dropdownSection}>
|
|
52
|
+
<label>
|
|
53
|
+
<h3>Current Sails Price:</h3>
|
|
54
|
+
<input
|
|
55
|
+
type="number"
|
|
56
|
+
value={currentSalesPrice}
|
|
57
|
+
onChange={(event) => changeCurrentSalesPrice(event.target.value)}
|
|
58
|
+
/>
|
|
59
|
+
</label>
|
|
60
|
+
<label>
|
|
61
|
+
<h3>Predictable Price:</h3>
|
|
62
|
+
<input
|
|
63
|
+
type="number"
|
|
64
|
+
value={predictablePrice}
|
|
65
|
+
onChange={(event) => changePredictablePrice(event.target.value)}
|
|
66
|
+
/>
|
|
67
|
+
</label>
|
|
68
|
+
</div>
|
|
69
|
+
<Resizable {...resizableProps}>
|
|
70
|
+
<PriceRatingDetailed {...priceProps} mode={'general'} />
|
|
71
|
+
<PriceRatingDetailed {...priceProps} mode={'compact'} />
|
|
72
|
+
</Resizable>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
storiesOf('Price review', module)
|
|
78
|
+
.add('PriceRatingDetailed', () => <Wrapper />);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
|
|
6
|
+
import RateSearchValue from './RateSearchValue';
|
|
7
|
+
|
|
8
|
+
import styles from './RateSearchValue.story.styl';
|
|
9
|
+
|
|
10
|
+
const t = (phrase, options = {}) => {
|
|
11
|
+
const { value } = options;
|
|
12
|
+
const dictionary = {
|
|
13
|
+
monthlyInstallmentLabel: 'Monatsrate:',
|
|
14
|
+
monthlyInstallmentFromValue: `ab ${value} €`,
|
|
15
|
+
monthlyInstallmentToValue: `bis ${value} €`,
|
|
16
|
+
paybackPeriodValue: `${value} Monate`,
|
|
17
|
+
firstInstallmentValue: `${value} € Anzahlung`,
|
|
18
|
+
defaultValue: 'beliebig, 60 Monate'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return dictionary[phrase];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const RateSearchWidgetWrapper = () => {
|
|
25
|
+
|
|
26
|
+
const propsWithLabel = {
|
|
27
|
+
t,
|
|
28
|
+
className: styles.item,
|
|
29
|
+
monthlyInstallmentFrom: 1000,
|
|
30
|
+
monthlyInstallmentTo: 1500,
|
|
31
|
+
firstInstallment: 3000,
|
|
32
|
+
paybackPeriod: 60,
|
|
33
|
+
onClick: action('click'),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const propsWithoutLabel = {
|
|
37
|
+
t,
|
|
38
|
+
className: styles.item,
|
|
39
|
+
showLabel: false,
|
|
40
|
+
monthlyInstallmentFrom: 1000,
|
|
41
|
+
monthlyInstallmentTo: 1500,
|
|
42
|
+
firstInstallment: 3000,
|
|
43
|
+
paybackPeriod: 60,
|
|
44
|
+
onClick: action('click'),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const props_1 = {
|
|
49
|
+
t,
|
|
50
|
+
className: styles.item,
|
|
51
|
+
monthlyInstallmentFrom: null,
|
|
52
|
+
monthlyInstallmentTo: 'any',
|
|
53
|
+
firstInstallment: null,
|
|
54
|
+
paybackPeriod: null,
|
|
55
|
+
onClick: action('click')
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const props_2 = {
|
|
59
|
+
t,
|
|
60
|
+
className: styles.item,
|
|
61
|
+
monthlyInstallmentFrom: 1000,
|
|
62
|
+
firstInstallment: '0',
|
|
63
|
+
paybackPeriod: 60,
|
|
64
|
+
onClick: action('click')
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<RateSearchValue {...propsWithLabel} />
|
|
70
|
+
<RateSearchValue {...propsWithoutLabel} />
|
|
71
|
+
<RateSearchValue {...props_1} />
|
|
72
|
+
<RateSearchValue {...props_2} />
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
storiesOf('RateSearchValue', module)
|
|
78
|
+
.add('RateSearchValue', () => <RateSearchWidgetWrapper />);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
|
|
6
|
+
import RateSearchWidget from './RateSearchWidget';
|
|
7
|
+
|
|
8
|
+
import styles from './RateSearchWidget.story.styl';
|
|
9
|
+
|
|
10
|
+
const t = (phrase) => {
|
|
11
|
+
const dictionary = {
|
|
12
|
+
title: 'Adjust rate details',
|
|
13
|
+
months: 'Months',
|
|
14
|
+
monthlyInstallment: 'Monthly rate (€)',
|
|
15
|
+
monthlyInstallmentFrom: 'Monthly rate from (€)',
|
|
16
|
+
monthlyInstallmentTo: 'Monthly rate up to (€)',
|
|
17
|
+
firstInstallment: 'Deposit',
|
|
18
|
+
paybackPeriod: 'Running time',
|
|
19
|
+
any: 'any',
|
|
20
|
+
|
|
21
|
+
firstInstallmentPlaceholder: 'Deposit',
|
|
22
|
+
monthlyInstallmentFromPlaceholder: 'Rate from',
|
|
23
|
+
monthlyInstallmentToPlaceholder: 'Rate to',
|
|
24
|
+
paybackPeriodPlaceholder: 'Period',
|
|
25
|
+
|
|
26
|
+
apply: 'Apply',
|
|
27
|
+
abort: 'abort'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return dictionary[phrase];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const RateSearchWidgetWrapper = () => {
|
|
34
|
+
|
|
35
|
+
const props = {
|
|
36
|
+
t,
|
|
37
|
+
className: styles.item,
|
|
38
|
+
|
|
39
|
+
monthlyInstallmentFrom: 'any',
|
|
40
|
+
monthlyInstallmentTo: 'any',
|
|
41
|
+
firstInstallment: 0,
|
|
42
|
+
paybackPeriod: 60,
|
|
43
|
+
|
|
44
|
+
onAbort: action('abort'),
|
|
45
|
+
onApply: action('apply')
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className={styles.wrapper}>
|
|
50
|
+
<RateSearchWidget {...props} simpleMode={true} className={styles.accentClassName} />
|
|
51
|
+
<RateSearchWidget {...props} simpleMode={false} />
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
storiesOf('RateSearchWidget', module)
|
|
57
|
+
.add('RateSearchWidget', () => <RateSearchWidgetWrapper />);
|