@times-components/article-list 9.10.45 → 9.11.2
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 +30 -0
- package/README.md +2 -17
- package/babel.config.js +13 -5
- package/dist/article-list-empty-state-prop-types.js +16 -1
- package/dist/article-list-empty-state.js +29 -1
- package/dist/article-list-error-prop-types.js +16 -1
- package/dist/article-list-error.js +27 -1
- package/dist/article-list-item-prop-types.js +56 -1
- package/dist/article-list-item-separator.js +23 -1
- package/dist/article-list-item-tracking-events.js +32 -1
- package/dist/article-list-item-with-error.js +48 -1
- package/dist/article-list-item.js +130 -1
- package/dist/article-list-page-error.js +38 -1
- package/dist/article-list-pagination.js +39 -1
- package/dist/article-list-prop-types-base.js +33 -1
- package/dist/article-list-prop-types.js +34 -1
- package/dist/article-list.js +237 -1
- package/dist/styles/index.js +63 -1
- package/dist/styles/responsive.js +62 -1
- package/dist/styles/shared.js +92 -1
- package/dist/utils/index-base.js +18 -1
- package/dist/utils/index.js +29 -1
- package/package.json +26 -31
- package/rnw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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
|
+
## [9.11.2](https://github.com/newsuk/times-components/compare/@times-components/article-list@9.11.1...@times-components/article-list@9.11.2) (2022-09-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **TDP-000:** Image with resize attribute ([#3138](https://github.com/newsuk/times-components/issues/3138)) ([97137e7](https://github.com/newsuk/times-components/commit/97137e7eb0879b9ed12a8cafcc02e4f8639f0be4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [9.11.1](https://github.com/newsuk/times-components/compare/@times-components/article-list@9.11.0...@times-components/article-list@9.11.1) (2022-08-20)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @times-components/article-list
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [9.11.0](https://github.com/newsuk/times-components/compare/@times-components/article-list@9.10.45...@times-components/article-list@9.11.0) (2022-08-18)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* **TDP-1712:** remove react-native foreverrrrr ([#3064](https://github.com/newsuk/times-components/issues/3064)) ([2a20cb5](https://github.com/newsuk/times-components/commit/2a20cb5abc10a4e7ca2d62487967f8fcf4eccb62)), closes [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3050](https://github.com/newsuk/times-components/issues/3050) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3057](https://github.com/newsuk/times-components/issues/3057) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3065](https://github.com/newsuk/times-components/issues/3065) [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3069](https://github.com/newsuk/times-components/issues/3069) [#3068](https://github.com/newsuk/times-components/issues/3068) [#3070](https://github.com/newsuk/times-components/issues/3070) [#3072](https://github.com/newsuk/times-components/issues/3072) [#3073](https://github.com/newsuk/times-components/issues/3073) [#3071](https://github.com/newsuk/times-components/issues/3071) [#3074](https://github.com/newsuk/times-components/issues/3074) [#3076](https://github.com/newsuk/times-components/issues/3076) [#3079](https://github.com/newsuk/times-components/issues/3079) [#3078](https://github.com/newsuk/times-components/issues/3078) [#3083](https://github.com/newsuk/times-components/issues/3083) [#3087](https://github.com/newsuk/times-components/issues/3087) [#3091](https://github.com/newsuk/times-components/issues/3091) [#3096](https://github.com/newsuk/times-components/issues/3096) [#3102](https://github.com/newsuk/times-components/issues/3102) [#3105](https://github.com/newsuk/times-components/issues/3105) [#3108](https://github.com/newsuk/times-components/issues/3108) [#3111](https://github.com/newsuk/times-components/issues/3111) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3113](https://github.com/newsuk/times-components/issues/3113) [#3114](https://github.com/newsuk/times-components/issues/3114) [#3120](https://github.com/newsuk/times-components/issues/3120) [#3119](https://github.com/newsuk/times-components/issues/3119) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3127](https://github.com/newsuk/times-components/issues/3127) [#3116](https://github.com/newsuk/times-components/issues/3116) [#3128](https://github.com/newsuk/times-components/issues/3128) [#3132](https://github.com/newsuk/times-components/issues/3132) [#3133](https://github.com/newsuk/times-components/issues/3133)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [9.10.45](https://github.com/newsuk/times-components/compare/@times-components/article-list@9.10.44...@times-components/article-list@9.10.45) (2022-08-12)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @times-components/article-list
|
package/README.md
CHANGED
|
@@ -7,11 +7,7 @@ are primarily used for the layout of the individual article items themselves.
|
|
|
7
7
|
|
|
8
8
|
## Infinite Scrolling
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
native version contains its own brand of pagination in the form of infinite
|
|
12
|
-
scrolling. This utilises the react-native `FlatList` and the GraphQL `fetchMore`
|
|
13
|
-
method to show more articles when a user has scrolled to the bottom of the
|
|
14
|
-
article list.
|
|
10
|
+
Article list utilises the pagination package for this.
|
|
15
11
|
|
|
16
12
|
## Error Handling
|
|
17
13
|
|
|
@@ -50,8 +46,7 @@ yarn lint
|
|
|
50
46
|
|
|
51
47
|
## Testing
|
|
52
48
|
|
|
53
|
-
This package uses [yarn](https://yarnpkg.com) (latest) to run unit tests
|
|
54
|
-
platform with [jest](https://facebook.github.io/jest/).
|
|
49
|
+
This package uses [yarn](https://yarnpkg.com) (latest) to run unit tests with [jest](https://facebook.github.io/jest/).
|
|
55
50
|
|
|
56
51
|
```
|
|
57
52
|
yarn test:web
|
|
@@ -60,13 +55,3 @@ yarn test:web
|
|
|
60
55
|
Visit the official
|
|
61
56
|
[storybook](http://components.thetimes.co.uk/?knob-Size%20of%20ad%20placeholder%3A=default&selectedKind=Composed%2FArticle%20List&selectedStory=Default%20with%20images&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybooks%2Fstorybook-addon-knobs)
|
|
62
57
|
to see our available article list templates.
|
|
63
|
-
|
|
64
|
-
## Future
|
|
65
|
-
|
|
66
|
-
Inifinite scroll pagination is baked into this package for the native
|
|
67
|
-
experience. We are planning to fish this out into the pagination package in the
|
|
68
|
-
future.
|
|
69
|
-
|
|
70
|
-
A package like
|
|
71
|
-
[`react-virtualized`](https://github.com/bvaughn/react-virtualized) could be
|
|
72
|
-
utilised in the future for infinite scroll on mobweb.
|
package/babel.config.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
module.exports = api => {
|
|
2
2
|
api.cache(true);
|
|
3
3
|
return {
|
|
4
|
-
plugins: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
plugins: ["babel-plugin-styled-components"],
|
|
5
|
+
presets: [
|
|
6
|
+
[
|
|
7
|
+
"@babel/preset-env",
|
|
8
|
+
{
|
|
9
|
+
targets: {
|
|
10
|
+
esmodules: true
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"@babel/preset-react",
|
|
15
|
+
"@babel/preset-typescript"
|
|
16
|
+
]
|
|
9
17
|
};
|
|
10
18
|
};
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const propTypes = {
|
|
13
|
+
message: _propTypes.default.string.isRequired
|
|
14
|
+
};
|
|
15
|
+
var _default = propTypes;
|
|
16
|
+
exports.default = _default;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _utils = require("@times-components/utils");
|
|
11
|
+
|
|
12
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
|
+
|
|
14
|
+
var _articleListEmptyStatePropTypes = _interopRequireDefault(require("./article-list-empty-state-prop-types"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const ArticleListEmptyState = _ref => {
|
|
19
|
+
let message = _ref.message;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_utils.TcView, {
|
|
21
|
+
style: _styles.default.listEmptyStateContainer
|
|
22
|
+
}, /*#__PURE__*/_react.default.createElement(_utils.TcText, {
|
|
23
|
+
style: (0, _utils.checkStylesForUnits)(_styles.default.listEmptyMessage)
|
|
24
|
+
}, message));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
ArticleListEmptyState.propTypes = _articleListEmptyStatePropTypes.default;
|
|
28
|
+
var _default = ArticleListEmptyState;
|
|
29
|
+
exports.default = _default;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const propTypes = {
|
|
13
|
+
refetch: _propTypes.default.func.isRequired
|
|
14
|
+
};
|
|
15
|
+
var _default = propTypes;
|
|
16
|
+
exports.default = _default;
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _utils = require("@times-components/utils");
|
|
11
|
+
|
|
12
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
const ArticleListError = () => /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_utils.TcText, {
|
|
21
|
+
style: (0, _utils.checkStylesForUnits)(_styles.default.listErrorHeading)
|
|
22
|
+
}, "Something's gone wrong"), /*#__PURE__*/_react.default.createElement(_utils.TcText, {
|
|
23
|
+
style: (0, _utils.checkStylesForUnits)(_styles.default.listErrorMessage)
|
|
24
|
+
}, "We can't load the page you have requested. Please check your network connection and retry to continue"));
|
|
25
|
+
|
|
26
|
+
var _default = ArticleListError;
|
|
27
|
+
exports.default = _default;
|
|
@@ -1 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = exports.propTypes = exports.propTypesBase = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
|
+
|
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
|
|
18
|
+
const propTypesBase = {
|
|
19
|
+
article: _propTypes.default.shape({
|
|
20
|
+
headline: _propTypes.default.string,
|
|
21
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
22
|
+
label: _propTypes.default.string,
|
|
23
|
+
leadAsset: _propTypes.default.shape({
|
|
24
|
+
crop: _propTypes.default.shape({
|
|
25
|
+
url: _propTypes.default.string
|
|
26
|
+
}),
|
|
27
|
+
title: _propTypes.default.string
|
|
28
|
+
}),
|
|
29
|
+
longSummary: _propTypes.default.array,
|
|
30
|
+
publicationName: _propTypes.default.string,
|
|
31
|
+
publishedTime: _propTypes.default.string,
|
|
32
|
+
shortHeadline: _propTypes.default.string,
|
|
33
|
+
shortSummary: _propTypes.default.array,
|
|
34
|
+
summary: _propTypes.default.array,
|
|
35
|
+
url: _propTypes.default.string
|
|
36
|
+
}),
|
|
37
|
+
fadeImageIn: _propTypes.default.bool,
|
|
38
|
+
highResSize: _propTypes.default.number
|
|
39
|
+
};
|
|
40
|
+
exports.propTypesBase = propTypesBase;
|
|
41
|
+
|
|
42
|
+
const propTypes = _objectSpread(_objectSpread({}, propTypesBase), {}, {
|
|
43
|
+
imageRatio: _propTypes.default.number,
|
|
44
|
+
showImage: _propTypes.default.bool
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
exports.propTypes = propTypes;
|
|
48
|
+
const defaultProps = {
|
|
49
|
+
article: null,
|
|
50
|
+
fadeImageIn: false,
|
|
51
|
+
highResSize: null,
|
|
52
|
+
imageRatio: 1,
|
|
53
|
+
showImage: true,
|
|
54
|
+
summary: []
|
|
55
|
+
};
|
|
56
|
+
exports.defaultProps = defaultProps;
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _utils = require("@times-components/utils");
|
|
11
|
+
|
|
12
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
|
+
|
|
14
|
+
var _responsive = require("./styles/responsive");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const ArticleListItemSeparator = () => /*#__PURE__*/_react.default.createElement(_responsive.ListItemSeparator, null, /*#__PURE__*/_react.default.createElement(_utils.TcView, {
|
|
19
|
+
style: _styles.default.listItemSeparator
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
var _default = ArticleListItemSeparator;
|
|
23
|
+
exports.default = _default;
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _tracking = require("@times-components/tracking");
|
|
9
|
+
|
|
10
|
+
var _default = Component => (0, _tracking.withTrackEvents)(Component, {
|
|
11
|
+
analyticsEvents: [{
|
|
12
|
+
actionName: "Pressed",
|
|
13
|
+
eventName: "onPress",
|
|
14
|
+
getAttrs: _ref => {
|
|
15
|
+
let _ref$article = _ref.article,
|
|
16
|
+
headline = _ref$article.headline,
|
|
17
|
+
id = _ref$article.id,
|
|
18
|
+
index = _ref.index,
|
|
19
|
+
length = _ref.length;
|
|
20
|
+
return {
|
|
21
|
+
articleHeadline: headline,
|
|
22
|
+
articleId: id,
|
|
23
|
+
scrollDepth: {
|
|
24
|
+
itemNumber: index + 1,
|
|
25
|
+
total: length
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}]
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
exports.default = _default;
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _errorView = _interopRequireDefault(require("@times-components/error-view"));
|
|
11
|
+
|
|
12
|
+
var _articleListItem = _interopRequireDefault(require("./article-list-item"));
|
|
13
|
+
|
|
14
|
+
var _articleListItemPropTypes = require("./article-list-item-prop-types");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
class ArticleListItemWithError extends _react.Component {
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(props);
|
|
25
|
+
this.renderWithErrorBoundary = this.renderWithErrorBoundary.bind(this);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
shouldComponentUpdate(nextProps) {
|
|
29
|
+
const article = this.props.article;
|
|
30
|
+
const nextArticle = nextProps.article;
|
|
31
|
+
return !article || !nextArticle || nextArticle.elementId !== article.elementId;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
renderWithErrorBoundary(_ref) {
|
|
35
|
+
let hasError = _ref.hasError;
|
|
36
|
+
return hasError ? null : /*#__PURE__*/_react.default.createElement(_articleListItem.default, this.props);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_errorView.default, null, this.renderWithErrorBoundary);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ArticleListItemWithError.propTypes = _articleListItemPropTypes.propTypes;
|
|
46
|
+
ArticleListItemWithError.defaultProps = _articleListItemPropTypes.defaultProps;
|
|
47
|
+
var _default = ArticleListItemWithError;
|
|
48
|
+
exports.default = _default;
|
|
@@ -1 +1,130 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _articleSummary = _interopRequireWildcard(require("@times-components/article-summary"));
|
|
11
|
+
|
|
12
|
+
var _card = _interopRequireDefault(require("@times-components/card"));
|
|
13
|
+
|
|
14
|
+
var _context = _interopRequireDefault(require("@times-components/context"));
|
|
15
|
+
|
|
16
|
+
var _link = _interopRequireDefault(require("@times-components/link"));
|
|
17
|
+
|
|
18
|
+
var _tsStyleguide = require("@times-components/ts-styleguide");
|
|
19
|
+
|
|
20
|
+
var _articleListItemTrackingEvents = _interopRequireDefault(require("./article-list-item-tracking-events"));
|
|
21
|
+
|
|
22
|
+
var _articleListItemPropTypes = require("./article-list-item-prop-types");
|
|
23
|
+
|
|
24
|
+
var _utils = require("./utils");
|
|
25
|
+
|
|
26
|
+
var _responsive = require("./styles/responsive");
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
+
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
34
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
35
|
+
|
|
36
|
+
const ArticleListItem = props => {
|
|
37
|
+
const article = props.article,
|
|
38
|
+
fadeImageIn = props.fadeImageIn,
|
|
39
|
+
highResSize = props.highResSize,
|
|
40
|
+
imageRatio = props.imageRatio,
|
|
41
|
+
isLoading = props.isLoading,
|
|
42
|
+
lowResQuality = props.lowResQuality,
|
|
43
|
+
lowResSize = props.lowResSize,
|
|
44
|
+
showImage = props.showImage;
|
|
45
|
+
|
|
46
|
+
const _ref = article || {},
|
|
47
|
+
bylines = _ref.bylines,
|
|
48
|
+
hasVideo = _ref.hasVideo,
|
|
49
|
+
headline = _ref.headline,
|
|
50
|
+
label = _ref.label,
|
|
51
|
+
leadAsset = _ref.leadAsset,
|
|
52
|
+
longSummary = _ref.longSummary,
|
|
53
|
+
publicationName = _ref.publicationName,
|
|
54
|
+
publishedTime = _ref.publishedTime,
|
|
55
|
+
section = _ref.section,
|
|
56
|
+
shortHeadline = _ref.shortHeadline,
|
|
57
|
+
shortSummary = _ref.shortSummary,
|
|
58
|
+
summary = _ref.summary;
|
|
59
|
+
|
|
60
|
+
const imageUri = (0, _utils.getImageUri)(article);
|
|
61
|
+
const imageAccessibilityLabel = leadAsset && leadAsset.caption || "";
|
|
62
|
+
|
|
63
|
+
if (isLoading) {
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_responsive.ListItemWrapper, null, /*#__PURE__*/_react.default.createElement(_card.default, {
|
|
65
|
+
contentContainerClass: "articleListContent",
|
|
66
|
+
imageContainerClass: "articleListImage",
|
|
67
|
+
imageRatio: imageRatio,
|
|
68
|
+
isLoading: isLoading,
|
|
69
|
+
showImage: showImage
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const childProps = {
|
|
74
|
+
bylineProps: bylines ? {
|
|
75
|
+
ast: bylines,
|
|
76
|
+
color: _tsStyleguide.colours.section.default
|
|
77
|
+
} : null,
|
|
78
|
+
datePublicationProps: {
|
|
79
|
+
date: publishedTime,
|
|
80
|
+
publication: publicationName
|
|
81
|
+
},
|
|
82
|
+
headline: /*#__PURE__*/_react.default.createElement(_articleSummary.ArticleSummaryHeadline, {
|
|
83
|
+
headline: (0, _utils.getHeadline)(headline, shortHeadline)
|
|
84
|
+
}),
|
|
85
|
+
labelProps: {
|
|
86
|
+
color: _tsStyleguide.colours.section[section] || _tsStyleguide.colours.section.default,
|
|
87
|
+
isVideo: hasVideo,
|
|
88
|
+
title: label
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const children = showImage ? /*#__PURE__*/_react.default.createElement(_articleSummary.default, _extends({}, childProps, {
|
|
92
|
+
content: /*#__PURE__*/_react.default.createElement(_articleSummary.ArticleSummaryContent, {
|
|
93
|
+
ast: summary
|
|
94
|
+
})
|
|
95
|
+
})) : /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_responsive.ListItemLongText, null, /*#__PURE__*/_react.default.createElement(_articleSummary.default, _extends({}, childProps, {
|
|
96
|
+
content: /*#__PURE__*/_react.default.createElement(_articleSummary.ArticleSummaryContent, {
|
|
97
|
+
ast: longSummary
|
|
98
|
+
})
|
|
99
|
+
}))), /*#__PURE__*/_react.default.createElement(_responsive.ListItemShortText, null, /*#__PURE__*/_react.default.createElement(_articleSummary.default, _extends({}, childProps, {
|
|
100
|
+
content: /*#__PURE__*/_react.default.createElement(_articleSummary.ArticleSummaryContent, {
|
|
101
|
+
ast: shortSummary
|
|
102
|
+
})
|
|
103
|
+
}))));
|
|
104
|
+
return /*#__PURE__*/_react.default.createElement(_context.default.Consumer, null, _ref2 => {
|
|
105
|
+
let makeArticleUrl = _ref2.makeArticleUrl;
|
|
106
|
+
const canonicalUrl = makeArticleUrl(props.article);
|
|
107
|
+
return /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
108
|
+
url: canonicalUrl
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(_responsive.ListItemWrapper, null, /*#__PURE__*/_react.default.createElement(_card.default, {
|
|
110
|
+
contentContainerClass: "articleListContent",
|
|
111
|
+
fadeImageIn: fadeImageIn,
|
|
112
|
+
highResSize: highResSize,
|
|
113
|
+
imageAccessibilityLabel: imageAccessibilityLabel,
|
|
114
|
+
imageContainerClass: "articleListImage",
|
|
115
|
+
imageRatio: imageRatio,
|
|
116
|
+
imageUri: imageUri,
|
|
117
|
+
isLoading: isLoading,
|
|
118
|
+
lowResQuality: lowResQuality,
|
|
119
|
+
lowResSize: lowResSize,
|
|
120
|
+
showImage: showImage
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_tsStyleguide.Animations.FadeIn, null, children))));
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
ArticleListItem.propTypes = _articleListItemPropTypes.propTypes;
|
|
126
|
+
ArticleListItem.defaultProps = _articleListItemPropTypes.defaultProps;
|
|
127
|
+
|
|
128
|
+
var _default = (0, _articleListItemTrackingEvents.default)(ArticleListItem);
|
|
129
|
+
|
|
130
|
+
exports.default = _default;
|
|
@@ -1 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _button = _interopRequireDefault(require("@times-components/button"));
|
|
11
|
+
|
|
12
|
+
var _image = _interopRequireDefault(require("@times-components/image"));
|
|
13
|
+
|
|
14
|
+
var _articleListError = _interopRequireDefault(require("./article-list-error"));
|
|
15
|
+
|
|
16
|
+
var _articleListErrorPropTypes = _interopRequireDefault(require("./article-list-error-prop-types"));
|
|
17
|
+
|
|
18
|
+
var _responsive = require("./styles/responsive");
|
|
19
|
+
|
|
20
|
+
var _index = require("./styles/index");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
const ArticleListPageError = _ref => {
|
|
25
|
+
let refetch = _ref.refetch;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_responsive.PageErrorContainer, null, /*#__PURE__*/_react.default.createElement(_responsive.PageErrorImageContainer, null, /*#__PURE__*/_react.default.createElement(_image.default, {
|
|
27
|
+
aspectRatio: 700 / 770,
|
|
28
|
+
uri: "https://www.thetimes.co.uk/d/img/internal-error-c45d0e8347.png"
|
|
29
|
+
})), /*#__PURE__*/_react.default.createElement(_responsive.PageErrorContentContainer, null, /*#__PURE__*/_react.default.createElement(_articleListError.default, null), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
30
|
+
onPress: refetch,
|
|
31
|
+
style: _index.retryButtonStyles,
|
|
32
|
+
title: "Retry"
|
|
33
|
+
})));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
ArticleListPageError.propTypes = _articleListErrorPropTypes.default;
|
|
37
|
+
var _default = ArticleListPageError;
|
|
38
|
+
exports.default = _default;
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _utils = require("@times-components/utils");
|
|
11
|
+
|
|
12
|
+
var _pagination = _interopRequireDefault(require("@times-components/pagination"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
const ArticleListPagination = props => /*#__PURE__*/_react.default.createElement(_utils.TcView, {
|
|
23
|
+
style: _styles.default.paginationContainer
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement(_utils.TcView, {
|
|
25
|
+
style: _styles.default.paginationSpacing
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement(_pagination.default, _extends({}, props, {
|
|
27
|
+
generatePageLink: pageNum => "?page=".concat(pageNum)
|
|
28
|
+
}))));
|
|
29
|
+
|
|
30
|
+
ArticleListPagination.propTypes = {
|
|
31
|
+
count: _propTypes.default.number.isRequired,
|
|
32
|
+
hideResults: _propTypes.default.bool.isRequired,
|
|
33
|
+
onNext: _propTypes.default.func.isRequired,
|
|
34
|
+
onPrev: _propTypes.default.func.isRequired,
|
|
35
|
+
page: _propTypes.default.number.isRequired,
|
|
36
|
+
pageSize: _propTypes.default.number.isRequired
|
|
37
|
+
};
|
|
38
|
+
var _default = ArticleListPagination;
|
|
39
|
+
exports.default = _default;
|