@twreporter/react-article-components 1.6.5-rc.1 → 1.7.0-rc.0
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.7.0-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-article-components@1.6.5-rc.1...@twreporter/react-article-components@1.7.0-rc.0) (2022-09-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **react-article-components:** add lazyload to <img> ([43598a0](https://github.com/twreporter/twreporter-npm-packages/commit/43598a01a9aaa388ce47facdb7f87ead31670995))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.6.5-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-article-components@1.6.5-rc.0...@twreporter/react-article-components@1.6.5-rc.1) (2022-09-21)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @twreporter/react-article-components
|
|
@@ -238,7 +238,8 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
238
238
|
defaultImage = _this$props2.defaultImage,
|
|
239
239
|
objectFit = _this$props2.objectFit,
|
|
240
240
|
objectPosition = _this$props2.objectPosition,
|
|
241
|
-
sizes = _this$props2.sizes
|
|
241
|
+
sizes = _this$props2.sizes,
|
|
242
|
+
isLazyLoaded = _this$props2.isLazyLoaded;
|
|
242
243
|
var appendedClassName = className + ' avoid-break';
|
|
243
244
|
|
|
244
245
|
var defaultImageOriginalUrl = _.get(defaultImage, 'url');
|
|
@@ -276,7 +277,8 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
276
277
|
sizes: this._supportObjectFit ? sizes : '',
|
|
277
278
|
src: defaultImageSrc,
|
|
278
279
|
srcSet: this._supportObjectFit ? srcset : '',
|
|
279
|
-
hide: !this._supportObjectFit
|
|
280
|
+
hide: !this._supportObjectFit,
|
|
281
|
+
loading: isLazyLoaded ? 'lazy' : 'eager'
|
|
280
282
|
}, imgProps)), this._supportObjectFit ? null : /*#__PURE__*/_react["default"].createElement(FallbackObjectFitImg, {
|
|
281
283
|
url: _.get(defaultImage, 'url'),
|
|
282
284
|
objectFit: objectFit,
|
|
@@ -287,7 +289,8 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
287
289
|
ref: this._img,
|
|
288
290
|
sizes: sizes,
|
|
289
291
|
src: defaultImageSrc,
|
|
290
|
-
srcSet: srcset
|
|
292
|
+
srcSet: srcset,
|
|
293
|
+
loading: isLazyLoaded ? 'lazy' : 'eager'
|
|
291
294
|
}, imgProps))));
|
|
292
295
|
}
|
|
293
296
|
}]);
|
|
@@ -313,7 +316,8 @@ _defineProperty(Img, "propTypes", {
|
|
|
313
316
|
imageSet: _propTypes["default"].arrayOf(_imgWithPlaceholder["default"].imagePropType),
|
|
314
317
|
objectFit: _propTypes["default"].oneOf([objectFitConsts.cover, objectFitConsts.contain]),
|
|
315
318
|
objectPosition: _propTypes["default"].string,
|
|
316
|
-
sizes: _propTypes["default"].string.isRequired
|
|
319
|
+
sizes: _propTypes["default"].string.isRequired,
|
|
320
|
+
isLazyLoaded: _propTypes["default"].bool
|
|
317
321
|
});
|
|
318
322
|
|
|
319
323
|
_defineProperty(Img, "defaultProps", {
|
|
@@ -325,5 +329,6 @@ _defineProperty(Img, "defaultProps", {
|
|
|
325
329
|
imgProps: {},
|
|
326
330
|
placeholderNoBlur: false,
|
|
327
331
|
noImgPlaceholder: false,
|
|
328
|
-
sizes: ''
|
|
332
|
+
sizes: '',
|
|
333
|
+
isLazyLoaded: true
|
|
329
334
|
});
|
|
@@ -147,7 +147,8 @@ var FullScreenLeading = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
147
147
|
defaultImage: poster.mobile,
|
|
148
148
|
objectFit: "cover",
|
|
149
149
|
objectPostion: "center center",
|
|
150
|
-
sizes: "(max-width: 800px) 800px, (max-width: 1200px) 1200px, 2000px"
|
|
150
|
+
sizes: "(max-width: 800px) 800px, (max-width: 1200px) 1200px, 2000px",
|
|
151
|
+
isLazyLoaded: false
|
|
151
152
|
}));
|
|
152
153
|
|
|
153
154
|
if (!this.isEmptyPortraitPoster(portraitPoster)) {
|
|
@@ -157,7 +158,8 @@ var FullScreenLeading = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
157
158
|
imageSet: [portraitPoster.mobile],
|
|
158
159
|
defaultImage: portraitPoster.mobile,
|
|
159
160
|
objectFit: "cover",
|
|
160
|
-
objectPostion: "center center"
|
|
161
|
+
objectPostion: "center center",
|
|
162
|
+
isLazyLoaded: false
|
|
161
163
|
})));
|
|
162
164
|
}
|
|
163
165
|
|
|
@@ -163,7 +163,8 @@ var NormalLeading = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
163
163
|
imgPlaceholderSrc: _.get(poster, 'tiny.url', ''),
|
|
164
164
|
imageSet: [poster.mobile, poster.tablet, poster.desktop],
|
|
165
165
|
defaultImage: poster.mobile,
|
|
166
|
-
sizes: "(max-width: 800px) 800px, (max-width: 1200px) 1200px, 2000px"
|
|
166
|
+
sizes: "(max-width: 800px) 800px, (max-width: 1200px) 1200px, 2000px",
|
|
167
|
+
isLazyLoaded: false
|
|
167
168
|
}), figureCaption ? /*#__PURE__*/_react["default"].createElement(FigCaption, null, figureCaption) : null)));
|
|
168
169
|
}
|
|
169
170
|
}]);
|
|
@@ -157,7 +157,8 @@ var LeadingBlock = /*#__PURE__*/function (_PureComponent) {
|
|
|
157
157
|
defaultImage: poster.mobile,
|
|
158
158
|
objectFit: "cover",
|
|
159
159
|
objectPostion: "center center",
|
|
160
|
-
sizes: "(max-width: 800px) 800px, (max-width: 1200px) 1200px, 2000px"
|
|
160
|
+
sizes: "(max-width: 800px) 800px, (max-width: 1200px) 1200px, 2000px",
|
|
161
|
+
isLazyLoaded: false
|
|
161
162
|
}))));
|
|
162
163
|
}
|
|
163
164
|
}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-article-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-rc.0",
|
|
4
4
|
"description": "The Reporter react article components, which are used in article page",
|
|
5
5
|
"main": "lib/components/article-page.js",
|
|
6
6
|
"repository": "https://github.com/twreporter/twreporter-npm-packages.git",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"files": [
|
|
41
41
|
"lib"
|
|
42
42
|
],
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "19542aee7205187cc4ef21a908bf09a0fbb1572c"
|
|
44
44
|
}
|