@bytebrand/fe-ui-core 4.0.268 → 4.1.1

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.1",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -86,12 +86,25 @@
86
86
  text-align: right
87
87
  font-weight: 700
88
88
  font-size: 16px;
89
- color: $black80
89
+ color: $black80;
90
+ width: 60px;
90
91
 
91
92
  .ourPriceInput:focus
92
93
  outline: none
93
94
 
94
95
  .editIcon
95
- width: 3rem;
96
+ width: 1.5rem;
96
97
  height: auto;
97
- fill: $skyBlue
98
+ fill: $skyBlue
99
+
100
+ .ourPriceBlock
101
+ display: flex;
102
+ align-items: center;
103
+ column-gap: 5px;
104
+
105
+ .ourPrice
106
+ color: $skyBlue !important;
107
+ cursor: pointer;
108
+
109
+ .editIconBlock
110
+ cursor: pointer;
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useRef } from 'react';
2
2
  import styles from './DealerInfo.styl';
3
3
  import IconSVG from '../_common/IconSVG/IconSVG';
4
4
  import VehicleFormattedPrice from '../Vehicle/VehicleFormattedPrice/VehicleFormattedPrice';
@@ -17,6 +17,7 @@ interface IDealerInfo {
17
17
  const DealerInfo = ({ infoSections, t, dealerPrice, ourMargin, link, linkName, currentSalesPrice, onCurrentSalesPriceChange }: IDealerInfo) => {
18
18
  const [isPriceUpdating, setPriceUpdating] = useState(false);
19
19
  const [newPrice, setNewPrice] = useState(dealerPrice);
20
+ const inputRef = useRef(null);
20
21
 
21
22
  const handleSubmit = () => {
22
23
  setPriceUpdating(false);
@@ -87,25 +88,32 @@ const DealerInfo = ({ infoSections, t, dealerPrice, ourMargin, link, linkName, c
87
88
  />
88
89
  </span>
89
90
  </span>
90
- <span className={styles.priceItem} onClick={() => setPriceUpdating(true)}>
91
+ <span className={styles.priceItem}>
91
92
  <span>
92
93
  {t('vehicleProps:alternative.ourPrice')}
93
94
  </span>
94
95
  {isPriceUpdating
95
- ? <>
96
+ ? <div className={styles.ourPriceBlock}>
96
97
  <input
97
98
  className={styles.ourPriceInput}
98
99
  type="number"
99
100
  value={newPrice}
100
101
  onChange={(e) => setNewPrice(+e.target.value)}
102
+ ref={inputRef}
103
+ onBlur={() => setPriceUpdating(false)}
101
104
  />
102
- <div onClick={handleSubmit}>
105
+ <span className={styles.editIconBlock} onClick={handleSubmit}>
103
106
  <IconSVG className={styles.editIcon} customDimensions name='editIcon'></IconSVG>
104
- </div>
105
- </>
106
- : <span>
107
+ </span>
108
+ </div>
109
+ : <span onClick={() => {
110
+ setPriceUpdating(true);
111
+ setTimeout(() => {
112
+ inputRef.current.focus();
113
+ }, 200)
114
+ }}>
107
115
  <VehicleFormattedPrice
108
- className={styles.price}
116
+ className={classnames(styles.price, styles.ourPrice)}
109
117
  numbersAfterDot={0}
110
118
  price={currentSalesPrice}
111
119
  unit='€'
@@ -6,8 +6,8 @@ import { getFormattedPrice } from '../../../framework/utils/CommonUtils';
6
6
  import { IPanelConfigProps } from '../../../framework/types/types';
7
7
  import VehicleFormattedPrice from '../../Vehicle/VehicleFormattedPrice/VehicleFormattedPrice';
8
8
  import RequestOffer from '../../_common/OfferRequestButtonWrapper/OfferRequestButtonWrapper';
9
- import IconSVG from '../../_common/IconSVG/IconSVG';
10
9
  import styles from './PanelConfig.styl';
10
+ import ExpansionPanel from '../../_common/ExpansionPanel/ExpansionPanel';
11
11
 
12
12
  const PanelConfig: React.FunctionComponent<IPanelConfigProps> = ({
13
13
  t,
@@ -108,16 +108,11 @@ const PanelConfig: React.FunctionComponent<IPanelConfigProps> = ({
108
108
  </Hidden>
109
109
  </div>
110
110
  <Visible xs sm md>
111
- <span className={classnames(styles.toggleDetails, { [styles.toggleDetailsOpen]: isOpenDetails })} onClick={onToggleDetailsClick}>
112
- {t(`sidebar.financingDetalis.${titleKey}`)}
113
-
114
- <IconSVG
115
- name='menuArrow'
116
- className={styles.detailsIcon}
117
- customDimensions
118
- />
119
- </span>
120
- {isOpenDetails ? renderConfigDetails(true) : null}
111
+ <ExpansionPanel
112
+ title={t(`sidebar.financingDetalis.${titleKey}`)}
113
+ >
114
+ {renderConfigDetails(true)}
115
+ </ExpansionPanel>
121
116
  </Visible>
122
117
  </>
123
118
  );
@@ -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
+ });