sfc-utils 1.4.3 → 1.4.5
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/layout/layouthelmet.mjs +7 -1
- package/components/slideshow/imageslideshow.mjs +4 -0
- package/components/topper2.mjs +39 -3
- 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
|
@@ -56,13 +56,19 @@ const LayoutHelmet = ({ meta, url_add, noindex = false }) => {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
// Handle special favicon logic
|
|
60
|
+
let favHref = "/favicon.ico"
|
|
61
|
+
if (MARKET_KEY === "TK"){
|
|
62
|
+
favHref = "https://files.sfchronicle.com/devhub-logos/DHlogos-sm.png"
|
|
63
|
+
}
|
|
64
|
+
|
|
59
65
|
return (
|
|
60
66
|
<Helmet>
|
|
61
67
|
<title>{TITLE}</title>
|
|
62
68
|
<meta name="description" content={DESCRIPTION} />
|
|
63
69
|
<link
|
|
64
70
|
rel="shortcut icon"
|
|
65
|
-
href=
|
|
71
|
+
href={favHref}
|
|
66
72
|
type="image/x-icon"
|
|
67
73
|
/>
|
|
68
74
|
<link rel="canonical" href={`${CANONICAL_URL}/${url_add}`} />
|
|
@@ -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
|
@@ -20,6 +20,8 @@ const Topper2 = ({ settings, wcmData }) => {
|
|
|
20
20
|
case "stacked":
|
|
21
21
|
case "no-visual":
|
|
22
22
|
return [topperStyles.headerDekStacked, " mw-lg mt-lg mb-md"];
|
|
23
|
+
case "small-visual":
|
|
24
|
+
return [topperStyles.headerDekStacked, " mw-lg mt-sm mb-md"];
|
|
23
25
|
case "full-screen":
|
|
24
26
|
// Check if css ":root" is accessible
|
|
25
27
|
if (typeof window != "undefined") {
|
|
@@ -67,6 +69,7 @@ const Topper2 = ({ settings, wcmData }) => {
|
|
|
67
69
|
let defaultStyles = [];
|
|
68
70
|
switch (Topper_Style) {
|
|
69
71
|
case "stacked":
|
|
72
|
+
case "small-visual":
|
|
70
73
|
defaultStyles = [];
|
|
71
74
|
break;
|
|
72
75
|
case "no-visual":
|
|
@@ -93,6 +96,7 @@ const Topper2 = ({ settings, wcmData }) => {
|
|
|
93
96
|
const deckStyleList = () => {
|
|
94
97
|
switch (Topper_Style) {
|
|
95
98
|
case "stacked":
|
|
99
|
+
case "small-visual":
|
|
96
100
|
return ["deck"];
|
|
97
101
|
case "no-visual":
|
|
98
102
|
return ["deck left"];
|
|
@@ -167,14 +171,13 @@ const Topper2 = ({ settings, wcmData }) => {
|
|
|
167
171
|
|
|
168
172
|
switch (Topper_Style) {
|
|
169
173
|
case "stacked":
|
|
174
|
+
case "side-by-side":
|
|
175
|
+
case "small-visual":
|
|
170
176
|
videoCss = topperStyles.videoStacked;
|
|
171
177
|
break;
|
|
172
178
|
case "full-screen":
|
|
173
179
|
videoCss = topperStyles.videoFullscreen;
|
|
174
180
|
break;
|
|
175
|
-
case "side-by-side":
|
|
176
|
-
videoCss = topperStyles.videoStacked;
|
|
177
|
-
break;
|
|
178
181
|
case "side-by-side-portrait":
|
|
179
182
|
videoCss = `${topperStyles.videoSideBySidePortrait} ${sideBySidePortraitFloatCss()}`;
|
|
180
183
|
break;
|
|
@@ -225,6 +228,16 @@ const Topper2 = ({ settings, wcmData }) => {
|
|
|
225
228
|
imageCssList={[imageStyles.cImgFullscreen]}
|
|
226
229
|
/>
|
|
227
230
|
)
|
|
231
|
+
case "small-visual":
|
|
232
|
+
return (
|
|
233
|
+
<TopperImage
|
|
234
|
+
wcm={Image}
|
|
235
|
+
alt={Image_Alt}
|
|
236
|
+
wcmData={wcmData}
|
|
237
|
+
containerCssList={[imageStyles.cContainerSmallVisual]}
|
|
238
|
+
imageCssList={[imageStyles.cImgSmallVisual]}
|
|
239
|
+
/>
|
|
240
|
+
)
|
|
228
241
|
case "side-by-side":
|
|
229
242
|
return (
|
|
230
243
|
<TopperImage
|
|
@@ -328,6 +341,29 @@ const Topper2 = ({ settings, wcmData }) => {
|
|
|
328
341
|
</>
|
|
329
342
|
);
|
|
330
343
|
|
|
344
|
+
case "small-visual":
|
|
345
|
+
return (
|
|
346
|
+
<>
|
|
347
|
+
<div>
|
|
348
|
+
<figure className={`mw-xl ml-auto mr-auto ${topperStyles.imageSmallVisual}`}>
|
|
349
|
+
{getMediaHTML(isSlideshow(wcmIdList))}
|
|
350
|
+
</figure>
|
|
351
|
+
<div className={headerDekStyleList().join('')}>
|
|
352
|
+
<Heading
|
|
353
|
+
level={1}
|
|
354
|
+
text={Title}
|
|
355
|
+
className={headerStyleList().join(' ')}
|
|
356
|
+
/>
|
|
357
|
+
<Heading
|
|
358
|
+
level={2}
|
|
359
|
+
text={Deck}
|
|
360
|
+
className={deckStyleList().join(' ')}
|
|
361
|
+
/>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
</>
|
|
365
|
+
);
|
|
366
|
+
|
|
331
367
|
case "no-visual":
|
|
332
368
|
return (
|
|
333
369
|
<>
|
|
@@ -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
|
}
|