@bytebrand/fe-ui-core 4.8.54 → 4.8.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1 -2
- 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,243 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import { Resizable } from 're-resizable';
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import styles from './OrderOverviewItem.story.styl';
|
|
5
|
+
import {
|
|
6
|
+
Accordion, AccordionSummary, AccordionDetails, Divider
|
|
7
|
+
} from '@mui/material';
|
|
8
|
+
import { makeStyles } from '@mui/styles';
|
|
9
|
+
|
|
10
|
+
// Components
|
|
11
|
+
import OrderOverviewItem from './OrderOverviewItem';
|
|
12
|
+
import IconSVG from '../../_common/IconSVG/IconSVG';
|
|
13
|
+
import VehicleFormattedPrice from '../../Vehicle/VehicleFormattedPrice/VehicleFormattedPrice';
|
|
14
|
+
import PaymentTypeCard from '../RadioCards/PaymentTypeCard/PaymentTypeCard';
|
|
15
|
+
|
|
16
|
+
const resizableProps = {
|
|
17
|
+
defaultSize: { width: 360, height: 700 }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const useStyles = makeStyles(theme => ({
|
|
21
|
+
root: {
|
|
22
|
+
minWidth: 275
|
|
23
|
+
},
|
|
24
|
+
bullet: {
|
|
25
|
+
display: 'inline-block',
|
|
26
|
+
margin: '0 2px',
|
|
27
|
+
transform: 'scale(0.8)'
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
fontSize: 14
|
|
31
|
+
},
|
|
32
|
+
pos: {
|
|
33
|
+
marginBottom: 12
|
|
34
|
+
},
|
|
35
|
+
accordionSummary: {
|
|
36
|
+
flexDirection: 'row-reverse'
|
|
37
|
+
},
|
|
38
|
+
iconPlus: {
|
|
39
|
+
'&.MuiIconButton-root': {
|
|
40
|
+
// paddingLeft: 0,
|
|
41
|
+
paddingLeft: '100px',
|
|
42
|
+
marginRight: '10px'
|
|
43
|
+
},
|
|
44
|
+
'&.MuiIconButton-edgeEnd': {
|
|
45
|
+
marginRight: 0,
|
|
46
|
+
paddingLeft: '100px'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
iconMinus: {
|
|
50
|
+
'&.MuiIconButton-label': {
|
|
51
|
+
// paddingLeft: 0,
|
|
52
|
+
marginLeft: '10px'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
heading: {
|
|
56
|
+
'&.MuiTypography-body1': {
|
|
57
|
+
marginLeft: '10px'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
accordionWrapper: {
|
|
61
|
+
'&.MuiAccordionDetails-root': {
|
|
62
|
+
display: 'block',
|
|
63
|
+
padding: 0
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
accordion: {
|
|
67
|
+
'& .MuiAccordionSummary-root' : {
|
|
68
|
+
padding: 0
|
|
69
|
+
},
|
|
70
|
+
'& .MuiAccordionSummary-content.Mui-expanded' : {
|
|
71
|
+
margin: 0
|
|
72
|
+
},
|
|
73
|
+
'&.MuiAccordion-root.Mui-expanded' : {
|
|
74
|
+
margin: 0,
|
|
75
|
+
marginTop: '20px'
|
|
76
|
+
},
|
|
77
|
+
'& .MuiAccordionSummary-root.Mui-expanded' : {
|
|
78
|
+
minHeight: '52px'
|
|
79
|
+
},
|
|
80
|
+
'&.MuiAccordion-root' : {
|
|
81
|
+
boxShadow: 'none'
|
|
82
|
+
},
|
|
83
|
+
'&.MuiAccordion-root:before' : {
|
|
84
|
+
height: 0
|
|
85
|
+
},
|
|
86
|
+
'&.MuiAccordion-root.Mui-expanded:before' : {
|
|
87
|
+
opacity: 1,
|
|
88
|
+
height: '1px'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
const OrderOverviewItemWrapper = () => {
|
|
93
|
+
const classes = useStyles();
|
|
94
|
+
|
|
95
|
+
const fields = [
|
|
96
|
+
[
|
|
97
|
+
'Hannes Käther',
|
|
98
|
+
'Wittenberger Str. 81, 04129 Leipzig'
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
'Wittenberger Str. 81, 04129 Leipzig'
|
|
102
|
+
]
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
const titles = [
|
|
106
|
+
'Billing address',
|
|
107
|
+
'Vehicle delivery',
|
|
108
|
+
'Down payment'
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
const intoAccordionTitles = [
|
|
112
|
+
'Financing',
|
|
113
|
+
'Additional services'
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
const intoAccordionField = [
|
|
117
|
+
[
|
|
118
|
+
'Financing rate',
|
|
119
|
+
'2. Borrower'
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
'Silver guarantee package',
|
|
123
|
+
'Admissions Service',
|
|
124
|
+
'Desired license plate',
|
|
125
|
+
'Vehicle delivery'
|
|
126
|
+
]
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
const intoAccordionFieldRight = [
|
|
130
|
+
[
|
|
131
|
+
'194 € per month',
|
|
132
|
+
'Papa Käther'
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
'10 € per month',
|
|
136
|
+
'2 € per month',
|
|
137
|
+
'0,5 € per month',
|
|
138
|
+
'7 € per month'
|
|
139
|
+
]
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
const iconNames = [
|
|
143
|
+
'financingIcon',
|
|
144
|
+
'leasingIcon',
|
|
145
|
+
'aboIcon'
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
const fieldLine = '€ 1,000 (transfer)'
|
|
149
|
+
|
|
150
|
+
const [open, setOpen] = useState(false);
|
|
151
|
+
|
|
152
|
+
const handleAccordion = () => {
|
|
153
|
+
setOpen(!open);
|
|
154
|
+
};
|
|
155
|
+
{/* delete */}
|
|
156
|
+
const [checkedBox, setCheckedBox] = useState({
|
|
157
|
+
0: true,
|
|
158
|
+
1: false,
|
|
159
|
+
2: true,
|
|
160
|
+
3: false,
|
|
161
|
+
4: true,
|
|
162
|
+
5: false,
|
|
163
|
+
6: true
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const onChange = (e, checked) => {
|
|
167
|
+
const updatedValue = !checkedBox[e.target.value]
|
|
168
|
+
// setCheckedBox({...checkedBox, [e.target.value]: updatedValue});
|
|
169
|
+
// checked = checkedBox[e.target.value];
|
|
170
|
+
if (e.target.value === '2') {
|
|
171
|
+
setCheckedBox({0: false, 1: false, 2: true});
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
setCheckedBox({...checkedBox, [e.target.value]: updatedValue, 2: false})
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const renderCheckout = (index) => {
|
|
179
|
+
const financing = ['Financing', 'Leasing', 'Buy', 'Abo'];
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<div className={styles.equipment}>
|
|
183
|
+
<div className={styles.column}>
|
|
184
|
+
<span className={styles.titleCheckout}>
|
|
185
|
+
{financing[index]}
|
|
186
|
+
</span>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const paymentTypeProps = {
|
|
193
|
+
labelClassName: styles.checkoutLabel,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const paymentinfoContent = [
|
|
197
|
+
'81% of our customers find the perfect financing through auto.de',
|
|
198
|
+
'Lease your car with ease',
|
|
199
|
+
'Subscribe to your dream car flexibly',
|
|
200
|
+
'Buy your car now'
|
|
201
|
+
];
|
|
202
|
+
{/* delete */}
|
|
203
|
+
return (
|
|
204
|
+
<Resizable {...resizableProps}>
|
|
205
|
+
<OrderOverviewItem title={titles[0]} fields={fields[0]}/>
|
|
206
|
+
<OrderOverviewItem title={titles[1]} fields={fields[1]}/>
|
|
207
|
+
<OrderOverviewItem title={titles[2]} fieldLine={fieldLine}/>
|
|
208
|
+
<Accordion className={`${classes.accordion} ${styles.accordion}`}>
|
|
209
|
+
<AccordionSummary
|
|
210
|
+
onClick={handleAccordion}
|
|
211
|
+
className={classes.accordionSummary}
|
|
212
|
+
// expandIcon={open ? <IconSVG className={classes.iconMinus} name='minusIcon' /> : <IconSVG className={classes.iconPlus} name='plusIcon' />}
|
|
213
|
+
aria-controls='panel1a-content'
|
|
214
|
+
id='panel1a-header'
|
|
215
|
+
>
|
|
216
|
+
<span className={styles.summaryWrapper}>
|
|
217
|
+
<span>Your overall rate</span>
|
|
218
|
+
<span className={styles.priceWrapper}>
|
|
219
|
+
<VehicleFormattedPrice monthly='monthly' className={styles.price} numbersAfterDot={0} toRound price={213} unit='€' size='medium' isNew={true}/>
|
|
220
|
+
<IconSVG name='arrowDownBlue' className={open ? styles.arrowUp : styles.arrowDown}/>
|
|
221
|
+
{/* <SvgIcon component={SvgArrowDownBlue} viewBox='-100 -100 400 400' /> */}
|
|
222
|
+
</span>
|
|
223
|
+
</span>
|
|
224
|
+
</AccordionSummary>
|
|
225
|
+
<Divider />
|
|
226
|
+
<AccordionDetails className={classes.accordionWrapper}>
|
|
227
|
+
{/* <Typography> */}
|
|
228
|
+
<OrderOverviewItem fieldRight={intoAccordionFieldRight[0]} fields={intoAccordionField[0]} title={intoAccordionTitles[0]}/>
|
|
229
|
+
<Divider/>
|
|
230
|
+
<OrderOverviewItem fieldRight={intoAccordionFieldRight[1]} fields={intoAccordionField[1]} title={intoAccordionTitles[1]}/>
|
|
231
|
+
</AccordionDetails>
|
|
232
|
+
</Accordion>
|
|
233
|
+
{/* delete */}
|
|
234
|
+
{iconNames.map((iconName, index) => (
|
|
235
|
+
<PaymentTypeCard squareRadioClassname={index < 2 && true} checked={checkedBox[index]} checkbox={true} onChange={onChange} monthly='week' price={2} key={index} label={renderCheckout(index)} infoContent={paymentinfoContent[index]} iconName={iconName} value={index} {...paymentTypeProps} />
|
|
236
|
+
))}
|
|
237
|
+
{/* delete */}
|
|
238
|
+
</Resizable>
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
storiesOf('Checkout', module)
|
|
243
|
+
.add('OrderOverviewItem', () => <OrderOverviewItemWrapper />)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@import '../../../theme/theme.styl'
|
|
2
|
+
|
|
3
|
+
.arrowUp
|
|
4
|
+
transform: rotate(180deg)
|
|
5
|
+
transition: .4s
|
|
6
|
+
|
|
7
|
+
.arrowDown
|
|
8
|
+
transition: .4s
|
|
9
|
+
|
|
10
|
+
.summaryWrapper
|
|
11
|
+
width: 100%
|
|
12
|
+
display: flex
|
|
13
|
+
justify-content: space-between
|
|
14
|
+
|
|
15
|
+
.price
|
|
16
|
+
margin-right: 10px
|
|
17
|
+
|
|
18
|
+
.accordion
|
|
19
|
+
display: block
|
|
20
|
+
margin-top: 20px
|
|
21
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import PaymentTypeCard from './PaymentTypeCard/PaymentTypeCard';
|
|
6
|
+
import ServiceCardWrapper from './AdditionalServiceCard/ServiceCardWrapper';
|
|
7
|
+
import RadioGroup from '../../_common/Radio/RadioGroup';
|
|
8
|
+
|
|
9
|
+
import styles from './RadioGroupCheckout.story.styl';
|
|
10
|
+
export class RadioGroupCheckoutVertical extends React.Component {
|
|
11
|
+
state = {
|
|
12
|
+
value: 0
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
action = action('change');
|
|
16
|
+
onChange = (event, value) => {
|
|
17
|
+
this.action(event, value);
|
|
18
|
+
this.setState(() => ({ value }));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
renderCheckout = (index) => {
|
|
22
|
+
const financing = ['Financing', 'Leasing', 'Buy', 'Abo'];
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className={styles.equipment}>
|
|
26
|
+
<div className={styles.column}>
|
|
27
|
+
<span className={styles.titleCheckout}>
|
|
28
|
+
{financing[index]}
|
|
29
|
+
</span>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
render() {
|
|
36
|
+
const radioProps = {
|
|
37
|
+
labelClassName: styles.checkoutLabel
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const paymentTypeProps = {
|
|
41
|
+
labelClassName: styles.checkoutLabel,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const infoContent = [
|
|
45
|
+
'Zulassung bei Ihrer Zulassungsstelle vor Ort',
|
|
46
|
+
'Zulassung vor Ort inkl. Wunschkennzeichen',
|
|
47
|
+
'Sie organisieren die Zulassung selbst'
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const paymentinfoContent = [
|
|
51
|
+
'81% of our customers find the perfect financing through auto.de',
|
|
52
|
+
'Lease your car with ease',
|
|
53
|
+
'Subscribe to your dream car flexibly',
|
|
54
|
+
'Buy your car now'
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
const iconNames = [
|
|
58
|
+
'financingIcon',
|
|
59
|
+
'leasingIcon',
|
|
60
|
+
'buyIcon',
|
|
61
|
+
'aboIcon',
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
const values = [0, 1, 2]
|
|
65
|
+
|
|
66
|
+
const vehicleDeliveryProps = {
|
|
67
|
+
additionalOptions: infoContent,
|
|
68
|
+
price: 0,
|
|
69
|
+
labelClassName: styles.checkoutLabel,
|
|
70
|
+
monthly: 'week'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const onCheckoutModalClick = (modalContent) => {
|
|
74
|
+
alert('modalWindow');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<RadioGroup name='sub_model' containerClassName={styles.vertical} childClassName={styles.verticalChild} value={this.state.value} onChange={this.onChange}>
|
|
80
|
+
{iconNames.map((iconName, index) => (
|
|
81
|
+
<PaymentTypeCard onCheckoutModalClick={onCheckoutModalClick} tooltip={true} monthly='week' key={index} disabled={index === 1 && true} label={this.renderCheckout(index)} infoContent={paymentinfoContent[index]} value={index} {...paymentTypeProps} />
|
|
82
|
+
))}
|
|
83
|
+
</RadioGroup>
|
|
84
|
+
<RadioGroup name='name' containerClassName={styles.vertical} childClassName={styles.verticalChild} value={this.state.value} onChange={this.onChange}>
|
|
85
|
+
{values.map((value, index) => (
|
|
86
|
+
<ServiceCardWrapper onCheckoutModalClick={onCheckoutModalClick} warrantyCard={true} key={index} additionalOptions={infoContent} index={index} price={2} label={this.renderCheckout(0)} infoContent={infoContent[value]} value={value} {...radioProps} additional={true} footerText='Komplette Leistungsübersicht'/>
|
|
87
|
+
))}
|
|
88
|
+
</RadioGroup>
|
|
89
|
+
<RadioGroup name='name' containerClassName={styles.vertical} childClassName={styles.verticalChild} value={this.state.value} onChange={this.onChange}>
|
|
90
|
+
<ServiceCardWrapper tooltip={true} deliveryCard={true} deliveryIcon='delivery' label={this.renderCheckout(0)} infoContent={infoContent[1]} value={0} {...vehicleDeliveryProps} delivery={true}>
|
|
91
|
+
<input type='text'></input>
|
|
92
|
+
</ServiceCardWrapper>
|
|
93
|
+
<ServiceCardWrapper content='delivery content' tooltip={true} deliveryCard={true} deliveryIcon='pickYourself' label={this.renderCheckout(1)} value={1} distance={500} {...vehicleDeliveryProps} />
|
|
94
|
+
</RadioGroup>
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
storiesOf('checkout', module)
|
|
101
|
+
.add('RadioGroupCheckout', () => (
|
|
102
|
+
<div>
|
|
103
|
+
<RadioGroupCheckoutVertical />
|
|
104
|
+
</div>
|
|
105
|
+
));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.default
|
|
2
|
+
padding: 10px
|
|
3
|
+
border-radius: 5px
|
|
4
|
+
margin-bottom: 20px
|
|
5
|
+
display: flex
|
|
6
|
+
flex-direction: row
|
|
7
|
+
align-items: center
|
|
8
|
+
justify-content: space-between
|
|
9
|
+
|
|
10
|
+
.vertical
|
|
11
|
+
composes: default
|
|
12
|
+
display: flex
|
|
13
|
+
flex-direction: column
|
|
14
|
+
align-items: center
|
|
15
|
+
padding: 10px
|
|
16
|
+
max-width: 500px
|
|
17
|
+
|
|
18
|
+
.verticalChild:not(:last-of-type)
|
|
19
|
+
margin-bottom: 10px
|
|
20
|
+
|
|
21
|
+
.equipment
|
|
22
|
+
display: flex
|
|
23
|
+
flex-direction: row
|
|
24
|
+
align-items: center
|
|
25
|
+
justify-content: space-between
|
|
26
|
+
|
|
27
|
+
.column
|
|
28
|
+
display: flex
|
|
29
|
+
flex-direction: column
|
|
30
|
+
align-items: stretch
|
|
31
|
+
|
|
32
|
+
.title
|
|
33
|
+
font-size: 10px
|
|
34
|
+
|
|
35
|
+
.value
|
|
36
|
+
font-size: 14px
|
|
37
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import Switcher from './Switcher';
|
|
6
|
+
|
|
7
|
+
import styles from './Switcher.story.styl';
|
|
8
|
+
export class SwitcherGroup extends React.Component {
|
|
9
|
+
state = {
|
|
10
|
+
value: 0
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
action = action('change');
|
|
14
|
+
onChange = (event, value) => {
|
|
15
|
+
this.action(event, value);
|
|
16
|
+
this.setState(() => ({ value }));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
onChange = (e, value, name) => {
|
|
20
|
+
this.setState({ value: value });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
const warrantyPeriodOptions = ['1 Jahr', '2 Jahre'];
|
|
25
|
+
return (
|
|
26
|
+
<Switcher
|
|
27
|
+
options={warrantyPeriodOptions}
|
|
28
|
+
value={this.state.value}
|
|
29
|
+
onChange={this.onChange}
|
|
30
|
+
name={'warrantyPeriod'}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
storiesOf('checkout', module)
|
|
37
|
+
.add('switcherGroup', () => (
|
|
38
|
+
<div>
|
|
39
|
+
<SwitcherGroup />
|
|
40
|
+
</div>
|
|
41
|
+
));
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
// Components
|
|
5
|
+
import CompactSearchWidget from './CompactSearchWidget';
|
|
6
|
+
|
|
7
|
+
// utils
|
|
8
|
+
import { getRequestOptions } from '../../framework/utils/RequestUtils';
|
|
9
|
+
import { buildBodyForRequest, buildQueryForSearch, changeLocation } from '../../framework/utils/CommonUtils';
|
|
10
|
+
import { transformManufacturers, transformModelsGeneral } from '../../framework/DataTransformers';
|
|
11
|
+
import { MANUFACTURER, MODEL, THROTTLE_DELAY, RATE_DEFAULT } from '../../framework/constants/SearchWidget';
|
|
12
|
+
import { BODY_TYPES } from '../../framework/constants/selectors';
|
|
13
|
+
|
|
14
|
+
const containerStyles = {
|
|
15
|
+
position: 'relative',
|
|
16
|
+
width: '600px',
|
|
17
|
+
height: '550px',
|
|
18
|
+
backgroundImage: 'url("https://dev.autode-static.de/wp-content/uploads/2019/02/startseite_br_tor_AXEL.png")'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const widget = {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
top: '5%',
|
|
24
|
+
left: '50%',
|
|
25
|
+
transform: 'translateX(-50%)',
|
|
26
|
+
padding: '15px'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const getCarsCounterUrl = 'https://www.autode-dev.de/service/car-search-endpoint/api/v1/count/car';
|
|
30
|
+
const getManufacturersUrl = 'https://www.autode-dev.de/service/car-makemodel-mapping/api/v1/information/makers';
|
|
31
|
+
const getModelsUrl = 'https://www.autode-dev.de/service/car-makemodel-mapping/api/v1/information/models?maker=';
|
|
32
|
+
|
|
33
|
+
let timeout = null;
|
|
34
|
+
|
|
35
|
+
class CompactWidgetContainer extends React.Component {
|
|
36
|
+
constructor(props) {
|
|
37
|
+
super(props);
|
|
38
|
+
|
|
39
|
+
this.state = {
|
|
40
|
+
counter: 0,
|
|
41
|
+
counterLoading: false,
|
|
42
|
+
manufacturers: [],
|
|
43
|
+
models: [],
|
|
44
|
+
bodyTypes: [],
|
|
45
|
+
filters: {
|
|
46
|
+
MANUFACTURER: '',
|
|
47
|
+
MODEL: '',
|
|
48
|
+
BODY_TYPE: [],
|
|
49
|
+
FIRST_REGISTRATION: '',
|
|
50
|
+
MILEAGE: '',
|
|
51
|
+
PRICE: { from: '', to: '' },
|
|
52
|
+
RATE: RATE_DEFAULT
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
this.getCarsCounter();
|
|
59
|
+
this.getManufacturers();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
componentWillUnmount() {
|
|
63
|
+
timeout = null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
onFilterChange = (value, name) => {
|
|
67
|
+
if (!name) return false;
|
|
68
|
+
const newState = Object.assign({}, this.state);
|
|
69
|
+
newState.filters[name] = value;
|
|
70
|
+
|
|
71
|
+
if (name === MANUFACTURER) {
|
|
72
|
+
newState.filters[MODEL] = '';
|
|
73
|
+
this.getModels(value.value);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.setState(() => (newState), () => {
|
|
77
|
+
clearTimeout(timeout);
|
|
78
|
+
timeout = setTimeout(this.getCarsCounter, THROTTLE_DELAY);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
onSearchButtonClick = () => {
|
|
83
|
+
const { filters } = this.state;
|
|
84
|
+
const query = buildQueryForSearch(filters);
|
|
85
|
+
const resolvePrefix = query ? `search?${query}` : 'search';
|
|
86
|
+
this.onChangeLocation(resolvePrefix);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
onChangeLocation = (path) =>
|
|
90
|
+
changeLocation(path);
|
|
91
|
+
|
|
92
|
+
onBrandPanelClick = () => {
|
|
93
|
+
console.log(this.state.filters[MANUFACTURER]);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
getManufacturers = () =>
|
|
97
|
+
fetch(getManufacturersUrl, getRequestOptions('get'))
|
|
98
|
+
.then((res) => res.json())
|
|
99
|
+
.then((res) => {
|
|
100
|
+
const manufacturers = transformManufacturers(res.data);
|
|
101
|
+
this.updateManufacturersList(manufacturers);
|
|
102
|
+
})
|
|
103
|
+
.catch((error) => {
|
|
104
|
+
throw error;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
getModels = (maker) =>
|
|
108
|
+
fetch(`${getModelsUrl}${maker}`, getRequestOptions('get'))
|
|
109
|
+
.then((res) => res.json())
|
|
110
|
+
.then((res) => {
|
|
111
|
+
const models = transformModelsGeneral(res.data);
|
|
112
|
+
this.setState(() => ({
|
|
113
|
+
models
|
|
114
|
+
}));
|
|
115
|
+
})
|
|
116
|
+
.catch((error) => {
|
|
117
|
+
throw error;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
getCarsCounter = () => {
|
|
121
|
+
const { filters } = this.state;
|
|
122
|
+
const data = buildBodyForRequest(filters);
|
|
123
|
+
const obj = getRequestOptions('post', data);
|
|
124
|
+
this.setState(() => ({ counterLoading: true }));
|
|
125
|
+
|
|
126
|
+
fetch(getCarsCounterUrl, obj)
|
|
127
|
+
.then((res) => res.json())
|
|
128
|
+
.then((res) => {
|
|
129
|
+
this.updateCarCounter(res.count);
|
|
130
|
+
this.setState(() => ({ counterLoading: false }));
|
|
131
|
+
})
|
|
132
|
+
.catch((error) => {
|
|
133
|
+
this.setState(() => ({ counterLoading: false }));
|
|
134
|
+
throw error;
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
updateManufacturersList = (manufacturers) =>
|
|
139
|
+
this.setState(() => ({
|
|
140
|
+
manufacturers
|
|
141
|
+
}));
|
|
142
|
+
|
|
143
|
+
updateCarCounter = (counter) =>
|
|
144
|
+
this.setState(() => ({
|
|
145
|
+
counter,
|
|
146
|
+
counterLoading: false
|
|
147
|
+
}));
|
|
148
|
+
|
|
149
|
+
render() {
|
|
150
|
+
const { counter, counterLoading, manufacturers, models, filters } = this.state;
|
|
151
|
+
const query = buildQueryForSearch(filters);
|
|
152
|
+
|
|
153
|
+
const searchWidgetProps = {
|
|
154
|
+
counter,
|
|
155
|
+
counterLoading,
|
|
156
|
+
manufacturers,
|
|
157
|
+
models,
|
|
158
|
+
bodyTypes: BODY_TYPES,
|
|
159
|
+
filters,
|
|
160
|
+
contrastMode: true,
|
|
161
|
+
onFilterChange: this.onFilterChange,
|
|
162
|
+
rateWidgetModalSizes: ['xs', 'sm', 'md', 'lg'],
|
|
163
|
+
searchButtonLink: `search?${query}`,
|
|
164
|
+
detailedSearchLink: `search/detailed?${query}`,
|
|
165
|
+
onDetailedSearchClick: () => console.log('detailed'),
|
|
166
|
+
onBrandPanelClick: this.onBrandPanelClick
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<div>
|
|
171
|
+
<CompactSearchWidget {...searchWidgetProps} />
|
|
172
|
+
</div>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// For testing with api you need run storybook with custom port and host
|
|
178
|
+
// to prevent CORS issues for carCounter and manufacturer list requests:
|
|
179
|
+
// yarn storybook -p 8080 -h local.autode-dev.de
|
|
180
|
+
storiesOf('CompactSearchWidget', module)
|
|
181
|
+
.add('default', () => (
|
|
182
|
+
<div style={containerStyles}>
|
|
183
|
+
<div style={widget}>
|
|
184
|
+
<CompactWidgetContainer />
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
));
|