@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,139 @@
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 _css = require("@twreporter/core/lib/utils/css");
11
+
12
+ var _predefinedCss = require("../../constants/predefined-css");
13
+
14
+ var _fontWeight = require("@twreporter/core/lib/constants/font-weight");
15
+
16
+ var _image = _interopRequireDefault(require("../image"));
17
+
18
+ var _reactRouterDom = require("react-router-dom");
19
+
20
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
21
+
22
+ var _propTypes = _interopRequireDefault(require("prop-types"));
23
+
24
+ var _react = _interopRequireWildcard(require("react"));
25
+
26
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
27
+
28
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
+
36
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
+
38
+ 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); } }
39
+
40
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
41
+
42
+ 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); }
43
+
44
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
45
+
46
+ 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); }; }
47
+
48
+ 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); }
49
+
50
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
+
52
+ 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; } }
53
+
54
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
55
+
56
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
57
+
58
+ var styles = {
59
+ imgLandscape: {
60
+ mobile: {
61
+ width: 122,
62
+ height: 92
63
+ },
64
+ tablet: {
65
+ width: 220,
66
+ height: 125
67
+ },
68
+ desktop: {
69
+ width: 278,
70
+ height: 125
71
+ }
72
+ },
73
+ textBlockPadding: {
74
+ mobile: [10, 0, 10, 12],
75
+ tablet: [11, 11, 11, 11],
76
+ desktop: [11, 14, 11, 14]
77
+ },
78
+ postBoxPadding: {
79
+ mobile: [12, 5]
80
+ }
81
+ };
82
+ var PostBox = /*#__PURE__*/(0, _styledComponents["default"])(_reactRouterDom.Link).withConfig({
83
+ displayName: "post-item__PostBox",
84
+ componentId: "d3t92f-0"
85
+ })(["display:flex;", " ", " ", " ", " ", " ", ""], _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: ", ";\n width: 100%;\n "])), (0, _css.arrayToCssShorthand)(styles.postBoxPadding.mobile)), _mediaQuery["default"].tabletOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), styles.imgLandscape.tablet.width), _mediaQuery["default"].desktopAndAbove(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), styles.imgLandscape.desktop.width), _mediaQuery["default"].tabletAndAbove(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border: solid .5px #d8d8d8;\n overflow: hidden;\n flex-direction: column;\n "]))), _predefinedCss.resetLinkStyle, _predefinedCss.linkHoverFadeOut);
86
+
87
+ var PostImage = /*#__PURE__*/_styledComponents["default"].div.withConfig({
88
+ displayName: "post-item__PostImage",
89
+ componentId: "d3t92f-1"
90
+ })(["width:", "px;order:1;", " flex:0 0 auto;> div{width:", "px;height:", "px;", " ", "}"], styles.imgLandscape.mobile.width, _mediaQuery["default"].tabletAndAbove(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: ", "px;\n order: 2;\n "])), styles.imgLandscape.tablet.width), styles.imgLandscape.mobile.width, styles.imgLandscape.mobile.height, _mediaQuery["default"].tabletOnly(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n "])), styles.imgLandscape.tablet.width, styles.imgLandscape.tablet.height), _mediaQuery["default"].desktopAndAbove(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n "])), styles.imgLandscape.desktop.width, styles.imgLandscape.desktop.height));
91
+
92
+ var PostText = /*#__PURE__*/_styledComponents["default"].div.withConfig({
93
+ displayName: "post-item__PostText",
94
+ componentId: "d3t92f-2"
95
+ })(["color:#4a4949;font-weight:", ";font-size:16px;line-height:1.5;flex:1 1 auto;white-space:normal;order:2;", " padding:", ";", " ", ""], _fontWeight.sourceHanSansTC.bold, _mediaQuery["default"].tabletAndAbove(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n order: 1;\n "]))), (0, _css.arrayToCssShorthand)(styles.textBlockPadding.mobile), _mediaQuery["default"].tabletOnly(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: ", ";\n line-height: 1.33;\n "])), (0, _css.arrayToCssShorthand)(styles.textBlockPadding.tablet)), _mediaQuery["default"].desktopAndAbove(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: ", ";\n line-height: 1.25;\n "])), (0, _css.arrayToCssShorthand)(styles.textBlockPadding.desktop)));
96
+
97
+ var PostItem = /*#__PURE__*/function (_PureComponent) {
98
+ _inherits(PostItem, _PureComponent);
99
+
100
+ var _super = _createSuper(PostItem);
101
+
102
+ function PostItem() {
103
+ _classCallCheck(this, PostItem);
104
+
105
+ return _super.apply(this, arguments);
106
+ }
107
+
108
+ _createClass(PostItem, [{
109
+ key: "render",
110
+ value: function render() {
111
+ var _this$props = this.props,
112
+ title = _this$props.title,
113
+ imgUrl = _this$props.imgUrl,
114
+ linkTo = _this$props.linkTo,
115
+ linkTarget = _this$props.linkTarget;
116
+ return /*#__PURE__*/_react["default"].createElement(PostBox, {
117
+ to: linkTo,
118
+ target: linkTarget
119
+ }, /*#__PURE__*/_react["default"].createElement(PostImage, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_image["default"], {
120
+ src: imgUrl,
121
+ alt: title
122
+ }))), /*#__PURE__*/_react["default"].createElement(PostText, null, title));
123
+ }
124
+ }]);
125
+
126
+ return PostItem;
127
+ }(_react.PureComponent);
128
+
129
+ PostItem.propTypes = {
130
+ title: _propTypes["default"].string.isRequired,
131
+ imgUrl: _propTypes["default"].string.isRequired,
132
+ linkTo: _propTypes["default"].string.isRequired,
133
+ linkTarget: _propTypes["default"].oneOf(['_blank'])
134
+ };
135
+ PostItem.defaultProps = {
136
+ linkTarget: null
137
+ };
138
+ var _default = PostItem;
139
+ exports["default"] = _default;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
9
+
10
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
11
+
12
+ var _templateObject;
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
16
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
17
+
18
+ var PostsContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
19
+ displayName: "posts__PostsContainer",
20
+ componentId: "sc-16za9fh-0"
21
+ })(["display:flex;justify-content:space-between;align-items:stretch;", ""], _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex-direction: column;\n justify-content: flex-start;\n a {\n border-bottom: solid 1px #d8d8d8;\n }\n a:last-child {\n border-bottom: medium none currentcolor;\n }\n "]))));
22
+
23
+ var _default = PostsContainer;
24
+ exports["default"] = _default;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SectionTitle = exports.ListSectionContent = exports.TopSectionContent = void 0;
7
+
8
+ var _css = require("@twreporter/core/lib/utils/css");
9
+
10
+ var _predefinedCss = require("../../constants/predefined-css");
11
+
12
+ var _fontWeight = require("@twreporter/core/lib/constants/font-weight");
13
+
14
+ var _reactRouterDom = require("react-router-dom");
15
+
16
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _react = _interopRequireDefault(require("react"));
21
+
22
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
23
+
24
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
+
28
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
29
+
30
+ var RightArrowIcon = function RightArrowIcon(props) {
31
+ return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("path", {
32
+ d: "M1 1l7 7.007L1.013 15",
33
+ fill: "none",
34
+ stroke: "#5eb2fd",
35
+ strokeWidth: "2"
36
+ }));
37
+ };
38
+
39
+ RightArrowIcon.defaultProps = {
40
+ viewBox: "0 0 10 16",
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ fillRule: "evenodd",
43
+ clipRule: "evenodd"
44
+ };
45
+ var styles = {
46
+ goToTopicMargin: [20, 'auto', 0, 'auto'],
47
+ goToTopicPadding: [14, 0, 14, 0],
48
+ sectionMargin: {
49
+ mobile: [0, 0, 35, 0],
50
+ tablet: [0, 0, 42, 0],
51
+ desktop: [0, 0, 60, 0]
52
+ },
53
+ titleMargin: {
54
+ mobile: [0, 0, 24, 0],
55
+ tablet: [0, 0, 42, 0]
56
+ },
57
+ titlePadding: [16, 0, 16, 0]
58
+ };
59
+ var StyledLink = /*#__PURE__*/(0, _styledComponents["default"])(_reactRouterDom.Link).withConfig({
60
+ displayName: "section__StyledLink",
61
+ componentId: "sc-125nvxn-0"
62
+ })(["", " display:block;margin:", ";"], _predefinedCss.resetLinkStyle, (0, _css.arrayToCssShorthand)(styles.goToTopicMargin));
63
+
64
+ var SectionTitle = /*#__PURE__*/_styledComponents["default"].div.withConfig({
65
+ displayName: "section__SectionTitle",
66
+ componentId: "sc-125nvxn-1"
67
+ })(["width:100%;border-bottom:2px solid #d8d8d8;padding:", ";color:#4a4949;font-size:18px;font-weight:", ";line-height:1;margin:", ";", ""], (0, _css.arrayToCssShorthand)(styles.titlePadding), _fontWeight.sourceHanSansTC.bold, (0, _css.arrayToCssShorthand)(styles.titleMargin.mobile), _mediaQuery["default"].tabletAndAbove(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: ", ";\n "])), (0, _css.arrayToCssShorthand)(styles.titleMargin.tablet)));
68
+
69
+ exports.SectionTitle = SectionTitle;
70
+
71
+ var SectionContent = /*#__PURE__*/_styledComponents["default"].div.withConfig({
72
+ displayName: "section__SectionContent",
73
+ componentId: "sc-125nvxn-2"
74
+ })(["width:100%;margin:", ";", " ", ""], (0, _css.arrayToCssShorthand)(styles.sectionMargin.mobile), _mediaQuery["default"].tabletOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: ", ";\n "])), (0, _css.arrayToCssShorthand)(styles.sectionMargin.tablet)), _mediaQuery["default"].desktopAndAbove(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: ", ";\n "])), (0, _css.arrayToCssShorthand)(styles.sectionMargin.desktop)));
75
+
76
+ var GoToTopic = /*#__PURE__*/_styledComponents["default"].div.withConfig({
77
+ displayName: "section__GoToTopic",
78
+ componentId: "sc-125nvxn-3"
79
+ })(["color:#5eb2fd;text-align:center;line-height:1;padding:", ";span{display:inline-block;max-width:400px;", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:0.1px;font-size:16px;font-weight:", ";}svg{height:16px;vertical-align:baseline;margin-left:0.5em;}"], (0, _css.arrayToCssShorthand)(styles.goToTopicPadding), _mediaQuery["default"].mobileOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n max-width: 290px;\n "]))), _fontWeight.sourceHanSansTC.normal);
80
+
81
+ var TopSectionContent = function TopSectionContent(props) {
82
+ return /*#__PURE__*/_react["default"].createElement(SectionContent, null, props.children, !props.topicName ? null : /*#__PURE__*/_react["default"].createElement(StyledLink, {
83
+ to: props.topicUrl
84
+ }, /*#__PURE__*/_react["default"].createElement(GoToTopic, null, /*#__PURE__*/_react["default"].createElement("span", null, "\u66F4\u591A".concat(props.topicName, "\u6587\u7AE0")), /*#__PURE__*/_react["default"].createElement(RightArrowIcon, null))));
85
+ };
86
+
87
+ exports.TopSectionContent = TopSectionContent;
88
+ TopSectionContent.propTypes = {
89
+ children: _propTypes["default"].node.isRequired,
90
+ topicUrl: _propTypes["default"].string.isRequired,
91
+ topicName: _propTypes["default"].string
92
+ };
93
+ TopSectionContent.defaultProps = {
94
+ topicName: ''
95
+ };
96
+
97
+ var ListSectionContent = function ListSectionContent(props) {
98
+ return /*#__PURE__*/_react["default"].createElement(SectionContent, null, props.children);
99
+ };
100
+
101
+ exports.ListSectionContent = ListSectionContent;
102
+ ListSectionContent.propTypes = {
103
+ children: _propTypes["default"].node.isRequired
104
+ };
@@ -0,0 +1,206 @@
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("../../constants/predefined-css");
11
+
12
+ var _topics = require("../../constants/topics");
13
+
14
+ var _fontWeight = require("@twreporter/core/lib/constants/font-weight");
15
+
16
+ var _image = _interopRequireDefault(require("../image"));
17
+
18
+ var _reactRouterDom = require("react-router-dom");
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ var _react = _interopRequireWildcard(require("react"));
23
+
24
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
25
+
26
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
27
+
28
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
+
36
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
+
38
+ 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); } }
39
+
40
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
41
+
42
+ 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); }
43
+
44
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
45
+
46
+ 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); }; }
47
+
48
+ 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); }
49
+
50
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
+
52
+ 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; } }
53
+
54
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
55
+
56
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
57
+
58
+ var styles = {
59
+ imgPortrait: {
60
+ mobile: {
61
+ width: 150,
62
+ height: 200
63
+ },
64
+ tablet: {
65
+ width: 164,
66
+ height: 206
67
+ }
68
+ },
69
+ topicBox: {
70
+ mobile: {
71
+ marginBottom: 35
72
+ },
73
+ tablet: {
74
+ marginBottom: 35
75
+ },
76
+ desktop: {
77
+ marginBottom: 45
78
+ }
79
+ },
80
+ textBlock: {
81
+ mobile: {
82
+ paddingLeft: 15,
83
+ titleMarginBottom: 14
84
+ },
85
+ tablet: {
86
+ paddingLeft: 19,
87
+ paddingBottom: 8
88
+ },
89
+ desktop: {
90
+ paddingLeft: 26,
91
+ paddingBottom: 8
92
+ }
93
+ },
94
+ fontSize: {
95
+ title: {
96
+ mobile: 23,
97
+ tablet: 30,
98
+ desktop: 34
99
+ }
100
+ }
101
+ };
102
+ var StyledLink = /*#__PURE__*/(0, _styledComponents["default"])(_reactRouterDom.Link).withConfig({
103
+ displayName: "topic-item__StyledLink",
104
+ componentId: "sc-1tffa4f-0"
105
+ })(["", ""], _predefinedCss.resetLinkStyle);
106
+
107
+ var TopicBox = /*#__PURE__*/_styledComponents["default"].div.withConfig({
108
+ displayName: "topic-item__TopicBox",
109
+ componentId: "sc-1tffa4f-1"
110
+ })(["width:100%;display:flex;align-items:stretch;"]);
111
+
112
+ var ItemContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
113
+ displayName: "topic-item__ItemContainer",
114
+ componentId: "sc-1tffa4f-2"
115
+ })(["margin-bottom:", ";", " ", " width:100%;", ""], function (props) {
116
+ return !props.isTop ? "".concat(styles.topicBox.mobile.marginBottom, "px") : "".concat(styles.topicBox.mobile.marginBottom - 10, "px");
117
+ }, _mediaQuery["default"].tabletOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n "])), function (props) {
118
+ return !props.isTop ? "".concat(styles.topicBox.tablet.marginBottom, "px") : "".concat(styles.topicBox.tablet.marginBottom - 10, "px");
119
+ }), _mediaQuery["default"].desktopAndAbove(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n "])), function (props) {
120
+ return !props.isTop ? "".concat(styles.topicBox.desktop.marginBottom, "px") : "".concat(styles.topicBox.desktop.marginBottom - 10, "px");
121
+ }), _predefinedCss.linkHoverFadeOut);
122
+
123
+ var ImageBlock = /*#__PURE__*/_styledComponents["default"].div.withConfig({
124
+ displayName: "topic-item__ImageBlock",
125
+ componentId: "sc-1tffa4f-3"
126
+ })(["width:", "px;", " flex:0 0 auto;> div{width:", "px;height:", "px;", "}"], styles.imgPortrait.mobile.width, _mediaQuery["default"].tabletAndAbove(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), styles.imgPortrait.tablet.width), styles.imgPortrait.mobile.width, styles.imgPortrait.mobile.height, _mediaQuery["default"].tabletAndAbove(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n "])), styles.imgPortrait.tablet.width, styles.imgPortrait.tablet.height));
127
+
128
+ var TextBlock = /*#__PURE__*/_styledComponents["default"].div.withConfig({
129
+ displayName: "topic-item__TextBlock",
130
+ componentId: "sc-1tffa4f-4"
131
+ })(["padding-left:", "px;", " ", " flex:1 1 auto;display:flex;flex-direction:column;color:#4a4949;"], styles.textBlock.mobile.paddingLeft, _mediaQuery["default"].tabletOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-left: ", "px;\n padding-bottom: ", "px;\n "])), styles.textBlock.tablet.paddingLeft, styles.textBlock.tablet.paddingBottom), _mediaQuery["default"].desktopAndAbove(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding-left: ", "px;\n padding-bottom: ", "px;\n "])), styles.textBlock.desktop.paddingLeft, styles.textBlock.desktop.paddingBottom));
132
+
133
+ var TopicTitle = /*#__PURE__*/_styledComponents["default"].h2.withConfig({
134
+ displayName: "topic-item__TopicTitle",
135
+ componentId: "sc-1tffa4f-5"
136
+ })(["margin:0;", " font-size:", "px;font-weight:", ";letter-spacing:.2px;line-height:1.43;", " ", ""], _mediaQuery["default"].mobileOnly(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n "])), styles.textBlock.mobile.titleMarginBottom), styles.fontSize.title.mobile, _fontWeight.sourceHanSansTC.bold, _mediaQuery["default"].tabletOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: ", "px;\n "])), styles.fontSize.title.tablet), _mediaQuery["default"].desktopAndAbove(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: ", "px;\n "])), styles.fontSize.title.desktop));
137
+
138
+ var TopicDate = /*#__PURE__*/_styledComponents["default"].div.withConfig({
139
+ displayName: "topic-item__TopicDate",
140
+ componentId: "sc-1tffa4f-6"
141
+ })(["padding-top:15px;padding-bottom:15px;", " font-size:14px;font-weight:", ";letter-spacing:0.5px;"], _mediaQuery["default"].tabletOnly(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding-top: 12px;\n padding-bottom: 12px;\n "]))), _fontWeight.sourceHanSansTC.bold);
142
+
143
+ var TopicDescription = /*#__PURE__*/_styledComponents["default"].div.withConfig({
144
+ displayName: "topic-item__TopicDescription",
145
+ componentId: "sc-1tffa4f-7"
146
+ })(["font-size:16px;letter-spacing:0.1px;line-height:1.56;text-align:justify;"]);
147
+
148
+ var DesktopDescription = /*#__PURE__*/(0, _styledComponents["default"])(TopicDescription).withConfig({
149
+ displayName: "topic-item__DesktopDescription",
150
+ componentId: "sc-1tffa4f-8"
151
+ })(["", ""], _mediaQuery["default"].mobileOnly(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: none;\n "]))));
152
+ var MobileDescription = /*#__PURE__*/(0, _styledComponents["default"])(TopicDescription).withConfig({
153
+ displayName: "topic-item__MobileDescription",
154
+ componentId: "sc-1tffa4f-9"
155
+ })(["display:none;", ""], _mediaQuery["default"].mobileOnly(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: block;\n margin-top: 12px;\n "]))));
156
+
157
+ var TopicItem = /*#__PURE__*/function (_PureComponent) {
158
+ _inherits(TopicItem, _PureComponent);
159
+
160
+ var _super = _createSuper(TopicItem);
161
+
162
+ function TopicItem() {
163
+ _classCallCheck(this, TopicItem);
164
+
165
+ return _super.apply(this, arguments);
166
+ }
167
+
168
+ _createClass(TopicItem, [{
169
+ key: "render",
170
+ value: function render() {
171
+ var _this$props = this.props,
172
+ title = _this$props.title,
173
+ updatedAt = _this$props.updatedAt,
174
+ description = _this$props.description,
175
+ imgUrl = _this$props.imgUrl,
176
+ imgAlt = _this$props.imgAlt,
177
+ linkTo = _this$props.linkTo,
178
+ isTop = _this$props.isTop;
179
+ return /*#__PURE__*/_react["default"].createElement(StyledLink, {
180
+ to: linkTo
181
+ }, /*#__PURE__*/_react["default"].createElement(ItemContainer, {
182
+ isTop: isTop
183
+ }, /*#__PURE__*/_react["default"].createElement(TopicBox, null, /*#__PURE__*/_react["default"].createElement(ImageBlock, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_image["default"], {
184
+ src: imgUrl,
185
+ alt: imgAlt
186
+ }))), /*#__PURE__*/_react["default"].createElement(TextBlock, null, /*#__PURE__*/_react["default"].createElement(TopicTitle, null, title), /*#__PURE__*/_react["default"].createElement(TopicDate, null, "".concat(_topics.TEXT.LAST_UPDATED, " ").concat(updatedAt)), /*#__PURE__*/_react["default"].createElement(DesktopDescription, null, description))), /*#__PURE__*/_react["default"].createElement(MobileDescription, null, description)));
187
+ }
188
+ }]);
189
+
190
+ return TopicItem;
191
+ }(_react.PureComponent);
192
+
193
+ TopicItem.propTypes = {
194
+ title: _propTypes["default"].string.isRequired,
195
+ updatedAt: _propTypes["default"].string.isRequired,
196
+ description: _propTypes["default"].string.isRequired,
197
+ imgUrl: _propTypes["default"].string.isRequired,
198
+ imgAlt: _propTypes["default"].string.isRequired,
199
+ linkTo: _propTypes["default"].string.isRequired,
200
+ isTop: _propTypes["default"].bool
201
+ };
202
+ TopicItem.defaultProps = {
203
+ isTop: false
204
+ };
205
+ var _default = TopicItem;
206
+ exports["default"] = _default;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ // 20 is the margin between two items
8
+ var marginBetweenItems = 20;
9
+ var _default = {
10
+ marginBetweenItems: marginBetweenItems,
11
+ mobile: {
12
+ maxWidth: 375,
13
+ cardWidth: 325,
14
+ tagsWidth: 240,
15
+ imgHeight: 205
16
+ },
17
+ desktop: {
18
+ maxWidth: 451 * 2 + marginBetweenItems,
19
+ cardWidth: 451,
20
+ textWidth: 421,
21
+ tagsWidth: 335,
22
+ imgHeight: 285
23
+ },
24
+ tablet: {
25
+ maxWidth: 339 * 2 + marginBetweenItems,
26
+ cardWidth: 339,
27
+ textWidth: 311,
28
+ tagsWidth: 224,
29
+ imgHeight: 214
30
+ },
31
+ hd: {
32
+ maxWidth: 555 * 2 + marginBetweenItems,
33
+ cardWidth: 555,
34
+ textWidth: 516,
35
+ tagsWidth: 430,
36
+ imgHeight: 350
37
+ }
38
+ };
39
+ exports["default"] = _default;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resetLinkStyle = exports.linkHoverFadeOut = void 0;
7
+
8
+ var _styledComponents = require("styled-components");
9
+
10
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
11
+
12
+ var _templateObject;
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
16
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
17
+
18
+ var linkHoverFadeOut = /*#__PURE__*/(0, _styledComponents.css)(["", ""], _mediaQuery["default"].desktopAndAbove(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &:hover {\n opacity: .7;\n transition: 200ms opacity linear; \n }\n "]))));
19
+ exports.linkHoverFadeOut = linkHoverFadeOut;
20
+ var resetLinkStyle = 'a:hover,a:active,a:link,a:visited { color: inherit; text-decoration: none; }';
21
+ exports.resetLinkStyle = resetLinkStyle;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TEXT = void 0;
7
+ var TEXT = {
8
+ TOPICS_PAGE_TITLE: '專題',
9
+ SECTION_TITLE_FEATURED: '最新專題',
10
+ SECTION_TITLE_OTHERS: '所有專題',
11
+ LAST_UPDATED: '最後更新'
12
+ };
13
+ exports.TEXT = TEXT;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "TopicsList", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _topics["default"];
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "List", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _list["default"];
16
+ }
17
+ });
18
+ exports["default"] = void 0;
19
+
20
+ var _topics = _interopRequireDefault(require("./components/topics"));
21
+
22
+ var _list = _interopRequireDefault(require("./components/list"));
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
26
+ var _default = {
27
+ TopicsList: _topics["default"],
28
+ List: _list["default"]
29
+ };
30
+ exports["default"] = _default;