@bytebrand/fe-ui-core 4.8.47 → 4.8.49

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.8.47",
3
+ "version": "4.8.49",
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,11 +310,12 @@ 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,
314
318
  activeTab,
315
- financingConfig,
316
319
  onCarFavorite
317
320
  } = this.props;
318
321
  const { activeSlide } = this.state;
@@ -334,9 +337,10 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
334
337
 
335
338
  const priceProps = {
336
339
  t,
337
- financingConfig,
338
340
  showNewLabel,
339
341
  showDownPayment,
342
+ financingFirstInstallment,
343
+ leasingFirstInstallment,
340
344
  historyPriceDifference: price ? price.historyPriceDifference : 0,
341
345
  historyPriceDifferencePerCent: price ? price.historyPriceDifferencePerCent : 0,
342
346
  activeTab
@@ -3,24 +3,25 @@ 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
+ activeTab?: number;
13
+ showDownPayment: boolean;
14
+ financingFirstInstallment?: number | null;
15
+ leasingFirstInstallment?: number | null;
16
16
  }
17
17
 
18
18
  const MIN_PERCENT = 5;
19
19
  const MIN_PRICE_DIFFERENCE = 500;
20
20
  const EUR = `\u20AC`;
21
21
 
22
- const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment,showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, financingConfig, activeTab }) => {
23
- const percentageOfFirstInstallment = activeTab === 0 ? financingConfig!.financing.percentageOfFirstInstallment : financingConfig!.leasing.percentageOfFirstInstallment;
22
+ const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, activeTab, financingFirstInstallment, leasingFirstInstallment }) => {
23
+ const relevantFirstInstallment = activeTab === 0 ? financingFirstInstallment : activeTab === 1 ? leasingFirstInstallment : null;
24
+ const showZeroDownPayment = showDownPayment && relevantFirstInstallment === 0;
24
25
  return (
25
26
  <div className={styles.topWrapper}>
26
27
  {showNewLabel && <Badge type='blue' className={styles.new}>{t('slider.new')}</Badge>}
@@ -30,8 +31,8 @@ const PriceData: React.FunctionComponent<IProps> = ({ t, showDownPayment,showNew
30
31
  {` ${EUR} ${t('slider.save')}`}
31
32
  </Badge>
32
33
  )}
33
- {(!isNil(percentageOfFirstInstallment) && activeTab !== 2 && showDownPayment) &&
34
- <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`${percentageOfFirstInstallment}${percentageOfFirstInstallment > 0 ? '%' : EUR} ${t('slider.firstInstallment')}`}</Badge>}
34
+ {showZeroDownPayment &&
35
+ <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`0${EUR} ${t('slider.firstInstallment')}`}</Badge>}
35
36
  {historyPriceDifferencePerCent >= MIN_PERCENT && (
36
37
  <Badge type='red' className={styles.priceDifferencePerCent}>
37
38
  -{historyPriceDifferencePerCent}%
@@ -161,7 +161,7 @@ const withStats = (WrappedComponent: any) => ({
161
161
  </Badge>
162
162
  )}
163
163
  {showDownPayment && (
164
- <Badge type='blue' className={styles.badgeItem}>
164
+ <Badge type='lightBlue' className={styles.badgeItem}>
165
165
  <span className={styles.badgeFull}>{downPaymentText}</span>
166
166
  <span className={styles.badgeShort}>{downPaymentShortText}</span>
167
167
  </Badge>