@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.
Files changed (43) hide show
  1. package/CHANGELOG.md +544 -0
  2. package/LICENSE +21 -0
  3. package/README.md +46 -0
  4. package/lib/bookmark-list/bookmark.js +251 -0
  5. package/lib/bookmark-list/bookmarks.js +93 -0
  6. package/lib/bookmark-list/customized-link.js +45 -0
  7. package/lib/bookmark-list/image-wrapper.js +119 -0
  8. package/lib/bookmark-list/index.js +312 -0
  9. package/lib/bookmark-list/redirect-to-sign-in.js +35 -0
  10. package/lib/bookmark-widget/index.js +259 -0
  11. package/lib/confirmation/index.js +125 -0
  12. package/lib/donation-link.js +75 -0
  13. package/lib/error/index.js +17 -0
  14. package/lib/error/message.js +567 -0
  15. package/lib/footer/constants/paths.js +8 -0
  16. package/lib/footer/constants/styles.js +81 -0
  17. package/lib/footer/content.js +227 -0
  18. package/lib/footer/icon-list.js +191 -0
  19. package/lib/footer/index.js +123 -0
  20. package/lib/footer/logo.js +92 -0
  21. package/lib/is-fetching-wrapper.js +126 -0
  22. package/lib/link-with-tracker.js +153 -0
  23. package/lib/listing-page/components/image.js +185 -0
  24. package/lib/listing-page/components/list-item.js +197 -0
  25. package/lib/listing-page/components/list.js +188 -0
  26. package/lib/listing-page/components/topics/index.js +215 -0
  27. package/lib/listing-page/components/topics/page-content.js +44 -0
  28. package/lib/listing-page/components/topics/post-item.js +139 -0
  29. package/lib/listing-page/components/topics/posts.js +24 -0
  30. package/lib/listing-page/components/topics/section.js +104 -0
  31. package/lib/listing-page/components/topics/topic-item.js +206 -0
  32. package/lib/listing-page/constants/mockup-spec.js +39 -0
  33. package/lib/listing-page/constants/predefined-css.js +21 -0
  34. package/lib/listing-page/constants/topics.js +13 -0
  35. package/lib/listing-page/index.js +30 -0
  36. package/lib/mobile-pop-up-modal.js +161 -0
  37. package/lib/more.js +98 -0
  38. package/lib/pagination/index.js +310 -0
  39. package/lib/podcast-link.js +73 -0
  40. package/lib/side-bar/index.js +317 -0
  41. package/lib/table-of-contents/index.js +532 -0
  42. package/lib/utils/link-with-params.js +27 -0
  43. package/package.json +33 -0
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _fontWeight = require("@twreporter/core/lib/constants/font-weight");
9
+
10
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
17
+
18
+ var _templateObject, _templateObject2, _templateObject3;
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
23
+
24
+ var WarningSign = function WarningSign(props) {
25
+ return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("title", null, "deletebm"), /*#__PURE__*/_react["default"].createElement("g", {
26
+ fill: "none",
27
+ fillRule: "evenodd"
28
+ }, /*#__PURE__*/_react["default"].createElement("path", {
29
+ d: "M15.306.313L.073 28.373a.598.598 0 0 0 .526.884h30.465a.598.598 0 0 0 .525-.884L16.357.313a.598.598 0 0 0-1.051 0",
30
+ fill: "#E60013"
31
+ }), /*#__PURE__*/_react["default"].createElement("path", {
32
+ d: "M14.851 22.772h1.753l.16 2.435h-2.087l.174-2.435zm1.776-1.833h-1.753l-.546-11.384h2.823l-.524 11.384z",
33
+ fill: "#FFF"
34
+ })));
35
+ };
36
+
37
+ WarningSign.defaultProps = {
38
+ width: "32",
39
+ height: "30",
40
+ viewBox: "0 0 32 30",
41
+ xmlns: "http://www.w3.org/2000/svg"
42
+ };
43
+
44
+ var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
45
+ displayName: "confirmation__Container",
46
+ componentId: "ypuqpw-0"
47
+ })(["width:100%;height:100vh;position:fixed;top:0;left:0;z-index:5;background-color:rgba(115,115,115,0.8);"]);
48
+
49
+ var Dialog = /*#__PURE__*/_styledComponents["default"].div.withConfig({
50
+ displayName: "confirmation__Dialog",
51
+ componentId: "ypuqpw-1"
52
+ })(["width:", ";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);padding:75px 60px 58px 60px;background-color:white;text-align:center;", ""], function (props) {
53
+ return props.width;
54
+ }, _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n padding: 47px 17px 37px 17px;\n "]))));
55
+
56
+ var Content = /*#__PURE__*/_styledComponents["default"].div.withConfig({
57
+ displayName: "confirmation__Content",
58
+ componentId: "ypuqpw-2"
59
+ })(["width:100%;margin-bottom:52px;font-size:20px;font-weight:", ";", ""], _fontWeight.sourceHanSansTC.bold, _mediaQuery["default"].mobileOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 16px;\n "]))));
60
+
61
+ var FuncitonArea = /*#__PURE__*/_styledComponents["default"].div.withConfig({
62
+ displayName: "confirmation__FuncitonArea",
63
+ componentId: "ypuqpw-3"
64
+ })([""]);
65
+
66
+ var FunctionButton = /*#__PURE__*/_styledComponents["default"].button.withConfig({
67
+ displayName: "confirmation__FunctionButton",
68
+ componentId: "ypuqpw-4"
69
+ })(["cursor:pointer;font-weight:", ";font-size:18px;width:127px;height:46.7px;border-radius:40px;background-color:Transparent;outline:0;", " letter-spacing:1.6px;"], _fontWeight.sourceHanSansTC.bold, _mediaQuery["default"].mobileOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 16px;\n "]))));
70
+
71
+ var Cancel = /*#__PURE__*/(0, _styledComponents["default"])(FunctionButton).withConfig({
72
+ displayName: "confirmation__Cancel",
73
+ componentId: "ypuqpw-5"
74
+ })(["border:solid 2px #3e3f3f;margin-right:25px;"]);
75
+ var Confirm = /*#__PURE__*/(0, _styledComponents["default"])(FunctionButton).withConfig({
76
+ displayName: "confirmation__Confirm",
77
+ componentId: "ypuqpw-6"
78
+ })(["border:solid 2px #e60013;color:#c7000d;"]);
79
+
80
+ var IconContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
81
+ displayName: "confirmation__IconContainer",
82
+ componentId: "ypuqpw-7"
83
+ })(["display:inline-block;position:relative;top:8px;margin-right:10px;"]);
84
+
85
+ var TextContainer = /*#__PURE__*/_styledComponents["default"].span.withConfig({
86
+ displayName: "confirmation__TextContainer",
87
+ componentId: "ypuqpw-8"
88
+ })(["letter-spacing:2.6px;"]);
89
+
90
+ var Confirmation = function Confirmation(props) {
91
+ var width = props.width,
92
+ content = props.content,
93
+ cancel = props.cancel,
94
+ confirm = props.confirm,
95
+ onConfirm = props.onConfirm,
96
+ onCancel = props.onCancel,
97
+ toShowWarningIcon = props.toShowWarningIcon;
98
+ var iconJSX = toShowWarningIcon ? /*#__PURE__*/_react["default"].createElement(IconContainer, null, /*#__PURE__*/_react["default"].createElement(WarningSign, null)) : null;
99
+ return /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(Dialog, {
100
+ width: width
101
+ }, /*#__PURE__*/_react["default"].createElement(Content, null, iconJSX, /*#__PURE__*/_react["default"].createElement(TextContainer, null, content)), /*#__PURE__*/_react["default"].createElement(FuncitonArea, null, /*#__PURE__*/_react["default"].createElement(Cancel, {
102
+ onClick: onCancel
103
+ }, cancel), /*#__PURE__*/_react["default"].createElement(Confirm, {
104
+ onClick: onConfirm
105
+ }, confirm))));
106
+ };
107
+
108
+ Confirmation.defaultProps = {
109
+ content: '',
110
+ cancel: 'Cancel',
111
+ confirm: 'Confirm',
112
+ width: '490px',
113
+ toShowWarningIcon: true
114
+ };
115
+ Confirmation.propTypes = {
116
+ width: _propTypes["default"].string,
117
+ content: _propTypes["default"].string,
118
+ cancel: _propTypes["default"].string,
119
+ confirm: _propTypes["default"].string,
120
+ onConfirm: _propTypes["default"].func.isRequired,
121
+ onCancel: _propTypes["default"].func.isRequired,
122
+ toShowWarningIcon: _propTypes["default"].bool
123
+ };
124
+ var _default = Confirmation;
125
+ exports["default"] = _default;
@@ -0,0 +1,75 @@
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 _externalLinks = _interopRequireDefault(require("@twreporter/core/lib/constants/external-links"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
+
18
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
+
20
+ 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); } }
21
+
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23
+
24
+ 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); }
25
+
26
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
+
28
+ 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); }; }
29
+
30
+ 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); }
31
+
32
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
+
34
+ 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; } }
35
+
36
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
37
+
38
+ 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; }
39
+
40
+ var DonationLink = /*#__PURE__*/function (_React$PureComponent) {
41
+ _inherits(DonationLink, _React$PureComponent);
42
+
43
+ var _super = _createSuper(DonationLink);
44
+
45
+ function DonationLink() {
46
+ _classCallCheck(this, DonationLink);
47
+
48
+ return _super.apply(this, arguments);
49
+ }
50
+
51
+ _createClass(DonationLink, [{
52
+ key: "render",
53
+ value: function render() {
54
+ var _this$props = this.props,
55
+ className = _this$props.className,
56
+ children = _this$props.children;
57
+ var donationURL = _externalLinks["default"].donation;
58
+ return /*#__PURE__*/_react["default"].createElement("a", {
59
+ className: className,
60
+ href: donationURL,
61
+ target: "_blank",
62
+ rel: "noopener noreferrer"
63
+ }, children);
64
+ }
65
+ }]);
66
+
67
+ return DonationLink;
68
+ }(_react["default"].PureComponent);
69
+
70
+ exports["default"] = DonationLink;
71
+
72
+ _defineProperty(DonationLink, "propTypes", {
73
+ children: _propTypes["default"].node,
74
+ className: _propTypes["default"].string
75
+ });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.ErrorMessage = void 0;
7
+
8
+ var _message = _interopRequireDefault(require("./message"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var ErrorMessage = _message["default"];
13
+ exports.ErrorMessage = ErrorMessage;
14
+ var _default = {
15
+ ErrorMessage: ErrorMessage
16
+ };
17
+ exports["default"] = _default;