@bytebrand/fe-ui-core 4.8.53 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.8.53",
3
+ "version": "4.8.55",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -44,6 +44,8 @@ interface IProps {
44
44
  hideModal: (id: string) => void;
45
45
  onCarFavorite: (event: MouseEvent<HTMLElement>) => void;
46
46
  showDownPayment: boolean;
47
+ financingFirstInstallment?: number | null;
48
+ leasingFirstInstallment?: number | null;
47
49
  handleSentryInit?: () => void;
48
50
  }
49
51
 
@@ -308,6 +310,8 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
308
310
  make,
309
311
  model,
310
312
  showDownPayment,
313
+ financingFirstInstallment,
314
+ leasingFirstInstallment,
311
315
  subModel,
312
316
  powerKW,
313
317
  powerPS,
@@ -337,6 +341,8 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
337
341
  financingConfig,
338
342
  showNewLabel,
339
343
  showDownPayment,
344
+ financingFirstInstallment,
345
+ leasingFirstInstallment,
340
346
  historyPriceDifference: price ? price.historyPriceDifference : 0,
341
347
  historyPriceDifferencePerCent: price ? price.historyPriceDifferencePerCent : 0,
342
348
  activeTab
@@ -3,24 +3,28 @@ 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';
7
6
 
8
7
  interface IProps {
9
8
  t: (phrase: string, config?: any) => string;
10
9
  showNewLabel: boolean;
11
10
  historyPriceDifference: number;
12
11
  historyPriceDifferencePerCent: number;
13
- financingConfig?:any;
14
- activeTab?:number;
15
- showDownPayment:boolean;
12
+ financingConfig?: any;
13
+ activeTab?: number;
14
+ showDownPayment: boolean;
15
+ financingFirstInstallment?: number | null;
16
+ leasingFirstInstallment?: number | null;
16
17
  }
17
18
 
18
19
  const MIN_PERCENT = 5;
19
20
  const MIN_PRICE_DIFFERENCE = 500;
20
- const EUR = `\u20AC`;
21
+ const EUR = `€`;
21
22
 
22
- const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment,showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, financingConfig, activeTab }) => {
23
- const percentageOfFirstInstallment = activeTab === 0 ? financingConfig!.financing.percentageOfFirstInstallment : financingConfig!.leasing.percentageOfFirstInstallment;
23
+ const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, activeTab, financingFirstInstallment, leasingFirstInstallment }) => {
24
+ const showDownPaymentBadge = showDownPayment && (
25
+ (activeTab === 0 && financingFirstInstallment === 0) ||
26
+ (activeTab === 1 && leasingFirstInstallment === 0)
27
+ );
24
28
  return (
25
29
  <div className={styles.topWrapper}>
26
30
  {showNewLabel && <Badge type='blue' className={styles.new}>{t('slider.new')}</Badge>}
@@ -30,8 +34,8 @@ const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment,showNew
30
34
  {` ${EUR} ${t('slider.save')}`}
31
35
  </Badge>
32
36
  )}
33
- {(!isNil(percentageOfFirstInstallment) && activeTab !== 2 && showDownPayment) &&
34
- <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`${percentageOfFirstInstallment}${percentageOfFirstInstallment > 0 ? '%' : EUR} ${t('slider.firstInstallment')}`}</Badge>}
37
+ {showDownPaymentBadge &&
38
+ <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`0${EUR} ${t('slider.firstInstallment')}`}</Badge>}
35
39
  {historyPriceDifferencePerCent >= MIN_PERCENT && (
36
40
  <Badge type='red' className={styles.priceDifferencePerCent}>
37
41
  -{historyPriceDifferencePerCent}%