@bytebrand/fe-ui-core 4.2.166 → 4.2.167
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/VehicleDetailedSlider/VehicleDetailedSlider.tsx +7 -1
- package/source/components/VehicleDetailedSlider/partials/PriceData.styl +4 -0
- package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +8 -1
- package/source/components/_common/Badge/Badge.styl +3 -0
- package/source/components/_common/Badge/Badge.tsx +1 -1
package/package.json
CHANGED
|
@@ -27,11 +27,13 @@ interface IProps {
|
|
|
27
27
|
statsData: any;
|
|
28
28
|
isFavorite: boolean;
|
|
29
29
|
showNewLabel: boolean;
|
|
30
|
+
activeTab:number;
|
|
30
31
|
make: string;
|
|
31
32
|
model: string;
|
|
32
33
|
subModel: string;
|
|
33
34
|
powerKW: number;
|
|
34
35
|
powerPS: number;
|
|
36
|
+
financingConfig:any;
|
|
35
37
|
showModal?: (id: string, props?: any) => void;
|
|
36
38
|
hideModal: (id: string) => void;
|
|
37
39
|
onCarFavorite: (event: MouseEvent<HTMLElement>) => void;
|
|
@@ -238,6 +240,8 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
238
240
|
subModel,
|
|
239
241
|
powerKW,
|
|
240
242
|
powerPS,
|
|
243
|
+
activeTab,
|
|
244
|
+
financingConfig,
|
|
241
245
|
onCarFavorite
|
|
242
246
|
} = this.props;
|
|
243
247
|
const { activeSlide } = this.state;
|
|
@@ -259,9 +263,11 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
259
263
|
|
|
260
264
|
const priceProps = {
|
|
261
265
|
t,
|
|
266
|
+
financingConfig,
|
|
262
267
|
showNewLabel,
|
|
263
268
|
historyPriceDifference: price ? price.historyPriceDifference : 0,
|
|
264
|
-
historyPriceDifferencePerCent: price ? price.historyPriceDifferencePerCent : 0
|
|
269
|
+
historyPriceDifferencePerCent: price ? price.historyPriceDifferencePerCent : 0,
|
|
270
|
+
activeTab
|
|
265
271
|
};
|
|
266
272
|
|
|
267
273
|
const statsProps = {
|
|
@@ -3,19 +3,24 @@ import FormattedNumber from '../../FormattedNumber/FormattedNumber';
|
|
|
3
3
|
import Badge from '../../_common/Badge/Badge';
|
|
4
4
|
|
|
5
5
|
import styles from './PriceData.styl';
|
|
6
|
+
import { isNil } from 'lodash';
|
|
6
7
|
|
|
7
8
|
interface IProps {
|
|
8
9
|
t: (phrase: string, config?: any) => string;
|
|
9
10
|
showNewLabel: boolean;
|
|
10
11
|
historyPriceDifference: number;
|
|
11
12
|
historyPriceDifferencePerCent: number;
|
|
13
|
+
financingConfig?:any;
|
|
14
|
+
activeTab?:number;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
const MIN_PERCENT = 5;
|
|
15
18
|
const MIN_PRICE_DIFFERENCE = 500;
|
|
16
19
|
const EUR = `\u20AC`;
|
|
17
20
|
|
|
18
|
-
const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent }) => {
|
|
21
|
+
const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, financingConfig, activeTab }) => {
|
|
22
|
+
console.log('financingConfig', financingConfig);
|
|
23
|
+
const percentageOfFirstInstallment = activeTab === 0 ? financingConfig!.financing.percentageOfFirstInstallment : financingConfig!.leasing.percentageOfFirstInstallment;
|
|
19
24
|
return (
|
|
20
25
|
<div className={styles.topWrapper}>
|
|
21
26
|
{showNewLabel && <Badge type='blue' className={styles.new}>{t('slider.new')}</Badge>}
|
|
@@ -25,6 +30,8 @@ const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPr
|
|
|
25
30
|
{` ${EUR} ${t('slider.save')}`}
|
|
26
31
|
</Badge>
|
|
27
32
|
)}
|
|
33
|
+
{(!isNil(percentageOfFirstInstallment) && activeTab !== 2) &&
|
|
34
|
+
<Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`${percentageOfFirstInstallment}${percentageOfFirstInstallment > 0 ? '%' : EUR} ${t('slider.firstInstallment')}`}</Badge>}
|
|
28
35
|
{historyPriceDifferencePerCent >= MIN_PERCENT && (
|
|
29
36
|
<Badge type='red' className={styles.priceDifferencePerCent}>
|
|
30
37
|
-{historyPriceDifferencePerCent}%
|
|
@@ -3,7 +3,7 @@ import classnames from 'classnames';
|
|
|
3
3
|
|
|
4
4
|
import styles from './Badge.styl';
|
|
5
5
|
|
|
6
|
-
export type TBadgeType = 'white' | 'gray' | 'green' | 'blue' | 'red';
|
|
6
|
+
export type TBadgeType = 'white' | 'gray' | 'green' | 'blue' | 'red' | 'lightBlue';
|
|
7
7
|
|
|
8
8
|
export interface IBadgeProps {
|
|
9
9
|
children: any;
|