@bytebrand/fe-ui-core 4.0.268 → 4.1.0

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.0.268",
3
+ "version": "4.1.0",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React, { memo, FunctionComponent, ReactNode, MouseEvent, createElement } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import _get from 'lodash/get';
4
4
  import LazyLoad from 'react-lazyload';
@@ -64,7 +64,7 @@ interface IVehicleSmallCardProps {
64
64
  src?: string;
65
65
  url?: string;
66
66
  iconName?: string;
67
- children?: React.ReactNode;
67
+ children?: ReactNode;
68
68
  showSlider?: boolean;
69
69
  showOfferBtn?: boolean;
70
70
  showFavoriteStar?: boolean;
@@ -81,7 +81,7 @@ interface IVehicleSmallCardProps {
81
81
  currentPage?: number;
82
82
  }
83
83
 
84
- const VehicleSmallCard: React.FunctionComponent<IVehicleSmallCardProps> = (props) => {
84
+ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
85
85
  const {
86
86
  t = (phrase: string) => _get(vehicleProps(props), phrase.replace(':', '.'), phrase),
87
87
  isTop,
@@ -239,14 +239,14 @@ const VehicleSmallCard: React.FunctionComponent<IVehicleSmallCardProps> = (props
239
239
  statsData
240
240
  };
241
241
 
242
- const linkBaseUrl = (e: React.MouseEvent<HTMLImageElement>) => {
242
+ const linkBaseUrl = (e: MouseEvent<HTMLImageElement>) => {
243
243
  e.preventDefault();
244
244
  if (baseUrl) window.open(baseUrl, '_blank');
245
245
  };
246
-
246
+ console.log(`%cqqq VSC [${id}] = `, 'font-weight: bold;color: #90ee90', id );
247
247
  return (
248
248
  <section className={wrapperClassName} onClick={onContainerClick} id={id}>
249
- {React.createElement(linkTag, {
249
+ {createElement(linkTag, {
250
250
  children: <VehicleTitle {...favoriteProps} />,
251
251
  ...routeObj,
252
252
  className: `${styles.redirectClassLink} ${styles.gridAreaTitle}`,
@@ -254,7 +254,7 @@ const VehicleSmallCard: React.FunctionComponent<IVehicleSmallCardProps> = (props
254
254
  href: url
255
255
  })}
256
256
 
257
- {React.createElement(linkTag, {
257
+ {createElement(linkTag, {
258
258
  children: (
259
259
  <>
260
260
  {showSlider ? (
@@ -269,7 +269,7 @@ const VehicleSmallCard: React.FunctionComponent<IVehicleSmallCardProps> = (props
269
269
  {offerSource || ownerName ? (
270
270
  <>
271
271
  <IconSVG className={styles.svgIcon} name='linkAlternative' />
272
- <span onClick={(e: React.MouseEvent<HTMLImageElement>) => linkBaseUrl(e)}>
272
+ <span onClick={(e: MouseEvent<HTMLImageElement>) => linkBaseUrl(e)}>
273
273
  {!typeAlternative ? ownerName : t(`cbd:${offerSource}`)}
274
274
  </span>
275
275
  </>
@@ -339,4 +339,19 @@ VehicleSmallCard.defaultProps = {
339
339
  onDetailsClick: () => { }
340
340
  };
341
341
 
342
- export default VehicleSmallCard;
342
+ // export default VehicleSmallCard;
343
+ export default memo(VehicleSmallCard, (props, nextProps) => { // shouldComponentUpdate
344
+ const {
345
+ t,
346
+ price: {
347
+ financing: { monthlyInstallment, annualMileage, withFinalInstallment },
348
+ leasing: { monthlyInstallment: lMonthlyInstallment }
349
+ }
350
+ } = props;
351
+
352
+ return t === nextProps.t
353
+ && monthlyInstallment === nextProps.price.financing.monthlyInstallment
354
+ && annualMileage === nextProps.price.financing.annualMileage
355
+ && withFinalInstallment === nextProps.price.financing.withFinalInstallment
356
+ && lMonthlyInstallment === nextProps.price.leasing.monthlyInstallment;
357
+ });