sfc-utils 1.3.69 → 1.3.70

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.
@@ -9,7 +9,7 @@ import * as imageStyles from "../styles/modules/topperimage.module.less"
9
9
 
10
10
  const Topper2 = ({ settings, wcmData }) => {
11
11
  const {
12
- Topper_Style, Title, Title_Style, Deck, Image, Image_Alt, Image_Caption, Image_Credits,
12
+ Topper_Style, Title, Title_Style, Deck, Image, Image_Alt, Video_Mp4, Image_Caption, Image_Credits,
13
13
  HeaderDek_Vertical_Position, HeaderDek_Vertical_Offset, HeaderDek_Horizontal_Offset,
14
14
  HeaderDek_Horizontal_Position, Inverted_Colors, Inverted_Layout, Inverted_Text_Color,
15
15
  Topper_Background_Color
@@ -161,8 +161,40 @@ const Topper2 = ({ settings, wcmData }) => {
161
161
  return list;
162
162
  }
163
163
 
164
+ /** Returns the HTML to support video */
165
+ const getVideoHtml = () => {
166
+ let videoCss = "";
167
+
168
+ switch (Topper_Style) {
169
+ case "stacked":
170
+ videoCss = topperStyles.videoStacked;
171
+ break;
172
+ case "full-screen":
173
+ videoCss = topperStyles.videoFullscreen;
174
+ break;
175
+ case "side-by-side":
176
+ videoCss = topperStyles.videoStacked;
177
+ break;
178
+ case "side-by-side-portrait":
179
+ videoCss = `${topperStyles.videoSideBySidePortrait} ${sideBySidePortraitFloatCss()}`;
180
+ break;
181
+ case "no-visual":
182
+ default:
183
+ break;
184
+ }
185
+
186
+ return (
187
+ <video className={videoCss} muted loop autoPlay playsInline poster={Video_Mp4.trim().replace('.mp4', '.jpg')} >
188
+ <source src={Video_Mp4.trim().replace('.mp4', '.m3u8')} type="application/vnd.apple.mpegurl" />
189
+ <source src={Video_Mp4.trim()} type="video/mp4" />
190
+ </video>
191
+ )
192
+ }
193
+
164
194
  /* Returns the corresponding image HTML for each topper style and slideshow status */
165
- const getImageHTML = (isSlideshow) => {
195
+ const getMediaHTML = (isSlideshow) => {
196
+ if (Video_Mp4) return getVideoHtml();
197
+
166
198
  if (isSlideshow) return (
167
199
  <ImageSlideshow
168
200
  wcmData={wcmData}
@@ -175,14 +207,22 @@ const Topper2 = ({ settings, wcmData }) => {
175
207
 
176
208
  switch (Topper_Style) {
177
209
  case "stacked":
178
- return (<TopperImage wcm={Image} alt={Image_Alt} wcmData={wcmData} />)
210
+ return (
211
+ <TopperImage
212
+ wcm={Image}
213
+ alt={Image_Alt}
214
+ wcmData={wcmData}
215
+ containerCssList={[imageStyles.cContainerStacked]}
216
+ imageCssList={[imageStyles.cImgStacked]}
217
+ />
218
+ )
179
219
  case "full-screen":
180
220
  return (
181
221
  <TopperImage
182
222
  wcm={Image}
183
223
  alt={Image_Alt}
184
224
  wcmData={wcmData}
185
- overrideCssList={[imageStyles.cImgFullscreen]}
225
+ imageCssList={[imageStyles.cImgFullscreen]}
186
226
  />
187
227
  )
188
228
  case "side-by-side":
@@ -192,7 +232,7 @@ const Topper2 = ({ settings, wcmData }) => {
192
232
  alt={Image_Alt}
193
233
  wcmData={wcmData}
194
234
  containerCssList={[imageStyles.cContainerSideBySide]}
195
- overrideCssList={[imageStyles.cImgSideBySide]}
235
+ imageCssList={[imageStyles.cImgSideBySide]}
196
236
  />)
197
237
  case "side-by-side-portrait":
198
238
  return (
@@ -201,7 +241,7 @@ const Topper2 = ({ settings, wcmData }) => {
201
241
  alt={Image_Alt}
202
242
  wcmData={wcmData}
203
243
  containerCssList={[imageStyles.cContainerSideBySidePortrait, sideBySidePortraitFloatCss()]}
204
- overrideCssList={[imageStyles.cImgSideBySidePortrait]}
244
+ imageCssList={[imageStyles.cImgSideBySidePortrait]}
205
245
  />
206
246
  )
207
247
  case "no-visual":
@@ -219,7 +259,7 @@ const Topper2 = ({ settings, wcmData }) => {
219
259
  <>
220
260
  <div className={containerCss}>
221
261
  <figure className={`topper-image ${topperStyles.imageFullScreen}`} aria-labelledby="topperCaptionText">
222
- {getImageHTML(isSlideshow(wcmIdList))}
262
+ {getMediaHTML(isSlideshow(wcmIdList))}
223
263
 
224
264
  {/* This caption-credit only shows when the screen size is tablet or mobile */}
225
265
  {isSlideshow(wcmIdList) &&
@@ -273,7 +313,7 @@ const Topper2 = ({ settings, wcmData }) => {
273
313
  />
274
314
  </div>
275
315
  <figure className={`mw-xl ml-auto mr-auto ${topperStyles.imageStacked}`}>
276
- {getImageHTML(isSlideshow(wcmIdList))}
316
+ {getMediaHTML(isSlideshow(wcmIdList))}
277
317
 
278
318
  {isSlideshow(wcmIdList) &&
279
319
  <CaptionCreditSlideshow
@@ -327,7 +367,7 @@ const Topper2 = ({ settings, wcmData }) => {
327
367
  />
328
368
  </div>
329
369
  <figure className={figureCss}>
330
- {getImageHTML(isSlideshow(wcmIdList))}
370
+ {getMediaHTML(isSlideshow(wcmIdList))}
331
371
 
332
372
  {isSlideshow(wcmIdList) &&
333
373
  <CaptionCreditSlideshow
@@ -362,7 +402,7 @@ const Topper2 = ({ settings, wcmData }) => {
362
402
  />
363
403
  </div>
364
404
  <figure className={portraitFigureCss}>
365
- {getImageHTML(isSlideshow(wcmIdList))}
405
+ {getMediaHTML(isSlideshow(wcmIdList))}
366
406
 
367
407
  {isSlideshow(wcmIdList) &&
368
408
  <CaptionCreditSlideshow
@@ -5,9 +5,9 @@ import { debounce } from './helpers/utilfunctions.mjs'
5
5
 
6
6
  const currentEnv = process.env.GATSBY_DEPLOY_ENV
7
7
 
8
- const ImageHTML = ({ fullPath, imageRez, alt, overrideCssList }) => {
8
+ const ImageHTML = ({ fullPath, imageRez, alt, imageCssList }) => {
9
9
  let imageCss = [wcmimageStyles.cImg];
10
- if (overrideCssList) imageCss = overrideCssList
10
+ if (imageCssList) imageCss = imageCssList
11
11
 
12
12
  return (
13
13
  <img
@@ -17,7 +17,7 @@ const ImageHTML = ({ fullPath, imageRez, alt, overrideCssList }) => {
17
17
  )
18
18
  }
19
19
 
20
- const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], overrideCssList = [] }) => {
20
+ const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], imageCssList = [] }) => {
21
21
  // When the wrapping div is rendered, we're going to figure out the best size for this image to be
22
22
  let picRef = useRef(null)
23
23
  let [imageRez, setImageRez] = useState(0)
@@ -104,7 +104,7 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], override
104
104
 
105
105
  return (
106
106
  <div className={containerCssList.join(' ')} ref={picRef}>
107
- <ImageHTML fullPath={fullPath} imageRez={imageRez} alt={alt} overrideCssList={overrideCssList} />
107
+ <ImageHTML fullPath={fullPath} imageRez={imageRez} alt={alt} imageCssList={imageCssList} />
108
108
  </div>
109
109
  )
110
110
  }
@@ -115,7 +115,7 @@ TopperImage.propTypes = {
115
115
  ratio: PropTypes.string, // This prop is currently not being used, might be ok to delete?
116
116
  wcmData: PropTypes.object,
117
117
  containerCssList: PropTypes.array,
118
- overrideCssList: PropTypes.array
118
+ imageCssList: PropTypes.array
119
119
  }
120
120
 
121
121
  export default TopperImage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.3.69",
3
+ "version": "1.3.70",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",
@@ -409,4 +409,36 @@
409
409
  @media (max-width: @lg) {
410
410
  float: none;
411
411
  }
412
+ }
413
+
414
+ .videoStacked {
415
+ width: 100%;
416
+ object-fit: cover;
417
+ }
418
+
419
+ .videoFullscreen {
420
+ width: 100%;
421
+ height: calc(100vh - 37px);
422
+ object-fit: cover;
423
+
424
+ @media @tablet {
425
+ height: 100%;
426
+ }
427
+ }
428
+
429
+ .videoSideBySidePortrait {
430
+ object-fit: cover;
431
+ width: calc(90vh * 2/3);
432
+ height: 100%;
433
+ max-width: calc(50vw - @s32);
434
+ min-width: 400px;
435
+ min-height: 600px;
436
+
437
+ @media (max-width: @lg) {
438
+ width: 90vw;
439
+ height: auto;
440
+ max-width: unset;
441
+ min-height: unset;
442
+ min-width: unset;
443
+ }
412
444
  }
@@ -64,6 +64,10 @@
64
64
  }
65
65
  }
66
66
 
67
+ .c-container-stacked {
68
+ padding-bottom: var(--img-bottom-padding-ratio);
69
+ }
70
+
67
71
  .c-img {
68
72
  display: block;
69
73
  position: relative;
@@ -73,6 +77,15 @@
73
77
  height: auto;
74
78
  }
75
79
 
80
+ .c-img-stacked {
81
+ display: block;
82
+ position: absolute;
83
+ margin: 0;
84
+ padding: 0;
85
+ width: 100%;
86
+ height: auto;
87
+ }
88
+
76
89
  .c-img-fullscreen {
77
90
  position: static;
78
91
  object-fit: cover;