@mjhls/mjh-framework 1.0.814 → 1.0.815
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/dist/cjs/GridHero.js +16 -4
- package/dist/esm/GridHero.js +16 -4
- package/package.json +1 -1
package/dist/cjs/GridHero.js
CHANGED
|
@@ -23,17 +23,29 @@ var GridHero = function GridHero(props) {
|
|
|
23
23
|
var topArticle = props.dataRecord[0];
|
|
24
24
|
var subArticles = props.dataRecord.slice(1, 3);
|
|
25
25
|
|
|
26
|
-
var client = props.client
|
|
26
|
+
var client = props.client,
|
|
27
|
+
_props$topWidth = props.topWidth,
|
|
28
|
+
topWidth = _props$topWidth === undefined ? 600 : _props$topWidth,
|
|
29
|
+
_props$subWidth = props.subWidth,
|
|
30
|
+
subWidth = _props$subWidth === undefined ? 480 : _props$subWidth,
|
|
31
|
+
_props$subHeight = props.subHeight,
|
|
32
|
+
subHeight = _props$subHeight === undefined ? 270 : _props$subHeight;
|
|
27
33
|
|
|
28
34
|
var builder = index.imageUrlBuilder(client);
|
|
29
35
|
function urlFor(source) {
|
|
30
|
-
|
|
36
|
+
var imageWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
37
|
+
var imageHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
38
|
+
|
|
39
|
+
var url = builder.image(source);
|
|
40
|
+
if (imageWidth) url = url.width(imageWidth);
|
|
41
|
+
if (imageHeight) url = url.height(imageHeight);
|
|
42
|
+
return url.auto('format').url();
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
var topArticleThumbnail = '';
|
|
34
46
|
var topArticleAltText = topArticle.title;
|
|
35
47
|
if (topArticle.thumbnail && topArticle.thumbnail.asset) {
|
|
36
|
-
topArticleThumbnail = urlFor(topArticle.thumbnail.asset)
|
|
48
|
+
topArticleThumbnail = urlFor(topArticle.thumbnail.asset, topWidth);
|
|
37
49
|
topArticleAltText = topArticle.thumbnail.asset.originalFileName;
|
|
38
50
|
} else if (props.thumbnail) {
|
|
39
51
|
topArticleThumbnail = props.thumbnail;
|
|
@@ -90,7 +102,7 @@ var GridHero = function GridHero(props) {
|
|
|
90
102
|
var articleThumbnail = '';
|
|
91
103
|
var articleAltText = article.title;
|
|
92
104
|
if (article.thumbnail && article.thumbnail.asset) {
|
|
93
|
-
articleThumbnail = urlFor(article.thumbnail.asset)
|
|
105
|
+
articleThumbnail = urlFor(article.thumbnail.asset, subWidth, subHeight);
|
|
94
106
|
articleAltText = article.thumbnail.asset.originalFileName;
|
|
95
107
|
} else if (props.thumbnail) {
|
|
96
108
|
articleThumbnail = props.thumbnail;
|
package/dist/esm/GridHero.js
CHANGED
|
@@ -17,17 +17,29 @@ var GridHero = function GridHero(props) {
|
|
|
17
17
|
var topArticle = props.dataRecord[0];
|
|
18
18
|
var subArticles = props.dataRecord.slice(1, 3);
|
|
19
19
|
|
|
20
|
-
var client = props.client
|
|
20
|
+
var client = props.client,
|
|
21
|
+
_props$topWidth = props.topWidth,
|
|
22
|
+
topWidth = _props$topWidth === undefined ? 600 : _props$topWidth,
|
|
23
|
+
_props$subWidth = props.subWidth,
|
|
24
|
+
subWidth = _props$subWidth === undefined ? 480 : _props$subWidth,
|
|
25
|
+
_props$subHeight = props.subHeight,
|
|
26
|
+
subHeight = _props$subHeight === undefined ? 270 : _props$subHeight;
|
|
21
27
|
|
|
22
28
|
var builder = imageUrlBuilder(client);
|
|
23
29
|
function urlFor(source) {
|
|
24
|
-
|
|
30
|
+
var imageWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
31
|
+
var imageHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
32
|
+
|
|
33
|
+
var url = builder.image(source);
|
|
34
|
+
if (imageWidth) url = url.width(imageWidth);
|
|
35
|
+
if (imageHeight) url = url.height(imageHeight);
|
|
36
|
+
return url.auto('format').url();
|
|
25
37
|
}
|
|
26
38
|
|
|
27
39
|
var topArticleThumbnail = '';
|
|
28
40
|
var topArticleAltText = topArticle.title;
|
|
29
41
|
if (topArticle.thumbnail && topArticle.thumbnail.asset) {
|
|
30
|
-
topArticleThumbnail = urlFor(topArticle.thumbnail.asset)
|
|
42
|
+
topArticleThumbnail = urlFor(topArticle.thumbnail.asset, topWidth);
|
|
31
43
|
topArticleAltText = topArticle.thumbnail.asset.originalFileName;
|
|
32
44
|
} else if (props.thumbnail) {
|
|
33
45
|
topArticleThumbnail = props.thumbnail;
|
|
@@ -84,7 +96,7 @@ var GridHero = function GridHero(props) {
|
|
|
84
96
|
var articleThumbnail = '';
|
|
85
97
|
var articleAltText = article.title;
|
|
86
98
|
if (article.thumbnail && article.thumbnail.asset) {
|
|
87
|
-
articleThumbnail = urlFor(article.thumbnail.asset)
|
|
99
|
+
articleThumbnail = urlFor(article.thumbnail.asset, subWidth, subHeight);
|
|
88
100
|
articleAltText = article.thumbnail.asset.originalFileName;
|
|
89
101
|
} else if (props.thumbnail) {
|
|
90
102
|
articleThumbnail = props.thumbnail;
|