@bytebrand/fe-ui-core 4.8.23 → 4.8.25
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/package.json +1 -1
- package/source/components/AccardionSection/AccardionSection.tsx +24 -15
- package/source/components/AccordionWidget/AccordionWidget.tsx +6 -17
- package/source/framework/DataTransformers.ts +1 -1
- package/source/framework/types/types.ts +2 -0
- package/source/framework/vehiclesProps/decoratedProps.tsx +7 -5
- package/source/locales/data.ts +2 -2
package/package.json
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import _get from 'lodash/get';
|
|
3
3
|
import { Visible } from 'react-grid-system';
|
|
4
|
-
import {
|
|
4
|
+
import { scroller } from 'react-scroll';
|
|
5
5
|
import AccordionWidget from '../AccordionWidget/AccordionWidget';
|
|
6
6
|
import { IAccardionSectionProps } from '../../framework/types/types';
|
|
7
7
|
import styles from './AccardionSection.styl';
|
|
8
8
|
import { vehicleProps } from '../../locales/data';
|
|
9
9
|
|
|
10
10
|
const AccardionSection: React.FunctionComponent<IAccardionSectionProps> = (props) => {
|
|
11
|
+
const [expanded, setExpanded] = React.useState<string | boolean>('overview')
|
|
12
|
+
|
|
13
|
+
const handleChange =
|
|
14
|
+
(panel: string) => (_: React.SyntheticEvent, isExpanded: boolean) => {
|
|
15
|
+
setExpanded(isExpanded ? panel : false);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const handleChangeByLink = (panel: string) => {
|
|
19
|
+
setExpanded(panel);
|
|
20
|
+
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
scroller.scrollTo(panel, {
|
|
23
|
+
duration: 400,
|
|
24
|
+
offset: -50,
|
|
25
|
+
smooth: true,
|
|
26
|
+
dynamic: true
|
|
27
|
+
});
|
|
28
|
+
}, 300);
|
|
29
|
+
}
|
|
30
|
+
|
|
11
31
|
const renderPropertyLinks = (): React.ReactNode => {
|
|
32
|
+
|
|
12
33
|
const links = ['overview', 'highlights', 'details'];
|
|
13
34
|
|
|
14
35
|
return <div className={styles.propertyLinks}>
|
|
15
36
|
{links.map((to: string) => {
|
|
16
|
-
|
|
17
|
-
to,
|
|
18
|
-
key: to,
|
|
19
|
-
duration: 500,
|
|
20
|
-
offset: -40,
|
|
21
|
-
activeClass: styles.active,
|
|
22
|
-
className: styles.item,
|
|
23
|
-
spy: false,
|
|
24
|
-
smooth: true,
|
|
25
|
-
isDynamic: true,
|
|
26
|
-
absolute: false
|
|
27
|
-
};
|
|
28
|
-
return <Link {..._props} className={styles.propertyLink}>{props.t(`sidebar.${to}`)}</Link>;
|
|
37
|
+
return <span onClick={() => handleChangeByLink(to)} className={styles.propertyLink}>{props.t(`sidebar.${to}`)}</span>;
|
|
29
38
|
})}
|
|
30
39
|
</div>;
|
|
31
40
|
};
|
|
@@ -35,7 +44,7 @@ const AccardionSection: React.FunctionComponent<IAccardionSectionProps> = (props
|
|
|
35
44
|
<Visible xs sm md>
|
|
36
45
|
{renderPropertyLinks()}
|
|
37
46
|
</Visible>
|
|
38
|
-
<AccordionWidget {...props} />
|
|
47
|
+
<AccordionWidget {...props} expanded={expanded} handleChange={handleChange} />
|
|
39
48
|
</div>
|
|
40
49
|
);
|
|
41
50
|
};
|
|
@@ -20,24 +20,13 @@ import IconSVG from '../_common/IconSVG/IconSVG';
|
|
|
20
20
|
import { getActualHighlights } from '../../framework/constants/highlights';
|
|
21
21
|
import styles from './AccordionWidget.styl';
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
expanded: boolean | string;
|
|
25
|
-
}
|
|
26
|
-
class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardionSectionState> {
|
|
23
|
+
class AccordionWidget extends React.Component<IAccardionSectionProps> {
|
|
27
24
|
|
|
28
25
|
constructor(props: any) {
|
|
29
26
|
super(props);
|
|
30
27
|
|
|
31
|
-
this.state = {
|
|
32
|
-
expanded: 'overview'
|
|
33
|
-
};
|
|
34
28
|
}
|
|
35
29
|
|
|
36
|
-
handleChange =
|
|
37
|
-
(panel: string) => (_: React.SyntheticEvent, isExpanded: boolean) => {
|
|
38
|
-
this.setState({ expanded: isExpanded ? panel : false });
|
|
39
|
-
};
|
|
40
|
-
|
|
41
30
|
renderPropsBlock = (data: ICarPropElement[]): React.ReactNode => {
|
|
42
31
|
return (
|
|
43
32
|
<div className={styles.propertyContainer}>
|
|
@@ -157,7 +146,7 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
|
|
|
157
146
|
};
|
|
158
147
|
|
|
159
148
|
render(): React.ReactNode {
|
|
160
|
-
const { car, activeIndex, onItemClick, t } = this.props;
|
|
149
|
+
const { car, activeIndex, onItemClick, t, expanded, handleChange } = this.props;
|
|
161
150
|
|
|
162
151
|
if (!car || !('_id' in car)) return null;
|
|
163
152
|
const {
|
|
@@ -195,8 +184,8 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
|
|
|
195
184
|
key={section.name}
|
|
196
185
|
title={t(`accordion.${section.title}`)}
|
|
197
186
|
reactScrollName={section.name}
|
|
198
|
-
onChange={
|
|
199
|
-
expanded={
|
|
187
|
+
onChange={handleChange}
|
|
188
|
+
expanded={expanded}
|
|
200
189
|
>
|
|
201
190
|
{section.component}
|
|
202
191
|
</ExpansionPanel>
|
|
@@ -210,8 +199,8 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
|
|
|
210
199
|
key={section.title}
|
|
211
200
|
title={t(`accordion.${section.title}`)}
|
|
212
201
|
reactScrollName={section.name}
|
|
213
|
-
onChange={
|
|
214
|
-
expanded={
|
|
202
|
+
onChange={handleChange}
|
|
203
|
+
expanded={expanded}
|
|
215
204
|
defaultExpanded={section.expanded}
|
|
216
205
|
>
|
|
217
206
|
{section.component}
|
|
@@ -64,7 +64,7 @@ export const transformDataForDecoratedCar = (car: any) => {
|
|
|
64
64
|
length: _get(car, 'sizeVolumeWeight.length', null),
|
|
65
65
|
base: _get(car, 'driveSuspension.wheelBase', null),
|
|
66
66
|
fuelCapacity: _get(car, 'sizeVolumeWeight.fuelCapacity', null),
|
|
67
|
-
maximumWeightCapacity: _get(car, 'sizeVolumeWeight.
|
|
67
|
+
maximumWeightCapacity: _get(car, 'sizeVolumeWeight.maxWeight', null),
|
|
68
68
|
tareWeight: _get(car, 'sizeVolumeWeight.emptyWeight', null),
|
|
69
69
|
bootCapacity: _get(car, 'sizeVolumeWeight.cargoCapacity', null),
|
|
70
70
|
capacityLoad: _get(car, 'sizeVolumeWeight.completeCapacity', null),
|
|
@@ -287,6 +287,8 @@ export interface IAccardionSectionProps {
|
|
|
287
287
|
detailsText?: string | null;
|
|
288
288
|
OfferRequestButtonWrapper?: React.ComponentType<IOfferRequestButtonWrapper>;
|
|
289
289
|
onShowOfferDetails?(event?: React.ChangeEvent<{}>, car?: any, priceTabActiveIndex?: number): void;
|
|
290
|
+
expanded?: boolean | string;
|
|
291
|
+
handleChange?: any;
|
|
290
292
|
}
|
|
291
293
|
|
|
292
294
|
export interface ICar {
|
|
@@ -451,9 +451,9 @@ const getDecoratedProps = (
|
|
|
451
451
|
maximumWeight: {
|
|
452
452
|
title: t('vehicleProps:title.maximumWeight'),
|
|
453
453
|
get value() {
|
|
454
|
-
const
|
|
455
|
-
return Number.isFinite(
|
|
456
|
-
? t('vehicleProps:value.maximumWeightCapacity', { capacity:
|
|
454
|
+
const maxWeight = car.sizeVolumeWeight && car.sizeVolumeWeight.maxWeight;
|
|
455
|
+
return Number.isFinite(maxWeight)
|
|
456
|
+
? t('vehicleProps:value.maximumWeightCapacity', { capacity: maxWeight.toLocaleString(language) })
|
|
457
457
|
: t('vehicleProps:value.na');
|
|
458
458
|
}
|
|
459
459
|
},
|
|
@@ -848,7 +848,7 @@ const getDecoratedProps = (
|
|
|
848
848
|
? t('vehicleProps:value.wltpCo2Combined', { co2: wltpCo2.toLocaleString(language) })
|
|
849
849
|
: null;
|
|
850
850
|
const wltpCo2PluginValue = Number.isFinite(wltpCo2)
|
|
851
|
-
? t('vehicleProps:value.
|
|
851
|
+
? t('vehicleProps:value.wltpCo2WtdCombined', { co2: wltpCo2.toLocaleString(language) })
|
|
852
852
|
: null;
|
|
853
853
|
const hybridPlugin = car.engineData.hybridPlugin;
|
|
854
854
|
|
|
@@ -993,8 +993,10 @@ const getDecoratedProps = (
|
|
|
993
993
|
|
|
994
994
|
if (moment.utc(offerAvailabilityTimestamp, 'X').isBefore()) {
|
|
995
995
|
offerAvailability = t('cbd:selector_availabilityMode_always');
|
|
996
|
-
} else {
|
|
996
|
+
} else if (!!offerAvailabilityTimestamp) {
|
|
997
997
|
offerAvailability = t('vehicleProps:value.fromDate', { date: humanViewTime });
|
|
998
|
+
} else {
|
|
999
|
+
offerAvailability = t('vehicleProps:value.onRequest'); // case when "availabilityFrom" is undefined
|
|
998
1000
|
}
|
|
999
1001
|
break;
|
|
1000
1002
|
|
package/source/locales/data.ts
CHANGED
|
@@ -78,7 +78,7 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
|
|
|
78
78
|
base: `${getFormattedPrice(vehicleOption.base)} mm`,
|
|
79
79
|
topSpeed: `${vehicleOption.topSpeed} km/h`,
|
|
80
80
|
fuelCapacity: `${getFormattedPrice(vehicleOption.fuelCapacity)} l`,
|
|
81
|
-
maximumWeightCapacity: `${getFormattedPrice(vehicleOption.maximumWeightCapacity)}
|
|
81
|
+
maximumWeightCapacity: `${getFormattedPrice(vehicleOption.maximumWeightCapacity)} kg`,
|
|
82
82
|
tareWeight: `${getFormattedPrice(vehicleOption.tareWeight)} kg`,
|
|
83
83
|
bootCapacity: `${vehicleOption.bootCapacity} l`,
|
|
84
84
|
capacityLoad: `${vehicleOption.capacityLoad} l`,
|
|
@@ -1050,7 +1050,7 @@ export const modalsTranslate = () => {
|
|
|
1050
1050
|
annualMileage: 'Laufleistung / Jahr',
|
|
1051
1051
|
requestOffer: 'Angebot anfragen',
|
|
1052
1052
|
successfullyRequested: 'Erfolgreich angefragt',
|
|
1053
|
-
info: 'Für Ihre Finanzierungswünsche stellen wir eine Bonitätsanfrage. Bonität vorausgesetzt, dies ist ein Berechnungsbeispiel gem. Ihrer Angaben, welches 2/3 aller Kunden erhalten. Dieses freibleibende Angebot der {{financialInstitution}} wird vermittelt durch die auto.de Media GmbH,
|
|
1053
|
+
info: 'Für Ihre Finanzierungswünsche stellen wir eine Bonitätsanfrage. Bonität vorausgesetzt, dies ist ein Berechnungsbeispiel gem. Ihrer Angaben, welches 2/3 aller Kunden erhalten. Dieses freibleibende Angebot der {{financialInstitution}} wird vermittelt durch die auto.de Media GmbH, Zwickauer Str. 127 b, 04279 Leipzig, die als ungebundener Vermittler nicht beratend tätig ist. Irrtümer vorbehalten. Preise ggf. inkl. MwSt.'
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
1056
|
};
|