@twreporter/react-components 8.5.0-rc.1
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 +544 -0
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/lib/bookmark-list/bookmark.js +251 -0
- package/lib/bookmark-list/bookmarks.js +93 -0
- package/lib/bookmark-list/customized-link.js +45 -0
- package/lib/bookmark-list/image-wrapper.js +119 -0
- package/lib/bookmark-list/index.js +312 -0
- package/lib/bookmark-list/redirect-to-sign-in.js +35 -0
- package/lib/bookmark-widget/index.js +259 -0
- package/lib/confirmation/index.js +125 -0
- package/lib/donation-link.js +75 -0
- package/lib/error/index.js +17 -0
- package/lib/error/message.js +567 -0
- package/lib/footer/constants/paths.js +8 -0
- package/lib/footer/constants/styles.js +81 -0
- package/lib/footer/content.js +227 -0
- package/lib/footer/icon-list.js +191 -0
- package/lib/footer/index.js +123 -0
- package/lib/footer/logo.js +92 -0
- package/lib/is-fetching-wrapper.js +126 -0
- package/lib/link-with-tracker.js +153 -0
- package/lib/listing-page/components/image.js +185 -0
- package/lib/listing-page/components/list-item.js +197 -0
- package/lib/listing-page/components/list.js +188 -0
- package/lib/listing-page/components/topics/index.js +215 -0
- package/lib/listing-page/components/topics/page-content.js +44 -0
- package/lib/listing-page/components/topics/post-item.js +139 -0
- package/lib/listing-page/components/topics/posts.js +24 -0
- package/lib/listing-page/components/topics/section.js +104 -0
- package/lib/listing-page/components/topics/topic-item.js +206 -0
- package/lib/listing-page/constants/mockup-spec.js +39 -0
- package/lib/listing-page/constants/predefined-css.js +21 -0
- package/lib/listing-page/constants/topics.js +13 -0
- package/lib/listing-page/index.js +30 -0
- package/lib/mobile-pop-up-modal.js +161 -0
- package/lib/more.js +98 -0
- package/lib/pagination/index.js +310 -0
- package/lib/podcast-link.js +73 -0
- package/lib/side-bar/index.js +317 -0
- package/lib/table-of-contents/index.js +532 -0
- package/lib/utils/link-with-params.js +27 -0
- package/package.json +33 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _excluded = ["modalHeight", "modalWidth"];
|
|
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
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
+
|
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
+
|
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
+
|
|
28
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
|
+
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
31
|
+
|
|
32
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
|
+
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
|
+
|
|
38
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
39
|
+
|
|
40
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
+
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
+
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
var Modal = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
49
|
+
displayName: "mobile-pop-up-modal__Modal",
|
|
50
|
+
componentId: "sc-1m2meeu-0"
|
|
51
|
+
})(["height:", ";width:", ";position:fixed;top:0;z-index:1000;overflow-y:scroll;max-height:-webkit-fill-available;"], function (props) {
|
|
52
|
+
return props.height;
|
|
53
|
+
}, function (props) {
|
|
54
|
+
return props.width;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
var MobileModal = /*#__PURE__*/function (_React$PureComponent) {
|
|
58
|
+
_inherits(MobileModal, _React$PureComponent);
|
|
59
|
+
|
|
60
|
+
var _super = _createSuper(MobileModal);
|
|
61
|
+
|
|
62
|
+
function MobileModal(props) {
|
|
63
|
+
var _this;
|
|
64
|
+
|
|
65
|
+
_classCallCheck(this, MobileModal);
|
|
66
|
+
|
|
67
|
+
_this = _super.call(this, props);
|
|
68
|
+
|
|
69
|
+
_defineProperty(_assertThisInitialized(_this), "_handleTouchmoveWhenPanning", function (event) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
|
|
72
|
+
_this._updateScrollY(event.changedTouches[0].screenY);
|
|
73
|
+
|
|
74
|
+
_this._updateStartY(event.changedTouches[0].screenY);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
_this.startY = 0;
|
|
78
|
+
_this.panel = /*#__PURE__*/_react["default"].createRef();
|
|
79
|
+
_this.handleTouchstartWhenPanning = _this._handleTouchstartWhenPanning.bind(_assertThisInitialized(_this));
|
|
80
|
+
_this.handleTouchendWhenPanning = _this._handleTouchendWhenPanning.bind(_assertThisInitialized(_this));
|
|
81
|
+
_this.handleTouchmoveWhenPanning = _this._handleTouchmoveWhenPanning.bind(_assertThisInitialized(_this));
|
|
82
|
+
return _this;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_createClass(MobileModal, [{
|
|
86
|
+
key: "componentDidMount",
|
|
87
|
+
value: function componentDidMount() {
|
|
88
|
+
window.document.body.addEventListener('touchstart', this.handleTouchstartWhenPanning, {
|
|
89
|
+
passive: false
|
|
90
|
+
});
|
|
91
|
+
window.document.body.addEventListener('touchend', this.handleTouchendWhenPanning, {
|
|
92
|
+
passive: false
|
|
93
|
+
});
|
|
94
|
+
window.document.body.addEventListener('touchmove', this.handleTouchmoveWhenPanning, {
|
|
95
|
+
passive: false
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "componentWillUnmount",
|
|
100
|
+
value: function componentWillUnmount() {
|
|
101
|
+
window.document.body.removeEventListener('touchstart', this.handleTouchstartWhenPanning, {
|
|
102
|
+
passive: false
|
|
103
|
+
});
|
|
104
|
+
window.document.body.removeEventListener('touchend', this.handleTouchendWhenPanning, {
|
|
105
|
+
passive: false
|
|
106
|
+
});
|
|
107
|
+
window.document.body.removeEventListener('touchmove', this.handleTouchmoveWhenPanning, {
|
|
108
|
+
passive: false
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "_updateStartY",
|
|
113
|
+
value: function _updateStartY(startY) {
|
|
114
|
+
this.startY = startY;
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "_updateScrollY",
|
|
118
|
+
value: function _updateScrollY(endY) {
|
|
119
|
+
this.panel.current.scrollTop += this.startY - endY;
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "_handleTouchstartWhenPanning",
|
|
123
|
+
value: function _handleTouchstartWhenPanning(event) {
|
|
124
|
+
this._updateStartY(event.touches[0].screenY);
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "_handleTouchendWhenPanning",
|
|
128
|
+
value: function _handleTouchendWhenPanning(event) {
|
|
129
|
+
this._updateScrollY(event.changedTouches[0].screenY);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "render",
|
|
133
|
+
value: function render() {
|
|
134
|
+
var _this$props = this.props,
|
|
135
|
+
modalHeight = _this$props.modalHeight,
|
|
136
|
+
modalWidth = _this$props.modalWidth,
|
|
137
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
138
|
+
|
|
139
|
+
return /*#__PURE__*/_react["default"].createElement(Modal, _extends({
|
|
140
|
+
height: modalHeight,
|
|
141
|
+
width: modalWidth,
|
|
142
|
+
ref: this.panel
|
|
143
|
+
}, rest));
|
|
144
|
+
}
|
|
145
|
+
}]);
|
|
146
|
+
|
|
147
|
+
return MobileModal;
|
|
148
|
+
}(_react["default"].PureComponent);
|
|
149
|
+
|
|
150
|
+
_defineProperty(MobileModal, "propTypes", {
|
|
151
|
+
modalHeight: _propTypes["default"].string,
|
|
152
|
+
modalWidth: _propTypes["default"].string
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
_defineProperty(MobileModal, "defaultProps", {
|
|
156
|
+
modalHeight: '100vh',
|
|
157
|
+
modalWidth: '100vw'
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
var _default = MobileModal;
|
|
161
|
+
exports["default"] = _default;
|
package/lib/more.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
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
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
+
|
|
24
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
|
+
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
27
|
+
|
|
28
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
+
|
|
30
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
+
|
|
32
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
+
|
|
34
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
|
+
|
|
36
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
+
|
|
38
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
+
|
|
40
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
44
|
+
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
45
|
+
displayName: "more__Container",
|
|
46
|
+
componentId: "sc-1sv8d16-0"
|
|
47
|
+
})(["cursor:pointer;width:100%;height:105px;background-color:black;text-align:center;&:hover,&:focus{polyline{stroke-width:3;}}&active{polyline{stroke-width:6;transition:all 100ms ease-in-out;}}polyline{transition:all 250ms ease-in-out;}@media only screen and (max-width:799px){height:76px;padding-top:10px;& > span{line-height:30px;font-size:16px;}}"]);
|
|
48
|
+
|
|
49
|
+
var Label = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
50
|
+
displayName: "more__Label",
|
|
51
|
+
componentId: "sc-1sv8d16-1"
|
|
52
|
+
})(["color:white;line-height:70px;font-size:18px;font-weight:700;"]);
|
|
53
|
+
|
|
54
|
+
var More = /*#__PURE__*/function (_Component) {
|
|
55
|
+
_inherits(More, _Component);
|
|
56
|
+
|
|
57
|
+
var _super = _createSuper(More);
|
|
58
|
+
|
|
59
|
+
function More() {
|
|
60
|
+
_classCallCheck(this, More);
|
|
61
|
+
|
|
62
|
+
return _super.apply(this, arguments);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_createClass(More, [{
|
|
66
|
+
key: "render",
|
|
67
|
+
value: function render() {
|
|
68
|
+
var _this$props = this.props,
|
|
69
|
+
loadMore = _this$props.loadMore,
|
|
70
|
+
children = _this$props.children;
|
|
71
|
+
var points = '0,0 25,10 50,0';
|
|
72
|
+
var width = 50;
|
|
73
|
+
var height = 11;
|
|
74
|
+
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
75
|
+
onClick: loadMore
|
|
76
|
+
}, children ? _react["default"].Children.only(children) : /*#__PURE__*/_react["default"].createElement(Label, null, "\u66F4\u591A\u6587\u7AE0"), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("svg", {
|
|
77
|
+
width: width,
|
|
78
|
+
height: height
|
|
79
|
+
}, /*#__PURE__*/_react["default"].createElement("polyline", {
|
|
80
|
+
points: points,
|
|
81
|
+
fill: "none",
|
|
82
|
+
stroke: "#FFFFFF",
|
|
83
|
+
strokeWidth: "2",
|
|
84
|
+
strokeLinecap: "round",
|
|
85
|
+
strokeLinejoin: "round"
|
|
86
|
+
}))));
|
|
87
|
+
}
|
|
88
|
+
}]);
|
|
89
|
+
|
|
90
|
+
return More;
|
|
91
|
+
}(_react.Component);
|
|
92
|
+
|
|
93
|
+
exports["default"] = More;
|
|
94
|
+
|
|
95
|
+
_defineProperty(More, "propTypes", {
|
|
96
|
+
children: _propTypes["default"].node,
|
|
97
|
+
loadMore: _propTypes["default"].func.isRequired
|
|
98
|
+
});
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _predefinedCss = require("@twreporter/core/lib/constants/predefined-css");
|
|
11
|
+
|
|
12
|
+
var _css = require("@twreporter/core/lib/utils/css");
|
|
13
|
+
|
|
14
|
+
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
|
|
20
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
|
+
|
|
22
|
+
var _concat = _interopRequireDefault(require("lodash/concat"));
|
|
23
|
+
|
|
24
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
25
|
+
|
|
26
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
+
|
|
30
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
+
|
|
32
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
33
|
+
|
|
34
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
35
|
+
|
|
36
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
|
+
|
|
38
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
+
|
|
40
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
41
|
+
|
|
42
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
|
+
|
|
44
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
|
+
|
|
46
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
+
|
|
48
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
|
+
|
|
50
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
51
|
+
|
|
52
|
+
var PageDownIcon = function PageDownIcon(props) {
|
|
53
|
+
return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("title", null, "pagedown"), /*#__PURE__*/_react["default"].createElement("path", {
|
|
54
|
+
stroke: "#3E3F3F",
|
|
55
|
+
strokeWidth: "2",
|
|
56
|
+
d: "M1 9.353l5.695-4.177L1 1",
|
|
57
|
+
fill: "none",
|
|
58
|
+
fillRule: "evenodd"
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
PageDownIcon.defaultProps = {
|
|
63
|
+
width: "9",
|
|
64
|
+
height: "11",
|
|
65
|
+
viewBox: "0 0 9 11",
|
|
66
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var PageUpIcon = function PageUpIcon(props) {
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("title", null, "pageup"), /*#__PURE__*/_react["default"].createElement("path", {
|
|
71
|
+
stroke: "#3E3F3F",
|
|
72
|
+
strokeWidth: "2",
|
|
73
|
+
d: "M7.695 1L2 5.176l5.695 4.177",
|
|
74
|
+
fill: "none",
|
|
75
|
+
fillRule: "evenodd"
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
PageUpIcon.defaultProps = {
|
|
80
|
+
width: "9",
|
|
81
|
+
height: "11",
|
|
82
|
+
viewBox: "0 0 9 11",
|
|
83
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
84
|
+
};
|
|
85
|
+
var _ = {
|
|
86
|
+
concat: _concat["default"],
|
|
87
|
+
get: _get["default"]
|
|
88
|
+
};
|
|
89
|
+
var styles = {
|
|
90
|
+
btnBoxSize: {
|
|
91
|
+
mobile: 36,
|
|
92
|
+
desktop: 28
|
|
93
|
+
},
|
|
94
|
+
prevNextBtnPadding: [0, 20, 2, 20],
|
|
95
|
+
ellipsisBoxPadding: [10, 6, 10, 6],
|
|
96
|
+
containerMargin: [58, 'auto', 50, 'auto']
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var PaginationContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
100
|
+
displayName: "pagination__PaginationContainer",
|
|
101
|
+
componentId: "sc-17bqftr-0"
|
|
102
|
+
})(["margin:", ";text-align:center;height:", "px;", ""], (0, _css.arrayToCssShorthand)(styles.containerMargin), styles.btnBoxSize.mobile, _mediaQuery["default"].tabletAndAbove(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n "])), styles.btnBoxSize.desktop));
|
|
103
|
+
|
|
104
|
+
var Boxes = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
105
|
+
displayName: "pagination__Boxes",
|
|
106
|
+
componentId: "sc-17bqftr-1"
|
|
107
|
+
})(["display:inline-block;user-select:none;"]);
|
|
108
|
+
|
|
109
|
+
var Box = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
110
|
+
displayName: "pagination__Box",
|
|
111
|
+
componentId: "sc-17bqftr-2"
|
|
112
|
+
})(["margin:0 5px 0 5px;width:", "px;height:", "px;box-sizing:border-box;user-select:none;display:inline-block;font-size:14px;cursor:pointer;color:#a67a44;position:relative;>:first-child{", "}"], styles.btnBoxSize.desktop, styles.btnBoxSize.desktop, _predefinedCss.absoluteCentering);
|
|
113
|
+
|
|
114
|
+
var PageNumberBox = /*#__PURE__*/(0, _styledComponents["default"])(Box).withConfig({
|
|
115
|
+
displayName: "pagination__PageNumberBox",
|
|
116
|
+
componentId: "sc-17bqftr-3"
|
|
117
|
+
})(["border:solid 1px #a67a44;border-radius:50%;line-height:", "px;background-color:", ";> span{color:", ";}", ""], styles.btnBoxSize.desktop, function (props) {
|
|
118
|
+
return props.isCurrent ? '#a67a44' : 'transparent';
|
|
119
|
+
}, function (props) {
|
|
120
|
+
return props.isCurrent ? '#ffffff' : '#a67a44';
|
|
121
|
+
}, _mediaQuery["default"].mobileOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: ", ";\n "])), function (props) {
|
|
122
|
+
return props.isCurrent ? '' : 'none';
|
|
123
|
+
}));
|
|
124
|
+
var EllipsisBox = /*#__PURE__*/(0, _styledComponents["default"])(Box).withConfig({
|
|
125
|
+
displayName: "pagination__EllipsisBox",
|
|
126
|
+
componentId: "sc-17bqftr-4"
|
|
127
|
+
})(["cursor:default;padding:", ";", ""], (0, _css.arrayToCssShorthand)(styles.ellipsisBoxPadding), _mediaQuery["default"].mobileOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: none;\n "]))));
|
|
128
|
+
var PrevNextBtn = /*#__PURE__*/(0, _styledComponents["default"])(Box).withConfig({
|
|
129
|
+
displayName: "pagination__PrevNextBtn",
|
|
130
|
+
componentId: "sc-17bqftr-5"
|
|
131
|
+
})(["padding:", ";cursor:pointer;path{stroke:#a67a44;}"], (0, _css.arrayToCssShorthand)(styles.prevNextBtnPadding));
|
|
132
|
+
/*
|
|
133
|
+
Pages Array:
|
|
134
|
+
|
|
135
|
+
left-range
|
|
136
|
+
|-----------|
|
|
137
|
+
right-range
|
|
138
|
+
|-----------|
|
|
139
|
+
< 1 2 3 4[5]6 7 8 >
|
|
140
|
+
< 1 2 3 4[5]6 ... 9 >
|
|
141
|
+
< 1 ... 4[5]6 7 8 9 >
|
|
142
|
+
< 1 ... 24[25]26 27 ... 30 >
|
|
143
|
+
< 1 ... 25[26]27 28 29 30 >
|
|
144
|
+
< 1 ... 4[5]6 7 ... 30 >
|
|
145
|
+
|-| |-|
|
|
146
|
+
left-margin right-margin
|
|
147
|
+
|-----|
|
|
148
|
+
center
|
|
149
|
+
|-| |-|
|
|
150
|
+
left-ellipsis right-ellipsis
|
|
151
|
+
|
|
152
|
+
let margin = x, center = y
|
|
153
|
+
pages array length = 2x + y + 2
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
var Pagination = /*#__PURE__*/function (_React$PureComponent) {
|
|
157
|
+
_inherits(Pagination, _React$PureComponent);
|
|
158
|
+
|
|
159
|
+
var _super = _createSuper(Pagination);
|
|
160
|
+
|
|
161
|
+
function Pagination(props) {
|
|
162
|
+
var _this;
|
|
163
|
+
|
|
164
|
+
_classCallCheck(this, Pagination);
|
|
165
|
+
|
|
166
|
+
_this = _super.call(this, props);
|
|
167
|
+
_this._buildPagesArray = _this._buildPagesArray.bind(_assertThisInitialized(_this));
|
|
168
|
+
_this._buildPageBox = _this._buildPageBox.bind(_assertThisInitialized(_this));
|
|
169
|
+
_this._buildCenterJSX = _this._buildCenterJSX.bind(_assertThisInitialized(_this));
|
|
170
|
+
return _this;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
_createClass(Pagination, [{
|
|
174
|
+
key: "_buildPageBox",
|
|
175
|
+
value: function _buildPageBox(index, currentPage) {
|
|
176
|
+
return /*#__PURE__*/_react["default"].createElement(PageNumberBox, {
|
|
177
|
+
key: "page-num-box-".concat(index),
|
|
178
|
+
isCurrent: index === currentPage,
|
|
179
|
+
onClick: this.props.handleClickPage
|
|
180
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, index));
|
|
181
|
+
}
|
|
182
|
+
}, {
|
|
183
|
+
key: "_buildCenterJSX",
|
|
184
|
+
value: function _buildCenterJSX(startAt, length, currentPage) {
|
|
185
|
+
var centerJSX = [];
|
|
186
|
+
var endAt = startAt + length - 1;
|
|
187
|
+
|
|
188
|
+
for (var i = startAt; i <= endAt; i += 1) {
|
|
189
|
+
centerJSX.push(this._buildPageBox(i, currentPage));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return centerJSX;
|
|
193
|
+
}
|
|
194
|
+
}, {
|
|
195
|
+
key: "_buildPagesArray",
|
|
196
|
+
value: function _buildPagesArray(currentPage, totalPages) {
|
|
197
|
+
var _this$props = this.props,
|
|
198
|
+
nOfMarginPages = _this$props.nOfMarginPages,
|
|
199
|
+
nOfCenterPages = _this$props.nOfCenterPages,
|
|
200
|
+
ellipsis = _this$props.ellipsis;
|
|
201
|
+
var pagesArrayMaxLength = nOfCenterPages + (nOfMarginPages + 1) * 2;
|
|
202
|
+
/* Case 1: display all pages (no ellipsis) */
|
|
203
|
+
|
|
204
|
+
if (totalPages <= pagesArrayMaxLength) {
|
|
205
|
+
var pagesArray = [];
|
|
206
|
+
|
|
207
|
+
for (var page = 1; page <= totalPages; page += 1) {
|
|
208
|
+
pagesArray.push(this._buildPageBox(page, currentPage));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return pagesArray;
|
|
212
|
+
}
|
|
213
|
+
/* Case 2: display ellipsis */
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
var isCurrentPageInLeftRange = currentPage <= nOfMarginPages + nOfCenterPages;
|
|
217
|
+
var isCurrentPageInRightRange = currentPage > totalPages - nOfMarginPages - nOfCenterPages;
|
|
218
|
+
|
|
219
|
+
var leftEllipsisJSX = /*#__PURE__*/_react["default"].createElement(EllipsisBox, {
|
|
220
|
+
key: "left-ellipsis"
|
|
221
|
+
}, ellipsis);
|
|
222
|
+
|
|
223
|
+
var rightEllipsisJSX = /*#__PURE__*/_react["default"].createElement(EllipsisBox, {
|
|
224
|
+
key: "right-ellipsis"
|
|
225
|
+
}, ellipsis);
|
|
226
|
+
/* build margin page boxes */
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
var leftMarginJSX = [];
|
|
230
|
+
|
|
231
|
+
for (var _page = 1; _page <= nOfMarginPages; _page += 1) {
|
|
232
|
+
leftMarginJSX.push(this._buildPageBox(_page, currentPage));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
var rightMarginJSX = [];
|
|
236
|
+
|
|
237
|
+
for (var i = 1; i <= nOfMarginPages; i += 1) {
|
|
238
|
+
var _page2 = totalPages - nOfMarginPages + i;
|
|
239
|
+
|
|
240
|
+
rightMarginJSX.push(this._buildPageBox(_page2, currentPage));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (isCurrentPageInLeftRange) {
|
|
244
|
+
/* Case 2-1: only show right ellipsis */
|
|
245
|
+
var _startAt = nOfMarginPages + 1;
|
|
246
|
+
|
|
247
|
+
var _length = nOfCenterPages + 1;
|
|
248
|
+
|
|
249
|
+
return _.concat(leftMarginJSX, this._buildCenterJSX(_startAt, _length, currentPage), rightEllipsisJSX, rightMarginJSX);
|
|
250
|
+
} else if (isCurrentPageInRightRange) {
|
|
251
|
+
/* Case 2-2: only show left ellipsis */
|
|
252
|
+
var _startAt2 = totalPages - nOfMarginPages - nOfCenterPages;
|
|
253
|
+
|
|
254
|
+
var _length2 = nOfCenterPages + 1;
|
|
255
|
+
|
|
256
|
+
return _.concat(leftMarginJSX, leftEllipsisJSX, this._buildCenterJSX(_startAt2, _length2, currentPage), rightMarginJSX);
|
|
257
|
+
}
|
|
258
|
+
/* Case 2-3: show both ellipses */
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
var startAt = currentPage - Math.floor(nOfCenterPages / 2) + 1;
|
|
262
|
+
var length = nOfCenterPages;
|
|
263
|
+
return _.concat(leftMarginJSX, leftEllipsisJSX, this._buildCenterJSX(startAt, length, currentPage), rightEllipsisJSX, rightMarginJSX);
|
|
264
|
+
}
|
|
265
|
+
}, {
|
|
266
|
+
key: "render",
|
|
267
|
+
value: function render() {
|
|
268
|
+
var _this$props2 = this.props,
|
|
269
|
+
currentPage = _this$props2.currentPage,
|
|
270
|
+
totalPages = _this$props2.totalPages,
|
|
271
|
+
handleClickPrev = _this$props2.handleClickPrev,
|
|
272
|
+
handleClickNext = _this$props2.handleClickNext;
|
|
273
|
+
if (!totalPages || !currentPage) return /*#__PURE__*/_react["default"].createElement(PaginationContainer, null, /*#__PURE__*/_react["default"].createElement(Boxes, null));
|
|
274
|
+
|
|
275
|
+
var pagesArrayJSX = this._buildPagesArray(currentPage, totalPages);
|
|
276
|
+
|
|
277
|
+
var belowFirstPage = currentPage <= 1;
|
|
278
|
+
var aboveFinalPage = currentPage >= totalPages;
|
|
279
|
+
return /*#__PURE__*/_react["default"].createElement(PaginationContainer, null, /*#__PURE__*/_react["default"].createElement(Boxes, null, belowFirstPage ? null : /*#__PURE__*/_react["default"].createElement(PrevNextBtn, {
|
|
280
|
+
key: "prev-btn",
|
|
281
|
+
onClick: handleClickPrev
|
|
282
|
+
}, /*#__PURE__*/_react["default"].createElement(PageUpIcon, null)), pagesArrayJSX, aboveFinalPage ? null : /*#__PURE__*/_react["default"].createElement(PrevNextBtn, {
|
|
283
|
+
key: "next-btn",
|
|
284
|
+
onClick: handleClickNext
|
|
285
|
+
}, /*#__PURE__*/_react["default"].createElement(PageDownIcon, null))));
|
|
286
|
+
}
|
|
287
|
+
}]);
|
|
288
|
+
|
|
289
|
+
return Pagination;
|
|
290
|
+
}(_react["default"].PureComponent);
|
|
291
|
+
|
|
292
|
+
Pagination.propTypes = {
|
|
293
|
+
currentPage: _propTypes["default"].number.isRequired,
|
|
294
|
+
ellipsis: _propTypes["default"].string.isRequired,
|
|
295
|
+
handleClickNext: _propTypes["default"].func.isRequired,
|
|
296
|
+
handleClickPage: _propTypes["default"].func.isRequired,
|
|
297
|
+
handleClickPrev: _propTypes["default"].func.isRequired,
|
|
298
|
+
nOfCenterPages: _propTypes["default"].number.isRequired,
|
|
299
|
+
nOfMarginPages: _propTypes["default"].number.isRequired,
|
|
300
|
+
totalPages: _propTypes["default"].number.isRequired
|
|
301
|
+
};
|
|
302
|
+
Pagination.defaultProps = {
|
|
303
|
+
currentPage: 1,
|
|
304
|
+
totalPages: 1,
|
|
305
|
+
ellipsis: '…',
|
|
306
|
+
nOfCenterPages: 4,
|
|
307
|
+
nOfMarginPages: 1
|
|
308
|
+
};
|
|
309
|
+
var _default = Pagination;
|
|
310
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
+
|
|
18
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
19
|
+
|
|
20
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
21
|
+
|
|
22
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
23
|
+
|
|
24
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
25
|
+
|
|
26
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
27
|
+
|
|
28
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
29
|
+
|
|
30
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
31
|
+
|
|
32
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
|
+
|
|
34
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
// TODO(taylrj): update to the topic landing page link
|
|
39
|
+
var podcastTopicLandingPageLink = 'https://www.twreporter.org/a/podcast-list';
|
|
40
|
+
|
|
41
|
+
var PodcastLandingPageLink = /*#__PURE__*/function (_React$PureComponent) {
|
|
42
|
+
_inherits(PodcastLandingPageLink, _React$PureComponent);
|
|
43
|
+
|
|
44
|
+
var _super = _createSuper(PodcastLandingPageLink);
|
|
45
|
+
|
|
46
|
+
function PodcastLandingPageLink() {
|
|
47
|
+
_classCallCheck(this, PodcastLandingPageLink);
|
|
48
|
+
|
|
49
|
+
return _super.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_createClass(PodcastLandingPageLink, [{
|
|
53
|
+
key: "render",
|
|
54
|
+
value: function render() {
|
|
55
|
+
var children = this.props.children;
|
|
56
|
+
var podcastLandingPageURL = podcastTopicLandingPageLink;
|
|
57
|
+
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
58
|
+
href: podcastLandingPageURL,
|
|
59
|
+
target: "_blank",
|
|
60
|
+
rel: "noopener noreferrer"
|
|
61
|
+
}, children);
|
|
62
|
+
}
|
|
63
|
+
}]);
|
|
64
|
+
|
|
65
|
+
return PodcastLandingPageLink;
|
|
66
|
+
}(_react["default"].PureComponent);
|
|
67
|
+
|
|
68
|
+
_defineProperty(PodcastLandingPageLink, "propTypes", {
|
|
69
|
+
children: _propTypes["default"].node
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _default = PodcastLandingPageLink;
|
|
73
|
+
exports["default"] = _default;
|