@twreporter/react-article-components 2.8.0 → 2.8.1-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.
|
@@ -373,6 +373,7 @@ var Article = exports["default"] = /*#__PURE__*/function (_PureComponent) {
|
|
|
373
373
|
})), metadataAndToolsJSX), /*#__PURE__*/_react["default"].createElement(_donationBox["default"], null), /*#__PURE__*/_react["default"].createElement(_license["default"], {
|
|
374
374
|
license: post.copyright,
|
|
375
375
|
publishedDate: post.published_date,
|
|
376
|
+
createdAt: post.created_at,
|
|
376
377
|
id: _anchor.RELATED_POST_ANCHOR_ID // current scroll to releated post anchor
|
|
377
378
|
}), /*#__PURE__*/_react["default"].createElement(StyledSeparationCurve, null), /*#__PURE__*/_react["default"].createElement(RelatedBlock, null, /*#__PURE__*/_react["default"].createElement(_related["default"], {
|
|
378
379
|
id: post.id,
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
11
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
11
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
-
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
-
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
|
-
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); }; }
|
|
19
|
-
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); }
|
|
20
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
|
-
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; } }
|
|
22
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
25
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
15
|
var Text = /*#__PURE__*/_styledComponents["default"].p.withConfig({
|
|
27
16
|
displayName: "license__Text",
|
|
28
17
|
componentId: "sc-1vtq5dr-0"
|
|
@@ -31,47 +20,34 @@ var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
31
20
|
displayName: "license__Container",
|
|
32
21
|
componentId: "sc-1vtq5dr-1"
|
|
33
22
|
})(["text-align:center;padding:0 24px;"]);
|
|
34
|
-
var License =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
var License = function License(_ref) {
|
|
24
|
+
var _ref$license = _ref.license,
|
|
25
|
+
license = _ref$license === void 0 ? 'Creative-Commons' : _ref$license,
|
|
26
|
+
_ref$publishedDate = _ref.publishedDate,
|
|
27
|
+
publishedDate = _ref$publishedDate === void 0 ? '' : _ref$publishedDate,
|
|
28
|
+
createdAt = _ref.createdAt,
|
|
29
|
+
_ref$id = _ref.id,
|
|
30
|
+
id = _ref$id === void 0 ? '' : _ref$id;
|
|
31
|
+
var getYear = (0, _react.useCallback)(function () {
|
|
32
|
+
if (!publishedDate && !createdAt) return '';
|
|
33
|
+
var date = publishedDate ? new Date(publishedDate) : new Date(createdAt);
|
|
34
|
+
return date.getFullYear();
|
|
35
|
+
}, [publishedDate, createdAt]);
|
|
36
|
+
var year = getYear();
|
|
37
|
+
var licenseJSX;
|
|
38
|
+
if (typeof license === 'string' && license.toLowerCase() === 'copyrighted') {
|
|
39
|
+
licenseJSX = /*#__PURE__*/_react["default"].createElement(Text, null, "\xA9 ", year, " All rights reserved.");
|
|
40
|
+
} else {
|
|
41
|
+
licenseJSX = /*#__PURE__*/_react["default"].createElement(Text, null, "\u672C\u6587\u50C5\u6587\u5B57\u5167\u5BB9\u4F9D CC \u5275\u7528\u59D3\u540D\u6A19\u793A\uFF0D\u975E\u5546\u696D\u6027\uFF0D\u7981\u6B62\u6539\u4F5C 3.0 \u53F0\u7063\u6388\u6B0A\u689D\u6B3E\u91CB\u51FA\uFF0C\u6587\u4E2D\u7167\u7247\u4E0D\u5728\u6B64\u6388\u6B0A\u7BC4\u570D\u5167\u3002");
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "render",
|
|
49
|
-
value: function render() {
|
|
50
|
-
var _this$props = this.props,
|
|
51
|
-
license = _this$props.license,
|
|
52
|
-
publishedDate = _this$props.publishedDate,
|
|
53
|
-
id = _this$props.id;
|
|
54
|
-
var year = this._extractYear(publishedDate);
|
|
55
|
-
var licenseJSX = '';
|
|
56
|
-
if (typeof license === 'string' && license.toLowerCase() === 'copyrighted') {
|
|
57
|
-
licenseJSX = /*#__PURE__*/_react["default"].createElement(Text, null, "\xA9 ", year, " All rights Reserved");
|
|
58
|
-
} else {
|
|
59
|
-
licenseJSX = /*#__PURE__*/_react["default"].createElement(Text, null, "\u672C\u6587\u4F9D CC \u5275\u7528\u59D3\u540D\u6A19\u793A-\u975E\u5546\u696D\u6027-\u7981\u6B62\u6539\u4F5C3.0\u53F0\u7063\u6388\u6B0A\u689D\u6B3E\u91CB\u51FA");
|
|
60
|
-
}
|
|
61
|
-
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
62
|
-
id: id
|
|
63
|
-
}, licenseJSX);
|
|
64
|
-
}
|
|
65
|
-
}]);
|
|
66
|
-
return License;
|
|
67
|
-
}(_react["default"].PureComponent);
|
|
68
|
-
_defineProperty(License, "defaultProps", {
|
|
69
|
-
license: 'Creative-Commons',
|
|
70
|
-
publishedDate: '',
|
|
71
|
-
id: ''
|
|
72
|
-
});
|
|
73
|
-
_defineProperty(License, "propTypes", {
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
44
|
+
id: id
|
|
45
|
+
}, licenseJSX);
|
|
46
|
+
};
|
|
47
|
+
License.propTypes = {
|
|
74
48
|
license: _propTypes["default"].string,
|
|
75
49
|
publishedDate: _propTypes["default"].string,
|
|
50
|
+
createdAt: _propTypes["default"].string,
|
|
76
51
|
id: _propTypes["default"].string
|
|
77
|
-
}
|
|
52
|
+
};
|
|
53
|
+
var _default = exports["default"] = License;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-article-components",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.1-rc.1",
|
|
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",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@twreporter/core": "^1.28.0",
|
|
27
|
-
"@twreporter/react-components": "^9.
|
|
28
|
-
"@twreporter/redux": "^8.4.
|
|
29
|
-
"@twreporter/universal-header": "^3.2.1",
|
|
27
|
+
"@twreporter/react-components": "^9.11.0-rc.1",
|
|
28
|
+
"@twreporter/redux": "^8.4.3-rc.0",
|
|
29
|
+
"@twreporter/universal-header": "^3.2.2-rc.1",
|
|
30
30
|
"howler": "^2.2.3",
|
|
31
31
|
"isomorphic-dompurify": "^2.26.0",
|
|
32
32
|
"lodash": "^4.17.11",
|