@twreporter/index-page 2.0.2 → 2.0.3-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 (40) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/components/animations/scroll-fadein.js +17 -44
  3. package/lib/components/animations/section-animation-wrapper.js +19 -44
  4. package/lib/components/category-section.js +12 -61
  5. package/lib/components/common-utils/bottom-link.js +10 -34
  6. package/lib/components/common-utils/category-name.js +1 -7
  7. package/lib/components/common-utils/hover-effect.js +1 -8
  8. package/lib/components/common-utils/img-placeholder.js +2 -12
  9. package/lib/components/common-utils/img-wrapper.js +11 -43
  10. package/lib/components/common-utils/section-content-wrapper.js +1 -10
  11. package/lib/components/common-utils/section-name.js +1 -10
  12. package/lib/components/common-utils/section.js +1 -9
  13. package/lib/components/common-utils/swipable-mixin.js +5 -28
  14. package/lib/components/common-utils/twreporter-link.js +5 -18
  15. package/lib/components/donation-box-section.js +5 -40
  16. package/lib/components/editor-picks-mobile.js +10 -51
  17. package/lib/components/editor-picks.js +21 -83
  18. package/lib/components/infographic-section.js +18 -75
  19. package/lib/components/junior-box-section.js +6 -42
  20. package/lib/components/latest-section.js +9 -52
  21. package/lib/components/latest-topic.js +16 -77
  22. package/lib/components/mobile-swiper-list.js +5 -17
  23. package/lib/components/photography-section.js +29 -90
  24. package/lib/components/podcast-box-section.js +6 -43
  25. package/lib/components/prop-types/image.js +1 -7
  26. package/lib/components/prop-types/post.js +7 -13
  27. package/lib/components/prop-types/topic.js +7 -14
  28. package/lib/components/reviews.js +13 -62
  29. package/lib/components/topics-section.js +20 -100
  30. package/lib/constants/app.js +2 -3
  31. package/lib/constants/category-strings.js +2 -6
  32. package/lib/constants/mobile-mockup-specification.js +10 -9
  33. package/lib/constants/section-strings.js +2 -6
  34. package/lib/constants/strings.js +1 -2
  35. package/lib/index.js +2 -17
  36. package/lib/styles/animation.js +2 -6
  37. package/lib/utils/getHref.js +2 -5
  38. package/lib/utils/image-processor.js +4 -12
  39. package/lib/utils/style-utils.js +3 -6
  40. package/package.json +3 -3
@@ -1,78 +1,49 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
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); }
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
11
  var _topic = _interopRequireDefault(require("./prop-types/topic"));
17
-
18
12
  var _styleUtils = require("../utils/style-utils");
19
-
20
13
  var _bottomLink = _interopRequireDefault(require("./common-utils/bottom-link"));
21
-
22
14
  var _categoryName = _interopRequireDefault(require("./common-utils/category-name"));
23
-
24
15
  var _imgWrapper = _interopRequireDefault(require("./common-utils/img-wrapper"));
25
-
26
16
  var _section = _interopRequireDefault(require("./common-utils/section"));
27
-
28
17
  var _sectionAnimationWrapper = _interopRequireDefault(require("./animations/section-animation-wrapper"));
29
-
30
18
  var _sectionName = _interopRequireDefault(require("./common-utils/section-name"));
31
-
32
19
  var _twreporterLink = _interopRequireDefault(require("./common-utils/twreporter-link"));
33
-
34
20
  var _mobileSwiperList = _interopRequireDefault(require("./mobile-swiper-list"));
35
-
36
21
  var _sectionStrings = _interopRequireDefault(require("../constants/section-strings"));
37
-
38
22
  var _strings = _interopRequireDefault(require("../constants/strings"));
39
-
40
23
  var _font = require("@twreporter/core/lib/constants/font");
41
-
42
24
  var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
43
-
44
25
  var _color = require("@twreporter/core/lib/constants/color");
45
-
46
26
  var _forEach = _interopRequireDefault(require("lodash/forEach"));
47
-
48
27
  var _get = _interopRequireDefault(require("lodash/get"));
49
-
50
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
51
-
28
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5; // utils
29
+ // components
30
+ // constants
31
+ // @twreporter
32
+ // lodash
52
33
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
53
-
54
34
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55
-
56
- 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); } }
57
-
35
+ 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); } }
58
36
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
59
-
37
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
38
+ 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); }
60
39
  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); }
61
-
62
40
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
63
-
64
41
  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); }; }
65
-
66
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); }
67
-
68
43
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
69
-
70
44
  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; } }
71
-
72
45
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
73
-
74
46
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
75
-
76
47
  var _ = {
77
48
  forEach: _forEach["default"],
78
49
  get: _get["default"]
@@ -102,22 +73,18 @@ var mockup = {
102
73
  }
103
74
  }
104
75
  };
105
-
106
76
  var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
107
77
  displayName: "topics-section__Container",
108
78
  componentId: "sc-17suvlo-0"
109
79
  })(["background-color:", ";"], _color.colorGrayscale.gray100);
110
-
111
80
  var Rows = /*#__PURE__*/_styledComponents["default"].div.withConfig({
112
81
  displayName: "topics-section__Rows",
113
82
  componentId: "sc-17suvlo-1"
114
83
  })(["margin-bottom:70px;", ""], _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n "]))));
115
-
116
84
  var Row = /*#__PURE__*/_styledComponents["default"].div.withConfig({
117
85
  displayName: "topics-section__Row",
118
86
  componentId: "sc-17suvlo-2"
119
87
  })(["display:flex;text-align:center;"]);
120
-
121
88
  var TopicNameRow = /*#__PURE__*/(0, _styledComponents["default"])(Row).withConfig({
122
89
  displayName: "topics-section__TopicNameRow",
123
90
  componentId: "sc-17suvlo-3"
@@ -134,14 +101,12 @@ var DescRow = /*#__PURE__*/(0, _styledComponents["default"])(Row).withConfig({
134
101
  displayName: "topics-section__DescRow",
135
102
  componentId: "sc-17suvlo-6"
136
103
  })(["align-items:flex-start;justify-content:center;text-align:justify;"]);
137
-
138
104
  var Column = /*#__PURE__*/_styledComponents["default"].div.withConfig({
139
105
  displayName: "topics-section__Column",
140
106
  componentId: "sc-17suvlo-7"
141
107
  })(["flex:0 0 ", "px;margin-bottom:12px;cursor:pointer;&:first-child{margin-right:30px;}opacity:", ";transition:0.2s opacity linear;", " ", ""], mockup.hd.width["default"], function (props) {
142
108
  return props.$ifHover ? 0.7 : 1;
143
109
  }, _mediaQuery["default"].desktopOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 0 0 ", "px;\n "])), mockup.desktop.width["default"]), _mediaQuery["default"].tabletOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 0 0 ", "px;\n &:first-child {\n margin-right: 20px;\n }\n "])), mockup.tablet.width["default"]));
144
-
145
110
  var TopicNameColumn = /*#__PURE__*/(0, _styledComponents["default"])(Column).withConfig({
146
111
  displayName: "topics-section__TopicNameColumn",
147
112
  componentId: "sc-17suvlo-8"
@@ -150,12 +115,10 @@ var TitleColumn = /*#__PURE__*/(0, _styledComponents["default"])(Column).withCon
150
115
  displayName: "topics-section__TitleColumn",
151
116
  componentId: "sc-17suvlo-9"
152
117
  })(["font-size:32px;font-weight:", ";font-family:", ";"], _font.fontWeight.bold, _font.fontFamily.title);
153
-
154
118
  var Title = /*#__PURE__*/_styledComponents["default"].div.withConfig({
155
119
  displayName: "topics-section__Title",
156
120
  componentId: "sc-17suvlo-10"
157
121
  })(["color:", ";line-height:1.25;"], _color.colorGrayscale.gray800);
158
-
159
122
  var ImgColumn = /*#__PURE__*/(0, _styledComponents["default"])(Column).withConfig({
160
123
  displayName: "topics-section__ImgColumn",
161
124
  componentId: "sc-17suvlo-11"
@@ -164,12 +127,10 @@ var DescColumn = /*#__PURE__*/(0, _styledComponents["default"])(Column).withConf
164
127
  displayName: "topics-section__DescColumn",
165
128
  componentId: "sc-17suvlo-12"
166
129
  })(["font-size:16px;line-height:1.5;"]);
167
-
168
130
  var Desc = /*#__PURE__*/_styledComponents["default"].div.withConfig({
169
131
  displayName: "topics-section__Desc",
170
132
  componentId: "sc-17suvlo-13"
171
133
  })(["width:", "%;margin:0 auto;color:", ";"], mockup.desktop.width.desc / mockup.desktop.width["default"] * 100, _color.colorGrayscale.gray800);
172
-
173
134
  var Mobile = {
174
135
  TopicName: (0, _styledComponents["default"])(_categoryName["default"]).withConfig({
175
136
  displayName: "topics-section__TopicName",
@@ -196,34 +157,27 @@ var Mobile = {
196
157
  componentId: "sc-17suvlo-19"
197
158
  })(["width:100%;font-size:18px;", " margin-left:0;"], (0, _styleUtils.truncate)('relative', 1.5, 6, _color.colorGrayscale.gray100))
198
159
  };
199
-
200
160
  var More = /*#__PURE__*/_styledComponents["default"].div.withConfig({
201
161
  displayName: "topics-section__More",
202
162
  componentId: "sc-17suvlo-20"
203
163
  })(["text-align:center;"]);
204
-
205
164
  var sizesForsrcSet = "(min-width: ".concat(_styleUtils.breakPoints.desktopMinWidth, ") ").concat(mockup.img.sizes.desktop, ", ") + "(min-width: ".concat(_styleUtils.breakPoints.tabletMinWidth, ") ").concat(mockup.img.sizes.tablet, ", ") + "".concat(mockup.img.sizes.mobile);
206
-
207
165
  var MobileTopic = /*#__PURE__*/function (_React$PureComponent) {
208
166
  _inherits(MobileTopic, _React$PureComponent);
209
-
210
167
  var _super = _createSuper(MobileTopic);
211
-
212
168
  function MobileTopic() {
213
169
  _classCallCheck(this, MobileTopic);
214
-
215
170
  return _super.apply(this, arguments);
216
171
  }
217
-
218
172
  _createClass(MobileTopic, [{
219
173
  key: "render",
220
174
  value: function render() {
221
175
  var _this$props = this.props,
222
- title = _this$props.title,
223
- topicName = _this$props.topicName,
224
- desc = _this$props.desc,
225
- imgObj = _this$props.imgObj,
226
- slug = _this$props.slug;
176
+ title = _this$props.title,
177
+ topicName = _this$props.topicName,
178
+ desc = _this$props.desc,
179
+ imgObj = _this$props.imgObj,
180
+ slug = _this$props.slug;
227
181
  var href = "topics/".concat(slug);
228
182
  return /*#__PURE__*/_react["default"].createElement(Mobile.Item, null, /*#__PURE__*/_react["default"].createElement(_twreporterLink["default"], {
229
183
  href: href,
@@ -236,10 +190,8 @@ var MobileTopic = /*#__PURE__*/function (_React$PureComponent) {
236
190
  })), /*#__PURE__*/_react["default"].createElement(Mobile.DescFrame, null, /*#__PURE__*/_react["default"].createElement(Mobile.Desc, null, desc))));
237
191
  }
238
192
  }]);
239
-
240
193
  return MobileTopic;
241
194
  }(_react["default"].PureComponent);
242
-
243
195
  MobileTopic.defaultProps = {
244
196
  title: '',
245
197
  topicName: '',
@@ -254,17 +206,12 @@ MobileTopic.propTypes = {
254
206
  imgObj: _propTypes["default"].object,
255
207
  slug: _propTypes["default"].string
256
208
  };
257
-
258
209
  var TopicsInARow = /*#__PURE__*/function (_React$PureComponent2) {
259
210
  _inherits(TopicsInARow, _React$PureComponent2);
260
-
261
211
  var _super2 = _createSuper(TopicsInARow);
262
-
263
212
  function TopicsInARow(props) {
264
213
  var _this;
265
-
266
214
  _classCallCheck(this, TopicsInARow);
267
-
268
215
  _this = _super2.call(this, props);
269
216
  _this.state = {
270
217
  indexHovered: -1
@@ -272,7 +219,6 @@ var TopicsInARow = /*#__PURE__*/function (_React$PureComponent2) {
272
219
  _this.handleHover = _this._handleHover.bind(_assertThisInitialized(_this));
273
220
  return _this;
274
221
  }
275
-
276
222
  _createClass(TopicsInARow, [{
277
223
  key: "_handleHover",
278
224
  value: function _handleHover(index) {
@@ -284,31 +230,22 @@ var TopicsInARow = /*#__PURE__*/function (_React$PureComponent2) {
284
230
  key: "render",
285
231
  value: function render() {
286
232
  var _this2 = this;
287
-
288
233
  var _this$props2 = this.props,
289
- data = _this$props2.data,
290
- useTinyImg = _this$props2.useTinyImg;
234
+ data = _this$props2.data,
235
+ useTinyImg = _this$props2.useTinyImg;
291
236
  var indexHovered = this.state.indexHovered;
292
237
  var topicNameColumns = [];
293
238
  var titleColumns = [];
294
239
  var imgColumns = [];
295
240
  var descColumns = [];
296
-
297
241
  _.forEach(data, function (topic, index) {
298
242
  var slug = _.get(topic, 'slug');
299
-
300
243
  var href = "topics/".concat(slug);
301
-
302
244
  var id = _.get(topic, 'id');
303
-
304
245
  var topicName = _.get(topic, 'topic_name', '');
305
-
306
246
  var title = _.get(topic, 'title', '');
307
-
308
247
  var imgObj = _.get(topic, 'leading_image') || _.get(topic, 'og_image');
309
-
310
248
  var desc = _.get(topic, 'og_description', '');
311
-
312
249
  topicNameColumns.push( /*#__PURE__*/_react["default"].createElement(TopicNameColumn, {
313
250
  key: id
314
251
  }, topicName));
@@ -357,14 +294,11 @@ var TopicsInARow = /*#__PURE__*/function (_React$PureComponent2) {
357
294
  plain: true
358
295
  }, /*#__PURE__*/_react["default"].createElement(Desc, null, desc))));
359
296
  });
360
-
361
297
  return /*#__PURE__*/_react["default"].createElement(Rows, null, /*#__PURE__*/_react["default"].createElement(TopicNameRow, null, topicNameColumns), /*#__PURE__*/_react["default"].createElement(TitleRow, null, titleColumns), /*#__PURE__*/_react["default"].createElement(ImgRow, null, imgColumns), /*#__PURE__*/_react["default"].createElement(DescRow, null, descColumns));
362
298
  }
363
299
  }]);
364
-
365
300
  return TopicsInARow;
366
301
  }(_react["default"].PureComponent);
367
-
368
302
  TopicsInARow.defaultProps = {
369
303
  data: [],
370
304
  useTinyImg: false
@@ -373,36 +307,27 @@ TopicsInARow.propTypes = {
373
307
  data: _propTypes["default"].arrayOf((0, _topic["default"])()),
374
308
  useTinyImg: _propTypes["default"].bool
375
309
  };
376
-
377
310
  var TopicsSection = /*#__PURE__*/function (_React$PureComponent3) {
378
311
  _inherits(TopicsSection, _React$PureComponent3);
379
-
380
312
  var _super3 = _createSuper(TopicsSection);
381
-
382
313
  function TopicsSection() {
383
314
  _classCallCheck(this, TopicsSection);
384
-
385
315
  return _super3.apply(this, arguments);
386
316
  }
387
-
388
317
  _createClass(TopicsSection, [{
389
318
  key: "render",
390
319
  value: function render() {
391
320
  var totalTopics = 4;
392
321
  var _this$props3 = this.props,
393
- data = _this$props3.data,
394
- useTinyImg = _this$props3.useTinyImg,
395
- moreURI = _this$props3.moreURI;
396
-
322
+ data = _this$props3.data,
323
+ useTinyImg = _this$props3.useTinyImg,
324
+ moreURI = _this$props3.moreURI;
397
325
  if (!Array.isArray(data) || _.get(data, 'length', 0) === 0) {
398
326
  return null;
399
327
  }
400
-
401
328
  var mobileTopicComps = data.map(function (item) {
402
329
  var desc = _.get(item, 'og_description');
403
-
404
330
  var imgObj = _.get(item, 'leading_image') || _.get(item, 'og_image');
405
-
406
331
  return /*#__PURE__*/_react["default"].createElement(MobileTopic, {
407
332
  key: _.get(item, 'id'),
408
333
  title: _.get(item, 'title'),
@@ -428,10 +353,8 @@ var TopicsSection = /*#__PURE__*/function (_React$PureComponent3) {
428
353
  }))));
429
354
  }
430
355
  }]);
431
-
432
356
  return TopicsSection;
433
357
  }(_react["default"].PureComponent);
434
-
435
358
  TopicsSection.defaultProps = {
436
359
  data: [],
437
360
  moreURI: 'topics',
@@ -442,7 +365,4 @@ TopicsSection.propTypes = {
442
365
  moreURI: _propTypes["default"].string,
443
366
  useTinyImg: _propTypes["default"].bool
444
367
  };
445
-
446
- var _default = (0, _sectionAnimationWrapper["default"])(TopicsSection);
447
-
448
- exports["default"] = _default;
368
+ var _default = exports["default"] = (0, _sectionAnimationWrapper["default"])(TopicsSection);
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
- var _default = {
7
+ var _default = exports["default"] = {
8
8
  url: 'https://twreporter.org',
9
9
  assetsPath: 'https://www.twreporter.org/assets/banner',
10
10
  domain: '',
11
11
  expirationDays: 0,
12
12
  title: '',
13
13
  description: '2015年12月《報導者》正式上線,稟持深度、開放、非營利的精神,致力於公共領域調查報導,為讀者持續追蹤各項重要議題,共同打造多元的社會與媒體環境。'
14
- };
15
- exports["default"] = _default;
14
+ };
@@ -4,12 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _strings = _interopRequireDefault(require("./strings"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
12
- var _default = {
9
+ var _default = exports["default"] = {
13
10
  photography: _strings["default"].image + _strings["default"].fullShapeDot + _strings["default"].voice
14
- };
15
- exports["default"] = _default;
11
+ };
@@ -7,19 +7,20 @@ exports.itemWidthPct = exports.itemPlusPaddingWidthPct = exports.itemPaddingRigh
7
7
  // 320 is iPhone5 width and also the mockup max-width,
8
8
  // 238 is the item width in device.
9
9
  // 26 is the padding between each item
10
+
10
11
  var itemWidth = 238;
11
12
  var itemPaddingRight = 26;
12
13
  var mockupWidth = 320;
13
- var firstItemMarginLeft = 42; // item width pct of mobiel device
14
+ var firstItemMarginLeft = 42;
14
15
 
15
- var itemWidthPct = "".concat(itemWidth / mockupWidth * 100); // item + padding width pct
16
+ // item width pct of mobiel device
17
+ var itemWidthPct = exports.itemWidthPct = "".concat(itemWidth / mockupWidth * 100);
16
18
 
17
- exports.itemWidthPct = itemWidthPct;
18
- var itemPlusPaddingWidthPct = "".concat((itemWidth + itemPaddingRight) / mockupWidth * 100); // First item has 42px margin-left in mockup.
19
+ // item + padding width pct
20
+ var itemPlusPaddingWidthPct = exports.itemPlusPaddingWidthPct = "".concat((itemWidth + itemPaddingRight) / mockupWidth * 100);
19
21
 
20
- exports.itemPlusPaddingWidthPct = itemPlusPaddingWidthPct;
21
- var firstItemMarginLeftPct = "".concat(firstItemMarginLeft / mockupWidth * 100); // Each item has the padding-right:26px in mockup.
22
+ // First item has 42px margin-left in mockup.
23
+ var firstItemMarginLeftPct = exports.firstItemMarginLeftPct = "".concat(firstItemMarginLeft / mockupWidth * 100);
22
24
 
23
- exports.firstItemMarginLeftPct = firstItemMarginLeftPct;
24
- var itemPaddingRightPct = "".concat(itemPaddingRight / mockupWidth * 100);
25
- exports.itemPaddingRightPct = itemPaddingRightPct;
25
+ // Each item has the padding-right:26px in mockup.
26
+ var itemPaddingRightPct = exports.itemPaddingRightPct = "".concat(itemPaddingRight / mockupWidth * 100);
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _strings = _interopRequireDefault(require("./strings"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
12
9
  // sectionStrings = the Chinese word that show on side bar and section blocks
13
10
  // anchorList is used for index moduleId and url hashtag for anchors.
14
- var _default = {
11
+ var _default = exports["default"] = {
15
12
  editorPick: _strings["default"].editorPick,
16
13
  latestTopic: _strings["default"].latestTopic,
17
14
  review: _strings["default"].review,
@@ -20,5 +17,4 @@ var _default = {
20
17
  photography: _strings["default"].photography,
21
18
  infographic: _strings["default"].infographic,
22
19
  donation: _strings["default"].donation
23
- };
24
- exports["default"] = _default;
20
+ };
@@ -17,5 +17,4 @@ var strings = {
17
17
  image: '影像',
18
18
  fullShapeDot: '.'
19
19
  };
20
- var _default = strings;
21
- exports["default"] = _default;
20
+ var _default = exports["default"] = strings;
package/lib/index.js CHANGED
@@ -4,34 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _categorySection = _interopRequireDefault(require("./components/category-section"));
9
-
10
8
  var _donationBoxSection = _interopRequireDefault(require("./components/donation-box-section"));
11
-
12
9
  var _editorPicks = _interopRequireDefault(require("./components/editor-picks"));
13
-
14
10
  var _infographicSection = _interopRequireDefault(require("./components/infographic-section"));
15
-
16
11
  var _juniorBoxSection = _interopRequireDefault(require("./components/junior-box-section"));
17
-
18
12
  var _latestSection = _interopRequireDefault(require("./components/latest-section"));
19
-
20
13
  var _latestTopic = _interopRequireDefault(require("./components/latest-topic"));
21
-
22
14
  var _photographySection = _interopRequireDefault(require("./components/photography-section"));
23
-
24
15
  var _podcastBoxSection = _interopRequireDefault(require("./components/podcast-box-section"));
25
-
26
16
  var _reviews = _interopRequireDefault(require("./components/reviews"));
27
-
28
17
  var _scrollFadein = _interopRequireDefault(require("./components/animations/scroll-fadein"));
29
-
30
18
  var _topicsSection = _interopRequireDefault(require("./components/topics-section"));
31
-
32
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
33
-
34
- var _default = {
20
+ var _default = exports["default"] = {
35
21
  components: {
36
22
  CategorySection: _categorySection["default"],
37
23
  DonationBoxSection: _donationBoxSection["default"],
@@ -46,5 +32,4 @@ var _default = {
46
32
  ScrollFadein: _scrollFadein["default"],
47
33
  TopicsSection: _topicsSection["default"]
48
34
  }
49
- };
50
- exports["default"] = _default;
35
+ };
@@ -4,10 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.fadeOut = exports.fadeIn = void 0;
7
-
8
7
  var _styledComponents = require("styled-components");
9
-
10
- var fadeOut = /*#__PURE__*/(0, _styledComponents.keyframes)(["from{opacity:1;}to{opacity:0;}"]);
11
- exports.fadeOut = fadeOut;
12
- var fadeIn = /*#__PURE__*/(0, _styledComponents.keyframes)(["from{opacity:0;}to{opacity:1;}"]);
13
- exports.fadeIn = fadeIn;
8
+ var fadeOut = exports.fadeOut = /*#__PURE__*/(0, _styledComponents.keyframes)(["from{opacity:1;}to{opacity:0;}"]);
9
+ var fadeIn = exports.fadeIn = /*#__PURE__*/(0, _styledComponents.keyframes)(["from{opacity:0;}to{opacity:1;}"]);
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getHref = void 0;
7
-
8
- var getHref = function getHref(slug, isExternal) {
7
+ var getHref = exports.getHref = function getHref(slug, isExternal) {
9
8
  return isExternal ? "i/".concat(slug) : "a/".concat(slug);
10
- };
11
-
12
- exports.getHref = getHref;
9
+ };
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getImageSrcSet = void 0;
7
-
8
7
  var _get = _interopRequireDefault(require("lodash/get"));
9
-
10
8
  var _storageUrlProcessor = require("@twreporter/core/lib/utils/storage-url-processor");
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
15
-
10
+ 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); }
16
11
  var screenSize = {
17
12
  smallScreenMinWidth: 480,
18
13
  smallScreenMaxWidth: 768,
@@ -20,6 +15,7 @@ var screenSize = {
20
15
  mediumScreenMinWidth: 769,
21
16
  largeScreenMinWidth: 993
22
17
  };
18
+
23
19
  /**
24
20
  * Get image set as imgSrc attribute of <img> tag
25
21
  * @param {object} imgObj - Image object
@@ -32,16 +28,12 @@ var screenSize = {
32
28
  * @param {string} imgObj.resized_targets.mobile.url
33
29
  * @return {string} srcSet
34
30
  */
35
-
36
- var getImageSrcSet = function getImageSrcSet(imgObj) {
31
+ var getImageSrcSet = exports.getImageSrcSet = function getImageSrcSet(imgObj) {
37
32
  if (_typeof(imgObj) !== 'object') {
38
33
  return '';
39
34
  }
40
-
41
35
  var desktopSrc = (0, _storageUrlProcessor.replaceGCSUrlOrigin)((0, _get["default"])(imgObj, 'resized_targets.desktop.url'));
42
36
  var tabletSrc = (0, _storageUrlProcessor.replaceGCSUrlOrigin)((0, _get["default"])(imgObj, 'resized_targets.tablet.url'));
43
37
  var mobileSrc = (0, _storageUrlProcessor.replaceGCSUrlOrigin)((0, _get["default"])(imgObj, 'resized_targets.mobile.url'));
44
38
  return "".concat(mobileSrc, " ").concat(screenSize.smallScreenMinWidth, "w, ").concat(tabletSrc, " ").concat(screenSize.mediumScreenMinWidth, "w, ").concat(desktopSrc, " ").concat(screenSize.largeScreenMinWidth, "w");
45
- };
46
-
47
- exports.getImageSrcSet = getImageSrcSet;
39
+ };
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.centerBlock = exports.breakPoints = void 0;
7
7
  exports.truncate = truncate;
8
- var centerBlock = "\n margin-left: auto;\n margin-right: auto;\n";
9
- exports.centerBlock = centerBlock;
10
- var breakPoints = {
8
+ var centerBlock = exports.centerBlock = "\n margin-left: auto;\n margin-right: auto;\n";
9
+ var breakPoints = exports.breakPoints = {
11
10
  overDesktopMinWidth: '1440px',
12
11
  desktopMaxWidth: '1439px',
13
12
  desktopMinWidth: '1024px',
@@ -15,6 +14,7 @@ var breakPoints = {
15
14
  tabletMinWidth: '768px',
16
15
  mobileMaxWidth: '767px'
17
16
  };
17
+
18
18
  /**
19
19
  * @prop {string} position - postion of the content div
20
20
  * @prop {number} lineHeight - line-height
@@ -22,9 +22,6 @@ var breakPoints = {
22
22
  * @prop {string} backgroundColor - background
23
23
  * @prop {string} textAlign - text-align
24
24
  */
25
-
26
- exports.breakPoints = breakPoints;
27
-
28
25
  function truncate(position, lineHeight, numberOfLine, backgroundColor, textAlign) {
29
26
  var maxHeight = lineHeight * numberOfLine;
30
27
  var textAlignValue = textAlign || 'justify';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twreporter/index-page",
3
- "version": "2.0.2",
3
+ "version": "2.0.3-rc.1",
4
4
  "main": "lib/index.js",
5
5
  "repository": "https://github.com/twreporter/twreporter-npm-packages.git",
6
6
  "author": "twreporter <developer@twreporter.org>",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@twreporter/core": "^1.22.1",
16
- "@twreporter/react-components": "^9.0.2",
16
+ "@twreporter/react-components": "^9.1.0-rc.0",
17
17
  "lodash": "^4.0.0",
18
18
  "prop-types": "^15.0.0",
19
19
  "react": "^18.2.0",
@@ -29,5 +29,5 @@
29
29
  "files": [
30
30
  "lib"
31
31
  ],
32
- "gitHead": "48b821a07c388fab197859b742571da4f76bbf87"
32
+ "gitHead": "df79295a50f202d6ed016de4e91bbbc0899a3882"
33
33
  }