sfc-utils 1.4.8 → 1.4.10
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/components/slideshow/imageslideshow.mjs +4 -0
- package/components/topper2.mjs +45 -5
- package/components/topperimage.mjs +5 -1
- package/package.json +1 -1
- package/styles/modules/imageslideshow.module.less +11 -0
- package/styles/modules/topper2.module.less +10 -0
- package/styles/modules/topperimage.module.less +12 -0
|
@@ -33,6 +33,8 @@ const ImageSlideshow = ({ wcmData, imageList, altList, topperStyle, isLayoutInve
|
|
|
33
33
|
case "stacked":
|
|
34
34
|
case "full-screen":
|
|
35
35
|
return styles.containerStacked;
|
|
36
|
+
case "small-visual":
|
|
37
|
+
return styles.containerSmallVisual;
|
|
36
38
|
default:
|
|
37
39
|
return "";
|
|
38
40
|
}
|
|
@@ -48,6 +50,8 @@ const ImageSlideshow = ({ wcmData, imageList, altList, topperStyle, isLayoutInve
|
|
|
48
50
|
return styles.imageWrapperSideBySide;
|
|
49
51
|
case "side-by-side-portrait":
|
|
50
52
|
return styles.imageWrapperSideBySidePortrait;
|
|
53
|
+
case "small-visual":
|
|
54
|
+
return styles.imageWrapperSmallVisual;
|
|
51
55
|
default:
|
|
52
56
|
return "";
|
|
53
57
|
}
|
package/components/topper2.mjs
CHANGED
|
@@ -27,6 +27,8 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
27
27
|
case "stacked":
|
|
28
28
|
case "no-visual":
|
|
29
29
|
return [topperStyles.headerDekStacked, " mw-lg mt-lg mb-md"];
|
|
30
|
+
case "small-visual":
|
|
31
|
+
return [topperStyles.headerDekStacked, " mw-lg mt-sm mb-md"];
|
|
30
32
|
case "full-screen":
|
|
31
33
|
// Check if css ":root" is accessible
|
|
32
34
|
if (typeof window != "undefined") {
|
|
@@ -74,6 +76,7 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
74
76
|
let defaultStyles = [];
|
|
75
77
|
switch (Topper_Style) {
|
|
76
78
|
case "stacked":
|
|
79
|
+
case "small-visual":
|
|
77
80
|
defaultStyles = [];
|
|
78
81
|
break;
|
|
79
82
|
case "no-visual":
|
|
@@ -100,6 +103,7 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
100
103
|
const deckStyleList = () => {
|
|
101
104
|
switch (Topper_Style) {
|
|
102
105
|
case "stacked":
|
|
106
|
+
case "small-visual":
|
|
103
107
|
return ["deck"];
|
|
104
108
|
case "no-visual":
|
|
105
109
|
return ["deck left"];
|
|
@@ -146,8 +150,12 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
146
150
|
/** Converts wcm string from spreadsheet into a list of WCM ids */
|
|
147
151
|
const getWcmIdList = (listStr) => {
|
|
148
152
|
if (!listStr) return [];
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
// For backwards compat, handle both ; and , as delimiters
|
|
154
|
+
let charSearch = ","
|
|
155
|
+
if (listStr.indexOf(";") !== -1){
|
|
156
|
+
charSearch = ";"
|
|
157
|
+
}
|
|
158
|
+
return listStr.toString().split(charSearch).map((d) => parseInt(d));
|
|
151
159
|
}
|
|
152
160
|
|
|
153
161
|
/** Checks if WCM list represents an image slideshow */
|
|
@@ -174,14 +182,13 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
174
182
|
|
|
175
183
|
switch (Topper_Style) {
|
|
176
184
|
case "stacked":
|
|
185
|
+
case "side-by-side":
|
|
186
|
+
case "small-visual":
|
|
177
187
|
videoCss = topperStyles.videoStacked;
|
|
178
188
|
break;
|
|
179
189
|
case "full-screen":
|
|
180
190
|
videoCss = topperStyles.videoFullscreen;
|
|
181
191
|
break;
|
|
182
|
-
case "side-by-side":
|
|
183
|
-
videoCss = topperStyles.videoStacked;
|
|
184
|
-
break;
|
|
185
192
|
case "side-by-side-portrait":
|
|
186
193
|
videoCss = `${topperStyles.videoSideBySidePortrait} ${sideBySidePortraitFloatCss()}`;
|
|
187
194
|
break;
|
|
@@ -232,6 +239,16 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
232
239
|
imageCssList={[imageStyles.cImgFullscreen]}
|
|
233
240
|
/>
|
|
234
241
|
)
|
|
242
|
+
case "small-visual":
|
|
243
|
+
return (
|
|
244
|
+
<TopperImage
|
|
245
|
+
wcm={Image}
|
|
246
|
+
alt={Image_Alt}
|
|
247
|
+
wcmData={wcmData}
|
|
248
|
+
containerCssList={[imageStyles.cContainerSmallVisual]}
|
|
249
|
+
imageCssList={[imageStyles.cImgSmallVisual]}
|
|
250
|
+
/>
|
|
251
|
+
)
|
|
235
252
|
case "side-by-side":
|
|
236
253
|
return (
|
|
237
254
|
<TopperImage
|
|
@@ -335,6 +352,29 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
335
352
|
</>
|
|
336
353
|
);
|
|
337
354
|
|
|
355
|
+
case "small-visual":
|
|
356
|
+
return (
|
|
357
|
+
<>
|
|
358
|
+
<div>
|
|
359
|
+
<figure className={`mw-xl ml-auto mr-auto ${topperStyles.imageSmallVisual}`}>
|
|
360
|
+
{getMediaHTML(isSlideshow(wcmIdList))}
|
|
361
|
+
</figure>
|
|
362
|
+
<div className={headerDekStyleList().join('')}>
|
|
363
|
+
<Heading
|
|
364
|
+
level={1}
|
|
365
|
+
text={Title}
|
|
366
|
+
className={headerStyleList().join(' ')}
|
|
367
|
+
/>
|
|
368
|
+
<Heading
|
|
369
|
+
level={2}
|
|
370
|
+
text={Deck}
|
|
371
|
+
className={deckStyleList().join(' ')}
|
|
372
|
+
/>
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
375
|
+
</>
|
|
376
|
+
);
|
|
377
|
+
|
|
338
378
|
case "no-visual":
|
|
339
379
|
return (
|
|
340
380
|
<>
|
|
@@ -61,6 +61,7 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], imageCss
|
|
|
61
61
|
// This calculation is not used for the topper impl, but keeping it here just in case
|
|
62
62
|
// it is needed for the general WCMImage utils migration
|
|
63
63
|
let photoRatio = "56.25%"; // Default to 16/9
|
|
64
|
+
let photoFraction = 0.5625;
|
|
64
65
|
let photoViewport = "56.25vw";
|
|
65
66
|
let fullPath = `https://s.hdnux.com/photos/0/0/0/${wcm}/0/`;
|
|
66
67
|
if (!ratio) {
|
|
@@ -74,11 +75,13 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], imageCss
|
|
|
74
75
|
// Set ratio of the actual photo like a legit hacker
|
|
75
76
|
photoRatio = (matchedPhoto.photo.ratio * 100) + "%";
|
|
76
77
|
photoViewport = (matchedPhoto.photo.ratio * 50) + "vw";
|
|
78
|
+
photoFraction = (parseFloat(matchedPhoto.photo.ratio));
|
|
77
79
|
|
|
78
80
|
// If css :root is available, set the photo ratio
|
|
79
81
|
if (r) {
|
|
80
82
|
r.style.setProperty('--img-bottom-padding-ratio', photoRatio);
|
|
81
83
|
r.style.setProperty('--img-height-viewport', photoViewport);
|
|
84
|
+
r.style.setProperty('--img-bottom-padding-fraction', photoFraction);
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
fullPath = matchedPhoto.photo.full_path;
|
|
@@ -94,6 +97,7 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], imageCss
|
|
|
94
97
|
if (r) {
|
|
95
98
|
r.style.setProperty('--img-bottom-padding-ratio', photoRatio);
|
|
96
99
|
r.style.setProperty('--img-height-viewport', photoViewport);
|
|
100
|
+
r.style.setProperty('--img-bottom-padding-fraction', photoFraction);
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
|
|
@@ -112,7 +116,7 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], imageCss
|
|
|
112
116
|
TopperImage.propTypes = {
|
|
113
117
|
wcm: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
114
118
|
alt: PropTypes.string.isRequired,
|
|
115
|
-
ratio: PropTypes.string,
|
|
119
|
+
ratio: PropTypes.string,
|
|
116
120
|
wcmData: PropTypes.object,
|
|
117
121
|
containerCssList: PropTypes.array,
|
|
118
122
|
imageCssList: PropTypes.array
|
package/package.json
CHANGED
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
.container-small-visual {
|
|
38
|
+
width: 150px;
|
|
39
|
+
height: calc(150px*2/3);
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
.image-wrapper-stacked {
|
|
38
43
|
position: absolute;
|
|
39
44
|
width: 100%;
|
|
@@ -61,6 +66,12 @@
|
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
|
|
69
|
+
.image-wrapper-small-visual {
|
|
70
|
+
position: absolute;
|
|
71
|
+
width: 150px;
|
|
72
|
+
height: calc(150px*2/3)
|
|
73
|
+
}
|
|
74
|
+
|
|
64
75
|
.image-wrapper-side-by-side-portrait {
|
|
65
76
|
position: absolute;
|
|
66
77
|
width: calc(90vh*2/3);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
:root {
|
|
5
5
|
--img-bottom-padding-ratio: "56.25%";
|
|
6
6
|
--img-height-viewport: "56.25vw";
|
|
7
|
+
--img-bottom-padding-fraction: 0.5625;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
.c-force-aspect-ratio {
|
|
@@ -68,6 +69,11 @@
|
|
|
68
69
|
padding-bottom: var(--img-bottom-padding-ratio);
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
.c-container-small-visual {
|
|
73
|
+
height: calc(var(--img-bottom-padding-fraction)*150px);
|
|
74
|
+
width: 150px;
|
|
75
|
+
}
|
|
76
|
+
|
|
71
77
|
.c-img {
|
|
72
78
|
display: block;
|
|
73
79
|
position: relative;
|
|
@@ -97,6 +103,12 @@
|
|
|
97
103
|
}
|
|
98
104
|
}
|
|
99
105
|
|
|
106
|
+
.c-img-small-visual {
|
|
107
|
+
display: block;
|
|
108
|
+
position: absolute;
|
|
109
|
+
padding: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
.c-container-side-by-side {
|
|
101
113
|
height: 100%;
|
|
102
114
|
}
|