@bytebrand/fe-ui-core 4.2.213 → 4.2.214

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.2.213",
3
+ "version": "4.2.214",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -100,3 +100,11 @@
100
100
 
101
101
  .blurred
102
102
  filter: blur(3px)
103
+
104
+ .frame
105
+ aspect-ratio:4/3
106
+ height: auto;
107
+ border-radius: 10px;
108
+ display: block;
109
+ border: none;
110
+
@@ -34,6 +34,7 @@ interface IProps {
34
34
  powerKW: number;
35
35
  powerPS: number;
36
36
  financingConfig:any;
37
+ youtubeId:string;
37
38
  showModal?: (id: string, props?: any) => void;
38
39
  hideModal: (id: string) => void;
39
40
  onCarFavorite: (event: MouseEvent<HTMLElement>) => void;
@@ -78,6 +79,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
78
79
 
79
80
  handleSetFirstSlide = () => {
80
81
  this.slider.slickGoTo(0);
82
+
81
83
  };
82
84
 
83
85
  componentDidUpdate(prevProps: IProps) {
@@ -113,7 +115,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
113
115
  };
114
116
 
115
117
  getImages = () => {
116
- const { photos, mainImageUrl, mainImageBlur } = this.props;
118
+ const { photos, mainImageUrl, mainImageBlur, youtubeId } = this.props;
117
119
  const { activeSlide, largeLoaded, smallLoaded, largeLoaded1, largeLoaded01 } = this.state;
118
120
 
119
121
  const imageProps = {
@@ -123,6 +125,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
123
125
  className: styles.image,
124
126
  withLoader: false
125
127
  };
128
+
126
129
  if (Array.isArray(photos) && photos.length > 0 && largeLoaded && smallLoaded && largeLoaded1 && largeLoaded01) {
127
130
  let isMouseDown = false;
128
131
  let isDragging = false;
@@ -151,7 +154,6 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
151
154
  const currentSlide = activeSlide;
152
155
  const prevSlide = (activeSlide - 1 % imagesCount + imagesCount) % imagesCount;
153
156
  const nextSlide = (activeSlide + 1 % imagesCount + imagesCount) % imagesCount;
154
-
155
157
  return photos.map((item: IImage, index: number) => {
156
158
  const showImage = index === currentSlide || index === prevSlide || index === nextSlide || this.imagesCache[index] !== undefined;
157
159
  const imageUrlSmall = _get(item, 'imageUrlSmall', null);
@@ -169,7 +171,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
169
171
  onMouseMove={handleMouseMove}
170
172
  onMouseUp={handleMouseUp}
171
173
  >
172
- {showImage && (
174
+ {showImage && !item.videoUrl && (
173
175
  <MagnifyGlassImage
174
176
  src={index !== 0 ? imageUrlLarge : null}
175
177
  srcSmall={index === 0 ? imageUrlSmall : null}
@@ -177,50 +179,61 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
177
179
  {...imageProps}
178
180
  />
179
181
  )}
182
+ {showImage && item.videoUrl && (
183
+ <iframe
184
+ width='100%'
185
+ height='441'
186
+ src={`https://www.youtube.com/embed/${item.videoUrl}?&enablejsapi=1&&rel=0&showinfo=0&html5=1`}
187
+ title='YouTube Video'
188
+ className={styles.frame}
189
+ ></iframe>
190
+ )}
180
191
  </div>
181
192
  );
182
193
  });
183
194
  }
184
-
185
195
  if (mainImageUrl) {
186
- const imagesCount = Array.isArray(photos) && photos.length > 0 ? photos.length : 0;
196
+ const imagesCount = Array.isArray(photos) && photos.length > 0 ? photos.length : 0;
187
197
  const prevSlide = (activeSlide - 1 % imagesCount + imagesCount) % imagesCount;
188
198
  const nextSlide = (activeSlide + 1 % imagesCount + imagesCount) % imagesCount;
189
199
  return (
190
- // preload cached photos from props
191
- <div className={classnames(styles.photo, { [styles.blurred]: (mainImageBlur && mainImageUrl !== PLACEHOLDER_IMAGE_SMALL_URL) })} key={mainImageUrl}>
192
- {(!largeLoaded || !smallLoaded || !largeLoaded1 || !largeLoaded01) && <Image src={mainImageUrl} {...imageProps} /> }
193
-
194
- { Array.isArray(photos) && photos.length > 0 && <Image
195
- style={ { display: 'none' } }
196
- src={ photos[activeSlide].imageUrlSmall }
197
- onLoad={ () => this.setState({ smallLoaded: true }) }
198
- {...imageProps}
199
- />
200
- }
201
- { Array.isArray(photos) && photos.length > 0 && <Image
202
- style={ { display: 'none' } }
203
- src={ photos[activeSlide].imageUrlLarge }
204
- onLoad={ () => this.setState({ largeLoaded: true }) }
205
- {...imageProps}
206
- />
207
- }
208
- { Array.isArray(photos) && photos.length > 0 && <Image
209
- style={ { display: 'none' } }
210
- src={ photos[nextSlide].imageUrlLarge }
211
- onLoad={ () => this.setState({ largeLoaded1: true }) }
212
- {...imageProps}
213
- />
214
- }
215
- { Array.isArray(photos) && photos.length > 0 && <Image
216
- style={ { display: 'none' } }
217
- src={ photos[prevSlide].imageUrlLarge }
218
- onLoad={ () => this.setState({ largeLoaded01: true }) }
219
- {...imageProps}
220
- />
221
- }
222
- </div>
200
+ // preload cached photos from props
201
+
202
+ <div className={classnames(styles.photo, { [styles.blurred]: (mainImageBlur && mainImageUrl !== PLACEHOLDER_IMAGE_SMALL_URL) })} key={mainImageUrl}>
203
+ {(!largeLoaded || !smallLoaded || !largeLoaded1 || !largeLoaded01) && <Image src={mainImageUrl} {...imageProps} /> }
204
+
205
+ { Array.isArray(photos) && photos.length > 0 && <Image
206
+ style={ { display: 'none' } }
207
+ src={ photos[activeSlide]?.imageUrlSmall }
208
+ onLoad={ () => this.setState({ smallLoaded: true }) }
209
+ {...imageProps}
210
+ />
211
+ }
212
+ { Array.isArray(photos) && photos.length > 0 && <Image
213
+ style={ { display: 'none' } }
214
+ src={ photos[activeSlide]?.imageUrlLarge }
215
+ onLoad={ () => this.setState({ largeLoaded: true }) }
216
+ {...imageProps}
217
+ />
218
+ }
219
+
220
+ { Array.isArray(photos) && photos.length > 0 && <Image
221
+ style={ { display: 'none' } }
222
+ src={ photos[nextSlide]?.imageUrlLarge }
223
+ onLoad={ () => this.setState({ largeLoaded1: true }) }
224
+ {...imageProps}
225
+ />
226
+ }
227
+ { Array.isArray(photos) && photos.length > 0 && <Image
228
+ style={ { display: 'none' } }
229
+ src={ photos[prevSlide]?.imageUrlLarge }
230
+ onLoad={ () => this.setState({ largeLoaded01: true }) }
231
+ {...imageProps}
232
+ />
233
+ }
234
+ </div>
223
235
  );
236
+
224
237
  }
225
238
 
226
239
  return (
@@ -249,7 +262,6 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
249
262
  onCarFavorite
250
263
  } = this.props;
251
264
  const { activeSlide } = this.state;
252
-
253
265
  const sliderProps = {
254
266
  autoPlay: false,
255
267
  speed: 300,
@@ -293,11 +305,13 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
293
305
  <Title {...{ t, make, model, subModel, powerKW, powerPS, onCarFavorite, isFavorite }}/>
294
306
  }
295
307
  <div className={styles.slider}>
296
- <PriceData {...priceProps}/>
308
+ {!photos[activeSlide]?.videoUrl && <PriceData {...priceProps}/>}
297
309
  <Slider ref={slider => (this.slider = slider)} {...sliderProps}>
298
310
  {this.getImages()}
299
311
  </Slider>
300
- {isMobileOnly ? <MobileStats {...statsProps} /> : <Stats {...statsProps}/>}
312
+ {!photos[activeSlide]?.videoUrl ? (
313
+ isMobileOnly ? <MobileStats {...statsProps} /> : <Stats {...statsProps} />
314
+ ) : null}
301
315
  </div>
302
316
  </div>
303
317
  );
@@ -32,6 +32,7 @@ export interface IImage {
32
32
  isSimpleTemp: boolean;
33
33
  isInProcessing: boolean;
34
34
  isTemp: boolean;
35
+ videoUrl:string; // youtube link that can be used in src in youtube video,
35
36
  }
36
37
 
37
38
  export interface IPrice {