@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,81 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ reporterLogo: {
9
+ width: {
10
+ mobile: 300,
11
+ // px
12
+ desktop: 258,
13
+ // px
14
+ hd: 300 // px
15
+
16
+ },
17
+ height: {
18
+ mobile: 55,
19
+ // px
20
+ desktop: 45,
21
+ // px
22
+ hd: 55 // px
23
+
24
+ }
25
+ },
26
+ icon: {
27
+ width: {
28
+ tabletAndAbove: 30,
29
+ // px
30
+ mobile: 40 // px
31
+
32
+ },
33
+ height: {
34
+ tabletAndAbove: 30,
35
+ // px
36
+ mobile: 40 // px
37
+
38
+ }
39
+ },
40
+ footerHeight: {
41
+ desktop: 309 // px
42
+
43
+ },
44
+ footerContentPadding: {
45
+ hd: [60, 60, 41, 60],
46
+ // px
47
+ desktop: [60, 50, 40, 50],
48
+ // px
49
+ tablet: [50, 35, 0, 35],
50
+ // px
51
+ mobile: [60, 40, 60, 35] // px
52
+
53
+ },
54
+ footerContentMaxWidth: {
55
+ desktop: 1024,
56
+ // px
57
+ hd: 1440 // px
58
+
59
+ },
60
+ contentRow: {
61
+ width: {
62
+ tablet: 531,
63
+ // px
64
+ desktop: 682,
65
+ // px
66
+ hd: 908 // px
67
+
68
+ },
69
+ height: {
70
+ desktop: 123,
71
+ // px
72
+ hd: 96 // px
73
+
74
+ }
75
+ },
76
+ grayScaleOpacity: {
77
+ pureBlackWhiteSrc: 0.4,
78
+ normal: 0.8
79
+ }
80
+ };
81
+ exports["default"] = _default;
@@ -0,0 +1,227 @@
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 _donationLink = _interopRequireDefault(require("../donation-link"));
11
+
12
+ var _logo = _interopRequireDefault(require("./logo"));
13
+
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+
16
+ var _react = _interopRequireDefault(require("react"));
17
+
18
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
+
20
+ var _styles = _interopRequireDefault(require("./constants/styles"));
21
+
22
+ var _siteMeta = require("@twreporter/core/lib/constants/site-meta");
23
+
24
+ var _fontWeight = require("@twreporter/core/lib/constants/font-weight");
25
+
26
+ var _entityPath = _interopRequireDefault(require("@twreporter/core/lib/constants/entity-path"));
27
+
28
+ var _externalLinks = _interopRequireDefault(require("@twreporter/core/lib/constants/external-links"));
29
+
30
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
31
+
32
+ var _map = _interopRequireDefault(require("lodash/map"));
33
+
34
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22;
35
+
36
+ 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); }
37
+
38
+ 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; }
39
+
40
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
41
+
42
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43
+
44
+ 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); } }
45
+
46
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
47
+
48
+ 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); }
49
+
50
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
51
+
52
+ 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); }; }
53
+
54
+ 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); }
55
+
56
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
57
+
58
+ 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; } }
59
+
60
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
61
+
62
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
63
+
64
+ var _ = {
65
+ map: _map["default"]
66
+ };
67
+
68
+ function getItemGroups(mainOrigin) {
69
+ return [[{
70
+ slug: 'about',
71
+ text: '關於我們',
72
+ link: "".concat(mainOrigin).concat(_entityPath["default"].aboutus),
73
+ target: '_blank'
74
+ }, {
75
+ slug: 'contact',
76
+ text: '聯絡我們',
77
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "contact-footer"),
78
+ target: '_blank'
79
+ }, {
80
+ slug: 'authors',
81
+ text: '作者群',
82
+ link: "".concat(mainOrigin, "/authors"),
83
+ target: '_self'
84
+ }, {
85
+ slug: 'impact-and-annual-report',
86
+ text: '影響力報告',
87
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "impact-and-annual-report"),
88
+ target: '_self'
89
+ }], [{
90
+ slug: 'privacy',
91
+ text: '隱私政策',
92
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "privacy-footer"),
93
+ target: '_blank'
94
+ }, {
95
+ slug: 'license',
96
+ text: '許可協議',
97
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "license-footer"),
98
+ target: '_blank'
99
+ }, {
100
+ slug: 'donate',
101
+ text: '捐款徵信',
102
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "credit-donate"),
103
+ target: '_blank'
104
+ }, {
105
+ slug: 'license',
106
+ text: '常見問題',
107
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "about-us-questions"),
108
+ target: '_blank'
109
+ }], [{
110
+ slug: 'about',
111
+ text: '加入我們',
112
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "hiring-job-description"),
113
+ target: '_blank'
114
+ }, {
115
+ slug: 'subcribe',
116
+ text: '訂閱電子報',
117
+ link: _externalLinks["default"].newsLetter,
118
+ target: '_blank'
119
+ }, {
120
+ slug: 'podcast-list',
121
+ text: 'Podcast節目列表',
122
+ link: "".concat(mainOrigin).concat(_entityPath["default"].article, "podcast-list"),
123
+ target: '_blank',
124
+ newFlag: true
125
+ }, {
126
+ slug: 'media-center',
127
+ text: '報導者基金會新聞專區',
128
+ link: "".concat(mainOrigin).concat(_entityPath["default"].topics, "media-center"),
129
+ target: '_blank'
130
+ }]];
131
+ }
132
+
133
+ var Intro = /*#__PURE__*/_styledComponents["default"].p.withConfig({
134
+ displayName: "content__Intro",
135
+ componentId: "sc-12bve65-0"
136
+ })(["width:100%;font-size:12px;font-weight:", ";line-height:1.5;letter-spacing:0.4px;color:#9c9c9c;", ""], _fontWeight.sourceHanSansTC.medium, _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 16px;\n line-height: 1.63;\n letter-spacing: 0.6px;\n "]))));
137
+
138
+ var ContentRow = /*#__PURE__*/_styledComponents["default"].div.withConfig({
139
+ displayName: "content__ContentRow",
140
+ componentId: "sc-12bve65-1"
141
+ })(["", " ", " ", ""], _mediaQuery["default"].hdOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n "])), _styles["default"].contentRow.width.hd, _styles["default"].contentRow.height.hd), _mediaQuery["default"].desktopOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n "])), _styles["default"].contentRow.width.desktop, _styles["default"].contentRow.height.desktop), _mediaQuery["default"].tabletOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), _styles["default"].contentRow.width.tablet));
142
+
143
+ var Column = /*#__PURE__*/_styledComponents["default"].div.withConfig({
144
+ displayName: "content__Column",
145
+ componentId: "sc-12bve65-2"
146
+ })(["display:inline-block;", ""], _mediaQuery["default"].mobileOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-width: 100%;\n "]))));
147
+
148
+ var IntroColumn = /*#__PURE__*/(0, _styledComponents["default"])(Column).withConfig({
149
+ displayName: "content__IntroColumn",
150
+ componentId: "sc-12bve65-3"
151
+ })(["", " ", " ", " ", ""], _mediaQuery["default"].desktopAndAbove(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding-right: 60px;\n "]))), _mediaQuery["default"].hdOnly(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: 510px;\n "]))), _mediaQuery["default"].desktopOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 290px;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n width: 260px;\n "]))));
152
+ var LinksColumn = /*#__PURE__*/(0, _styledComponents["default"])(Column).withConfig({
153
+ displayName: "content__LinksColumn",
154
+ componentId: "sc-12bve65-4"
155
+ })(["padding-left:40px;", " ", " ", " ", " ", ""], _mediaQuery["default"].hdOnly(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n width: 397px;\n "]))), _mediaQuery["default"].desktopOnly(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n width: 392px;\n "]))), _mediaQuery["default"].tabletAndAbove(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n float: right;\n border-left: solid 0.25px #d8d8d8;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n width: 270px;\n padding-left: 31px;\n "]))), _mediaQuery["default"].mobileOnly(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin-top: 60px;\n padding-left: 0;\n "]))));
156
+
157
+ var ItemList = /*#__PURE__*/_styledComponents["default"].div.withConfig({
158
+ displayName: "content__ItemList",
159
+ componentId: "sc-12bve65-5"
160
+ })(["width:100%;"]);
161
+
162
+ var ItemGroup = /*#__PURE__*/_styledComponents["default"].div.withConfig({
163
+ displayName: "content__ItemGroup",
164
+ componentId: "sc-12bve65-6"
165
+ })(["display:inline-block;width:calc(100% / 3);white-space:nowrap;", " ", ""], _mediaQuery["default"].desktopAndAbove(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n float: left;\n "]))), _mediaQuery["default"].tabletAndBelow(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n width: calc(100% / 2);\n &:last-child{\n margin-top: 35px;\n }\n "]))));
166
+
167
+ var flickerAnimation = /*#__PURE__*/(0, _styledComponents.keyframes)(["0%,100%{opacity:1;}50%{opacity:.6;}"]);
168
+
169
+ var Item = /*#__PURE__*/_styledComponents["default"].a.withConfig({
170
+ displayName: "content__Item",
171
+ componentId: "sc-12bve65-7"
172
+ })(["text-decoration:none !important;display:block;width:100%;p{display:inline;font-size:14px;font-family:ff-tisa-web-pro,source-han-sans-traditional,sans-serif;font-weight:", ";letter-spacing:1.3px;color:#9c9c9c;}span{visibility:", ";background:#c7000a;color:#ffffff;font-size:9px;font-family:Roboto;margin-right:5px;padding:2px 5px;vertical-align:middle;animation:", " 0.7s infinite;}&:hover{p{color:#262626;}}", " ", ""], _fontWeight.sourceHanSansTC.medium, function (props) {
173
+ return props.visible ? 'visible' : 'hidden';
174
+ }, flickerAnimation, _mediaQuery["default"].desktopAndAbove(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n height: calc(", "px / 3);\n "])), _styles["default"].contentRow.height.hd), _mediaQuery["default"].mobileOnly(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n p {\n font-size: 18px;\n letter-spacing: 1.6px;\n line-height: 2;\n }\n "]))));
175
+
176
+ var DonateButton = /*#__PURE__*/_styledComponents["default"].div.withConfig({
177
+ displayName: "content__DonateButton",
178
+ componentId: "sc-12bve65-8"
179
+ })(["a{text-decoration:none !important;width:140px;height:55px;background-color:#ffffff;border:solid 0.5px #a67a44;display:table;&:hover{background-color:#a67a44;}p{display:table-cell;text-align:center;vertical-align:middle;color:#a67a44;font-size:14px;font-weight:", ";letter-spacing:1.3px;&:hover{color:#ffffff;}}", " ", " ", " ", "}"], _fontWeight.sourceHanSansTC.medium, _mediaQuery["default"].tabletAndAbove(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n position: absolute;\n right: 0;\n top: 0;\n "]))), _mediaQuery["default"].desktopAndAbove(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n margin-top: ", "px;\n margin-right: ", "px;\n "])), _styles["default"].footerContentPadding.desktop[0], _styles["default"].footerContentPadding.desktop[1]), _mediaQuery["default"].tabletOnly(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n margin-top: ", "px;\n margin-right: ", "px;\n "])), _styles["default"].footerContentPadding.tablet[0], _styles["default"].footerContentPadding.tablet[1]), _mediaQuery["default"].mobileOnly(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n width: 100%;\n margin: 60px auto 40px auto;\n "]))));
180
+
181
+ var buildList = function buildList(itemGroups) {
182
+ return _.map(itemGroups, function (items, indexofGroup) {
183
+ return /*#__PURE__*/_react["default"].createElement(ItemGroup, {
184
+ key: indexofGroup
185
+ }, _.map(items, function (item, indexofItem) {
186
+ return /*#__PURE__*/_react["default"].createElement(Item, {
187
+ key: "item-".concat(indexofGroup, "-").concat(indexofItem),
188
+ visible: item.newFlag,
189
+ href: item.link,
190
+ target: item.target
191
+ }, /*#__PURE__*/_react["default"].createElement("span", null, "New"), /*#__PURE__*/_react["default"].createElement("p", null, item.text));
192
+ }));
193
+ });
194
+ };
195
+
196
+ var Content = /*#__PURE__*/function (_React$PureComponent) {
197
+ _inherits(Content, _React$PureComponent);
198
+
199
+ var _super = _createSuper(Content);
200
+
201
+ function Content() {
202
+ _classCallCheck(this, Content);
203
+
204
+ return _super.apply(this, arguments);
205
+ }
206
+
207
+ _createClass(Content, [{
208
+ key: "render",
209
+ value: function render() {
210
+ var mainOrigin = this.props.mainOrigin;
211
+ return /*#__PURE__*/_react["default"].createElement(ContentRow, null, /*#__PURE__*/_react["default"].createElement(IntroColumn, null, /*#__PURE__*/_react["default"].createElement(_logo["default"], {
212
+ mainOrigin: mainOrigin
213
+ }), /*#__PURE__*/_react["default"].createElement(Intro, null, _siteMeta.shortDescription)), /*#__PURE__*/_react["default"].createElement(LinksColumn, null, /*#__PURE__*/_react["default"].createElement(ItemList, null, buildList(getItemGroups(mainOrigin)))), /*#__PURE__*/_react["default"].createElement(DonateButton, null, /*#__PURE__*/_react["default"].createElement(_donationLink["default"], null, /*#__PURE__*/_react["default"].createElement("p", null, "\u8D0A\u52A9\u6211\u5011"))));
214
+ }
215
+ }]);
216
+
217
+ return Content;
218
+ }(_react["default"].PureComponent);
219
+
220
+ Content.propTypes = {
221
+ mainOrigin: _propTypes["default"].string
222
+ };
223
+ Content.defaultProps = {
224
+ mainOrigin: ''
225
+ };
226
+ var _default = Content;
227
+ exports["default"] = _default;
@@ -0,0 +1,191 @@
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 _styles = _interopRequireDefault(require("./constants/styles"));
17
+
18
+ var _paths = require("./constants/paths");
19
+
20
+ var _externalLinks = _interopRequireDefault(require("@twreporter/core/lib/constants/external-links"));
21
+
22
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
23
+
24
+ var _map = _interopRequireDefault(require("lodash/map"));
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 _ = {
53
+ map: _map["default"]
54
+ };
55
+ var iconList = [{
56
+ slug: 'facebook',
57
+ text: 'Facebook',
58
+ link: _externalLinks["default"].facebook,
59
+ target: '_blank'
60
+ }, {
61
+ slug: 'instagram',
62
+ text: 'Instagram',
63
+ link: _externalLinks["default"].instagram,
64
+ target: '_blank'
65
+ }, {
66
+ slug: 'line',
67
+ text: 'Line',
68
+ link: _externalLinks["default"].line,
69
+ target: '_blank'
70
+ }, {
71
+ slug: 'medium',
72
+ text: 'Medium',
73
+ link: _externalLinks["default"].medium,
74
+ target: '_blank',
75
+ logoInPureBlackWhite: true
76
+ }, {
77
+ slug: 'github',
78
+ text: 'Github',
79
+ link: _externalLinks["default"].github,
80
+ target: '_blank',
81
+ logoInPureBlackWhite: true
82
+ }, {
83
+ slug: 'rss',
84
+ text: 'RSS',
85
+ link: _externalLinks["default"].rss,
86
+ target: '_blank'
87
+ }];
88
+
89
+ var IconLink = /*#__PURE__*/_styledComponents["default"].a.withConfig({
90
+ displayName: "icon-list__IconLink",
91
+ componentId: "sc-1pjab65-0"
92
+ })(["text-decoration:none !important;position:relative;display:inline-block;margin-right:11px;", " ", ""], _mediaQuery["default"].tabletAndAbove(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px; \n "])), _styles["default"].icon.width.tabletAndAbove, _styles["default"].icon.height.tabletAndAbove), _mediaQuery["default"].mobileOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: 0;\n width: 30px;\n height: 30px;\n "]))));
93
+
94
+ var Icons = /*#__PURE__*/_styledComponents["default"].div.withConfig({
95
+ displayName: "icon-list__Icons",
96
+ componentId: "sc-1pjab65-1"
97
+ })(["margin-top:20px;transform:translateX(-5px);opacity:0.8;", ""], _mediaQuery["default"].mobileOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n "]))));
98
+
99
+ var Icon = /*#__PURE__*/function (_React$PureComponent) {
100
+ _inherits(Icon, _React$PureComponent);
101
+
102
+ var _super = _createSuper(Icon);
103
+
104
+ function Icon(props) {
105
+ var _this;
106
+
107
+ _classCallCheck(this, Icon);
108
+
109
+ _this = _super.call(this, props);
110
+ _this.state = {
111
+ isMouseEnter: false
112
+ };
113
+ _this.handleMouseLeave = _this.handleMouseLeave.bind(_assertThisInitialized(_this));
114
+ _this.handleMouseEnter = _this.handleMouseEnter.bind(_assertThisInitialized(_this));
115
+ return _this;
116
+ }
117
+
118
+ _createClass(Icon, [{
119
+ key: "handleMouseEnter",
120
+ value: function handleMouseEnter(e) {
121
+ e.preventDefault();
122
+ this.setState({
123
+ isMouseEnter: true
124
+ });
125
+ }
126
+ }, {
127
+ key: "handleMouseLeave",
128
+ value: function handleMouseLeave(e) {
129
+ e.preventDefault();
130
+ this.setState({
131
+ isMouseEnter: false
132
+ });
133
+ }
134
+ }, {
135
+ key: "render",
136
+ value: function render() {
137
+ var isMouseEnter = this.state.isMouseEnter;
138
+ var icon = this.props.icon;
139
+ var iconSrc = "".concat(_paths.assets).concat(icon.slug, "-logo-default.svg");
140
+ var iconHoverSrc = "".concat(_paths.assets).concat(icon.slug, "-logo-hover.svg");
141
+ return /*#__PURE__*/_react["default"].createElement(IconLink, {
142
+ href: icon.link,
143
+ target: icon.target,
144
+ onMouseEnter: this.handleMouseEnter,
145
+ onMouseLeave: this.handleMouseLeave
146
+ }, /*#__PURE__*/_react["default"].createElement("img", {
147
+ alt: icon.slug,
148
+ src: isMouseEnter ? iconHoverSrc : iconSrc
149
+ }));
150
+ }
151
+ }]);
152
+
153
+ return Icon;
154
+ }(_react["default"].PureComponent);
155
+
156
+ Icon.propTypes = {
157
+ icon: _propTypes["default"].shape({
158
+ link: _propTypes["default"].string,
159
+ slug: _propTypes["default"].string,
160
+ target: _propTypes["default"].string
161
+ }).isRequired
162
+ };
163
+
164
+ var IconList = /*#__PURE__*/function (_React$PureComponent2) {
165
+ _inherits(IconList, _React$PureComponent2);
166
+
167
+ var _super2 = _createSuper(IconList);
168
+
169
+ function IconList() {
170
+ _classCallCheck(this, IconList);
171
+
172
+ return _super2.apply(this, arguments);
173
+ }
174
+
175
+ _createClass(IconList, [{
176
+ key: "render",
177
+ value: function render() {
178
+ return /*#__PURE__*/_react["default"].createElement(Icons, null, _.map(iconList, function (icon) {
179
+ return /*#__PURE__*/_react["default"].createElement(Icon, {
180
+ key: icon.slug,
181
+ icon: icon
182
+ });
183
+ }));
184
+ }
185
+ }]);
186
+
187
+ return IconList;
188
+ }(_react["default"].PureComponent);
189
+
190
+ var _default = IconList;
191
+ exports["default"] = _default;
@@ -0,0 +1,123 @@
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 _styles = _interopRequireDefault(require("./constants/styles"));
11
+
12
+ var _content = _interopRequireDefault(require("./content"));
13
+
14
+ var _iconList = _interopRequireDefault(require("./icon-list"));
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 _css = require("@twreporter/core/lib/utils/css");
23
+
24
+ var _fontWeight = require("@twreporter/core/lib/constants/font-weight");
25
+
26
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
27
+
28
+ var _requestOrigins = _interopRequireDefault(require("@twreporter/core/lib/constants/request-origins"));
29
+
30
+ var _propTypes2 = _interopRequireDefault(require("@twreporter/core/lib/constants/prop-types"));
31
+
32
+ var _releaseBranch = _interopRequireDefault(require("@twreporter/core/lib/constants/release-branch"));
33
+
34
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
35
+
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
37
+
38
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
39
+
40
+ 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); } }
41
+
42
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
43
+
44
+ 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); }
45
+
46
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
47
+
48
+ 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); }; }
49
+
50
+ 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); }
51
+
52
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
53
+
54
+ 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; } }
55
+
56
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
57
+
58
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
59
+
60
+ var FooterContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
61
+ displayName: "footer__FooterContainer",
62
+ componentId: "d1uef9-0"
63
+ })(["border-top:solid 0.5px #d8d8d8;width:100%;background-color:", ";padding:0;", " *{box-sizing:border-box;}"], function (props) {
64
+ return props.bgColor;
65
+ }, _mediaQuery["default"].tabletAndAbove(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n min-height: ", "px;\n "])), _styles["default"].footerHeight.desktop));
66
+
67
+ var FooterContent = /*#__PURE__*/_styledComponents["default"].div.withConfig({
68
+ displayName: "footer__FooterContent",
69
+ componentId: "d1uef9-1"
70
+ })(["position:relative;", " ", " ", " ", " margin-left:auto;margin-right:auto;position:relative;width:100%;"], _mediaQuery["default"].mobileOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", ";\n "])), (0, _css.arrayToCssShorthand)(_styles["default"].footerContentPadding.mobile)), _mediaQuery["default"].tabletOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: ", ";\n max-width: \n "])), (0, _css.arrayToCssShorthand)(_styles["default"].footerContentPadding.tablet)), _mediaQuery["default"].desktopOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: ", ";\n max-width: ", "px; \n "])), (0, _css.arrayToCssShorthand)(_styles["default"].footerContentPadding.desktop), _styles["default"].footerContentMaxWidth.desktop), _mediaQuery["default"].hdOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: ", ";\n max-width: ", "px;\n "])), (0, _css.arrayToCssShorthand)(_styles["default"].footerContentPadding.hd), _styles["default"].footerContentMaxWidth.hd));
71
+
72
+ var CopyRight = /*#__PURE__*/_styledComponents["default"].p.withConfig({
73
+ displayName: "footer__CopyRight",
74
+ componentId: "d1uef9-2"
75
+ })(["font-size:12px;font-weight:", ";letter-spacing:0.4px;color:#9c9c9c;", " ", " ", " "], _fontWeight.sourceHanSansTC.medium, _mediaQuery["default"].mobileOnly(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n text-align: center;\n margin-top: 10px;\n "]))), _mediaQuery["default"].tabletAndAbove(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-top: 40px;\n "]))), _mediaQuery["default"].hdOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n margin-top: 60px;\n "]))));
76
+
77
+ var Footer = /*#__PURE__*/function (_React$PureComponent) {
78
+ _inherits(Footer, _React$PureComponent);
79
+
80
+ var _super = _createSuper(Footer);
81
+
82
+ function Footer() {
83
+ _classCallCheck(this, Footer);
84
+
85
+ return _super.apply(this, arguments);
86
+ }
87
+
88
+ _createClass(Footer, [{
89
+ key: "render",
90
+ value: function render() {
91
+ var _this$props = this.props,
92
+ bgColor = _this$props.bgColor,
93
+ releaseBranch = _this$props.releaseBranch,
94
+ pathname = _this$props.pathname,
95
+ host = _this$props.host;
96
+ var currentYear = new Date().getFullYear();
97
+ return /*#__PURE__*/_react["default"].createElement(FooterContainer, {
98
+ bgColor: bgColor
99
+ }, /*#__PURE__*/_react["default"].createElement(FooterContent, null, /*#__PURE__*/_react["default"].createElement(_content["default"], {
100
+ mainOrigin: _requestOrigins["default"].forClientSideRendering[releaseBranch].main,
101
+ pathname: pathname,
102
+ host: host
103
+ }), /*#__PURE__*/_react["default"].createElement(_iconList["default"], null), /*#__PURE__*/_react["default"].createElement(CopyRight, null, "Copyright \xA9 ".concat(currentYear, " The Reporter."))));
104
+ }
105
+ }]);
106
+
107
+ return Footer;
108
+ }(_react["default"].PureComponent);
109
+
110
+ Footer.propTypes = {
111
+ bgColor: _propTypes["default"].string,
112
+ releaseBranch: _propTypes2["default"].releaseBranch,
113
+ host: _propTypes["default"].string,
114
+ pathname: _propTypes["default"].string
115
+ };
116
+ Footer.defaultProps = {
117
+ bgColor: '#ffffff',
118
+ releaseBranch: _releaseBranch["default"].release,
119
+ host: '',
120
+ pathname: ''
121
+ };
122
+ var _default = Footer;
123
+ exports["default"] = _default;