@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
|
@@ -9,6 +9,7 @@ interface IProps {
|
|
|
9
9
|
showNewLabel: boolean;
|
|
10
10
|
historyPriceDifference: number;
|
|
11
11
|
historyPriceDifferencePerCent: number;
|
|
12
|
+
financingConfig?: any;
|
|
12
13
|
activeTab?: number;
|
|
13
14
|
showDownPayment: boolean;
|
|
14
15
|
financingFirstInstallment?: number | null;
|
|
@@ -17,11 +18,13 @@ interface IProps {
|
|
|
17
18
|
|
|
18
19
|
const MIN_PERCENT = 5;
|
|
19
20
|
const MIN_PRICE_DIFFERENCE = 500;
|
|
20
|
-
const EUR =
|
|
21
|
+
const EUR = `€`;
|
|
21
22
|
|
|
22
23
|
const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, activeTab, financingFirstInstallment, leasingFirstInstallment }) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
24
|
+
const showDownPaymentBadge = showDownPayment && (
|
|
25
|
+
(activeTab === 0 && financingFirstInstallment === 0) ||
|
|
26
|
+
(activeTab === 1 && leasingFirstInstallment === 0)
|
|
27
|
+
);
|
|
25
28
|
return (
|
|
26
29
|
<div className={styles.topWrapper}>
|
|
27
30
|
{showNewLabel && <Badge type='blue' className={styles.new}>{t('slider.new')}</Badge>}
|
|
@@ -31,7 +34,7 @@ const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment, showNe
|
|
|
31
34
|
{` ${EUR} ${t('slider.save')}`}
|
|
32
35
|
</Badge>
|
|
33
36
|
)}
|
|
34
|
-
{
|
|
37
|
+
{showDownPaymentBadge &&
|
|
35
38
|
<Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`0${EUR} ${t('slider.firstInstallment')}`}</Badge>}
|
|
36
39
|
{historyPriceDifferencePerCent >= MIN_PERCENT && (
|
|
37
40
|
<Badge type='red' className={styles.priceDifferencePerCent}>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import VehiclePromoInfo from './VehiclePromoInfo';
|
|
6
|
+
|
|
7
|
+
// Stateful container for testing interaction
|
|
8
|
+
class VehiclePromoInfoContainer extends React.Component {
|
|
9
|
+
render() {
|
|
10
|
+
const { t } = this.props;
|
|
11
|
+
|
|
12
|
+
const props = {
|
|
13
|
+
t: key => key,
|
|
14
|
+
price: {
|
|
15
|
+
wasPrice: 18660,
|
|
16
|
+
currentSalesPrice: 18440,
|
|
17
|
+
historyPriceDifferencePerCent: 2,
|
|
18
|
+
purchasePrice: 0,
|
|
19
|
+
vatRate: 19
|
|
20
|
+
},
|
|
21
|
+
consumption: { consumptionCombined: 6.1 },
|
|
22
|
+
environmentEmissions: { co2: 159 },
|
|
23
|
+
monthlyInstallment: 269.8,
|
|
24
|
+
oldMonthlyInstallment: 259.8,
|
|
25
|
+
onButtonClick: action('offer button click'),
|
|
26
|
+
onFinancingDetailsClick: action('financing button click')
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div style={{ marginTop: 100 }}>
|
|
31
|
+
<VehiclePromoInfo {...props} />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
storiesOf('VehiclePromoInfo', module)
|
|
38
|
+
.add('Default', () => (
|
|
39
|
+
<div>
|
|
40
|
+
<VehiclePromoInfoContainer />
|
|
41
|
+
</div>
|
|
42
|
+
));
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import VehiclePromoSlide from './VehiclePromoSlide';
|
|
6
|
+
|
|
7
|
+
// Stateful container for testing interaction
|
|
8
|
+
class VehiclePromoSlideContainer extends React.Component {
|
|
9
|
+
render() {
|
|
10
|
+
const { t } = this.props;
|
|
11
|
+
|
|
12
|
+
const props = {
|
|
13
|
+
t: key => key,
|
|
14
|
+
_id: 'e18efa30-a4d2-48d7-b0d7-d1701731af2a',
|
|
15
|
+
title: 'BMW 114',
|
|
16
|
+
showNewLabel: true,
|
|
17
|
+
vehicleLink:
|
|
18
|
+
'',
|
|
19
|
+
src:
|
|
20
|
+
'https://images.auto.de/carimage/858c5bae-12d2-4180-ad01-6576c2160dc0/WF-8oH7LX-iw/medium-transparent',
|
|
21
|
+
environmentEmissions:
|
|
22
|
+
{ energyEfficiencyClass: 'energyEff',
|
|
23
|
+
co2: 115,
|
|
24
|
+
emissionClass: 'emissionClass',
|
|
25
|
+
emissionSticker: 'emissionSticker' },
|
|
26
|
+
consumption:
|
|
27
|
+
{ consumptionUnit: 'unit',
|
|
28
|
+
fuel: 'petrol',
|
|
29
|
+
consumptionCombined: 4.9 },
|
|
30
|
+
price:
|
|
31
|
+
{ currency: 'EUR',
|
|
32
|
+
wasPrice: 14789,
|
|
33
|
+
currentSalesPrice: 100000,
|
|
34
|
+
vatRate: 19,
|
|
35
|
+
recomendedRetailPrice: 120000,
|
|
36
|
+
retailToCurrentPriceDifference: -20000,
|
|
37
|
+
historyPriceDifferencePerCent: 17,
|
|
38
|
+
historyPriceDifference: 20000,
|
|
39
|
+
mlCurrentSalesPricePredicted: 98000,
|
|
40
|
+
mlCurrentSalesPriceDiffPercent: 2.0408163265306145 },
|
|
41
|
+
monthlyInstallment: 714.69,
|
|
42
|
+
oldMonthlyInstallment: 1082.29,
|
|
43
|
+
bubblesColor: '#fd5a1c',
|
|
44
|
+
bubbleContent: 'Super Angebot!',
|
|
45
|
+
onButtonClick: action('offer button click'),
|
|
46
|
+
onFinancingDetailsClick: action('financing button click')
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div style={{ marginTop: 100 }}>
|
|
51
|
+
<VehiclePromoSlide {...props} />
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
storiesOf('VehiclePromoSlide', module)
|
|
58
|
+
.add('Default', () => (
|
|
59
|
+
<div>
|
|
60
|
+
<VehiclePromoSlideContainer />
|
|
61
|
+
</div>
|
|
62
|
+
));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import cars from './cars'; // fake data from top api request
|
|
6
|
+
|
|
7
|
+
import VehiclePromoSlider from './VehiclePromoSlider';
|
|
8
|
+
|
|
9
|
+
const defaultSliderStateProps = {
|
|
10
|
+
t: key => key,
|
|
11
|
+
cars
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const withHandlersSliderStateProps = {
|
|
15
|
+
t: key => key,
|
|
16
|
+
cars,
|
|
17
|
+
onButtonClick: action('offer button click'),
|
|
18
|
+
onFinancingDetailsClick: action('financing button click')
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Stateful container for testing interaction
|
|
22
|
+
class VehiclePromoSliderContainer extends React.Component {
|
|
23
|
+
render() {
|
|
24
|
+
return (
|
|
25
|
+
<div style={{ marginTop: 100 }}>
|
|
26
|
+
<VehiclePromoSlider {...this.props} />
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
storiesOf('VehiclePromoSlider', module)
|
|
33
|
+
.add('Default', () => (
|
|
34
|
+
<div style={{ width: '90vw', height: '75vh' }}>
|
|
35
|
+
<VehiclePromoSliderContainer {...defaultSliderStateProps} />
|
|
36
|
+
</div>
|
|
37
|
+
))
|
|
38
|
+
.add('With Handlers', () => (
|
|
39
|
+
<div style={{ width: '90vw', height: '75vh' }}>
|
|
40
|
+
<VehiclePromoSliderContainer {...withHandlersSliderStateProps} />
|
|
41
|
+
</div>
|
|
42
|
+
));
|
package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx
CHANGED
|
@@ -88,7 +88,9 @@ class VehiclePriceItem extends React.Component<IVehiclePriceItemProps> {
|
|
|
88
88
|
const priceItemCategoryClassName = classnames(
|
|
89
89
|
styles.priceItemCategory,
|
|
90
90
|
{ [styles.priceItemCategorySearch]: vehicleComponentName === 'search' || vehicleComponentName === 'myVehicles' },
|
|
91
|
-
{ [styles.priceItemCategoryComparable]: vehicleComponentName === 'comparable'
|
|
91
|
+
{ [styles.priceItemCategoryComparable]: vehicleComponentName === 'comparable' },
|
|
92
|
+
{ [styles.priceItemCategoryLanding]: vehicleComponentName === 'landing' },
|
|
93
|
+
{ [styles.priceItemCategoryMain]: vehicleComponentName === 'main' }
|
|
92
94
|
);
|
|
93
95
|
|
|
94
96
|
return (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
+
import _get from 'lodash/get';
|
|
4
5
|
import styles from './VehicleInfo.styl';
|
|
5
6
|
import PriceRating from '../../../PriceRating/PriceRating';
|
|
6
7
|
import { Visible, Hidden } from 'react-grid-system';
|
|
@@ -43,7 +44,8 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
|
|
|
43
44
|
consumption,
|
|
44
45
|
location,
|
|
45
46
|
offer,
|
|
46
|
-
engineData
|
|
47
|
+
engineData,
|
|
48
|
+
leasing
|
|
47
49
|
} = props;
|
|
48
50
|
const firstRegistrationDate = regDate && regDate !== 0 ? regDate : 'N/A';
|
|
49
51
|
|
|
@@ -65,7 +67,8 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
|
|
|
65
67
|
},
|
|
66
68
|
environmentEmissions: {
|
|
67
69
|
co2: environmentEmissions.co2,
|
|
68
|
-
wltpCo2: environmentEmissions.wltpCo2
|
|
70
|
+
wltpCo2: environmentEmissions.wltpCo2,
|
|
71
|
+
wltpEnergyEfficiencyClass: environmentEmissions.wltpEnergyEfficiencyClass
|
|
69
72
|
},
|
|
70
73
|
consumption: {
|
|
71
74
|
fuel: consumption.fuel,
|
|
@@ -80,14 +83,19 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
|
|
|
80
83
|
|
|
81
84
|
const decoratedProps = getDecoratedProps(dataDecoratedProps, t, language);
|
|
82
85
|
const renderProperty = (renderProperties: any, vehicleComponentName?: any) => {
|
|
83
|
-
const mainPropertiesList = renderProperties(dataDecoratedProps.consumption.fuel, combineRefAlternative).map((prop: string) =>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
const mainPropertiesList = renderProperties(dataDecoratedProps.consumption.fuel, combineRefAlternative).map((prop: string) => {
|
|
87
|
+
const isConsumption = decoratedProps[prop].name === 'consumptionCombined';
|
|
88
|
+
// On non-SRL cards drop the fuel-pump icon next to the consumption row to free up space for the CO2-class line.
|
|
89
|
+
const hideConsumptionIcon = isConsumption && vehicleComponentName !== 'search';
|
|
90
|
+
return {
|
|
91
|
+
icon: hideConsumptionIcon ? '' : decoratedProps[prop].icon,
|
|
92
|
+
description: decoratedProps[prop].value,
|
|
93
|
+
className: styles[decoratedProps[prop].name],
|
|
94
|
+
classNameIcon: (vehicleComponentName === 'search' || 'myVehicles' || 'favorite' || 'recently') && styles.carIconSearch,
|
|
95
|
+
smalltext: isConsumption && (vehicleComponentName !== 'search'),
|
|
96
|
+
hybridPlugin: engineData.hybridPlugin && isConsumption && vehicleComponentName !== 'search'
|
|
97
|
+
};
|
|
98
|
+
});
|
|
91
99
|
|
|
92
100
|
return mainPropertiesList.map((property: any, index: number) => (
|
|
93
101
|
<VehicleProperty {...property} key={index} />
|
|
@@ -149,7 +157,12 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
|
|
|
149
157
|
),
|
|
150
158
|
...routeObj,
|
|
151
159
|
className: wrapClasses,
|
|
152
|
-
onClick: () => localStorage.setItem(
|
|
160
|
+
onClick: () => localStorage.setItem(
|
|
161
|
+
'activeTabCDP',
|
|
162
|
+
_get(leasing, 'isActive', false)
|
|
163
|
+
? t('vehicleProps:title.leasing')
|
|
164
|
+
: t('vehicleProps:title.financing')
|
|
165
|
+
),
|
|
153
166
|
href: url,
|
|
154
167
|
target,
|
|
155
168
|
rel
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
.smallProp
|
|
13
13
|
span
|
|
14
|
-
font-size:
|
|
14
|
+
font-size: 9px !important
|
|
15
15
|
|
|
16
16
|
.pluginVal
|
|
17
17
|
span
|
|
@@ -26,5 +26,8 @@
|
|
|
26
26
|
+media-tablet-landscape-up()
|
|
27
27
|
margin-right: 10px
|
|
28
28
|
|
|
29
|
+
.noIcon
|
|
30
|
+
padding-left: 5px
|
|
31
|
+
|
|
29
32
|
[class*='smallText']
|
|
30
33
|
font-size:10px;
|
|
@@ -19,12 +19,13 @@ class VehicleProperty extends React.Component<IVehicleProperty, {}> {
|
|
|
19
19
|
|
|
20
20
|
render(): React.ReactNode {
|
|
21
21
|
const { className, classNameIcon, icon, description, smalltext, hybridPlugin } = this.props;
|
|
22
|
-
const
|
|
22
|
+
const noIcon: boolean = !icon;
|
|
23
|
+
const propertyClass: string = `${styles.carProp} ${className ? className : ''} ${smalltext ? styles.smallProp : ''} ${hybridPlugin ? styles.pluginVal : ''} ${noIcon ? styles.noIcon : ''}`;
|
|
23
24
|
const propertyClassIcon: string = `${styles.carIcon} ${classNameIcon ? classNameIcon : ''}`;
|
|
24
25
|
|
|
25
26
|
return (
|
|
26
27
|
<div className={propertyClass}>
|
|
27
|
-
<IconSVG className={propertyClassIcon} name={icon} customDimensions />
|
|
28
|
+
{!noIcon && <IconSVG className={propertyClassIcon} name={icon} customDimensions />}
|
|
28
29
|
<span>{description}</span>
|
|
29
30
|
</div>
|
|
30
31
|
);
|
|
@@ -48,7 +48,7 @@ const VehicleTitle: React.FC<IVehicleTitleProps> = ({
|
|
|
48
48
|
event.preventDefault();
|
|
49
49
|
event.stopPropagation();
|
|
50
50
|
event.nativeEvent.stopImmediatePropagation();
|
|
51
|
-
onFavoriteClick(event, id);
|
|
51
|
+
if (onFavoriteClick) onFavoriteClick(event, id);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const renderFavoriteIcon = (): React.ReactNode => {
|