sfc-utils 1.3.65 → 1.3.67
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/captioncredit.mjs +21 -21
- package/components/helpers/utilfunctions.mjs +71 -8
- package/components/layout/layouthelmet.mjs +125 -0
- package/components/layout/layoutscript.mjs +12 -0
- package/components/ogpubdate.mjs +18 -0
- package/components/slideshow/captioncreditslideshow.mjs +7 -4
- package/components/slideshow/imageslideshow.mjs +17 -2
- package/components/topper2.mjs +184 -23
- package/components/topperimage.mjs +7 -2
- package/example/gatsby-node.js +3 -4
- package/example/package-lock.json +18566 -133
- package/example/src/components/layout.js +19 -159
- package/example/src/html.js +2 -2
- package/example/src/pages/index.js +3 -10
- package/package.json +1 -1
- package/settings.js +1 -1
- package/styles/brandStylesCommon.less +5 -9
- package/styles/modules/imageslideshow.module.less +45 -0
- package/styles/modules/topper2.module.less +239 -0
- package/styles/modules/topperimage.module.less +85 -0
|
@@ -17,7 +17,7 @@ const ImageHTML = ({ fullPath, imageRez, alt, overrideCssList }) => {
|
|
|
17
17
|
)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const TopperImage = ({ wcm, alt, ratio, wcmData, overrideCssList }) => {
|
|
20
|
+
const TopperImage = ({ wcm, alt, ratio, wcmData, containerCssList = [], overrideCssList = [] }) => {
|
|
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)
|
|
@@ -61,6 +61,7 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, overrideCssList }) => {
|
|
|
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 photoViewport = "56.25vw";
|
|
64
65
|
let fullPath = `https://s.hdnux.com/photos/0/0/0/${wcm}/0/`;
|
|
65
66
|
if (!ratio) {
|
|
66
67
|
let matchedPhoto = wcmData.nodes.find((item) => {
|
|
@@ -72,10 +73,12 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, overrideCssList }) => {
|
|
|
72
73
|
if (matchedPhoto) {
|
|
73
74
|
// Set ratio of the actual photo like a legit hacker
|
|
74
75
|
photoRatio = (matchedPhoto.photo.ratio * 100) + "%";
|
|
76
|
+
photoViewport = (matchedPhoto.photo.ratio * 50) + "vw";
|
|
75
77
|
|
|
76
78
|
// If css :root is available, set the photo ratio
|
|
77
79
|
if (r) {
|
|
78
80
|
r.style.setProperty('--img-bottom-padding-ratio', photoRatio);
|
|
81
|
+
r.style.setProperty('--img-height-viewport', photoViewport);
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
fullPath = matchedPhoto.photo.full_path;
|
|
@@ -90,6 +93,7 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, overrideCssList }) => {
|
|
|
90
93
|
// If css :root is available, set the photo ratio
|
|
91
94
|
if (r) {
|
|
92
95
|
r.style.setProperty('--img-bottom-padding-ratio', photoRatio);
|
|
96
|
+
r.style.setProperty('--img-height-viewport', photoViewport);
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
|
|
@@ -99,7 +103,7 @@ const TopperImage = ({ wcm, alt, ratio, wcmData, overrideCssList }) => {
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
return (
|
|
102
|
-
<div ref={picRef}>
|
|
106
|
+
<div className={containerCssList.join(' ')} ref={picRef}>
|
|
103
107
|
<ImageHTML fullPath={fullPath} imageRez={imageRez} alt={alt} overrideCssList={overrideCssList} />
|
|
104
108
|
</div>
|
|
105
109
|
)
|
|
@@ -110,6 +114,7 @@ TopperImage.propTypes = {
|
|
|
110
114
|
alt: PropTypes.string.isRequired,
|
|
111
115
|
ratio: PropTypes.string, // This prop is currently not being used, might be ok to delete?
|
|
112
116
|
wcmData: PropTypes.object,
|
|
117
|
+
containerCssList: PropTypes.array,
|
|
113
118
|
overrideCssList: PropTypes.array
|
|
114
119
|
}
|
|
115
120
|
|
package/example/gatsby-node.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* See: https://www.gatsbyjs.org/docs/node-apis/
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
var {requestImage} = require("./tasks/node-helpers");
|
|
7
|
+
var { requestImage } = require("./tasks/node-helpers");
|
|
8
8
|
let topperData = require("./src/data/topper2_settings.sheet.json");
|
|
9
9
|
|
|
10
10
|
// Import all the WCM photos you'd like to use in this project
|
|
11
11
|
// NOTE: Leave this as an empty array if you aren't importing any WCM photos, but you won't be able to use the WCMImage component
|
|
12
|
-
const wcmPhotos = [20374215]
|
|
12
|
+
const wcmPhotos = ["20374215"]
|
|
13
13
|
|
|
14
14
|
const addValidWcmId = (numStr, wcmPhotos) => {
|
|
15
15
|
let isNum = /^\d+$/.test(numStr.trim())
|
|
@@ -23,11 +23,10 @@ if (numStr.includes(";")) {
|
|
|
23
23
|
for (var num of numList) {
|
|
24
24
|
addValidWcmId(num, wcmPhotos);
|
|
25
25
|
}
|
|
26
|
-
} else {
|
|
26
|
+
} else {
|
|
27
27
|
addValidWcmId(numStr, wcmPhotos);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
// Create nodes so GraphQL can access
|
|
32
31
|
exports.sourceNodes = async ({
|
|
33
32
|
actions,
|