@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
@@ -4,73 +4,45 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _post = _interopRequireDefault(require("./prop-types/post"));
13
-
14
10
  var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
11
  var _styleUtils = require("../utils/style-utils");
17
-
18
12
  var _getHref = require("../utils/getHref");
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 _font = require("@twreporter/core/lib/constants/font");
39
-
40
23
  var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
41
-
42
24
  var _color = require("@twreporter/core/lib/constants/color");
43
-
44
25
  var _get = _interopRequireDefault(require("lodash/get"));
45
-
46
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
47
-
26
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15; // utils
27
+ // components
28
+ // constants
29
+ // @twreporter
30
+ // lodash
48
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
49
-
50
- 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); }
51
-
32
+ 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); }
52
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
53
-
54
- 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); } }
55
-
34
+ 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); } }
56
35
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
57
-
36
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
37
+ 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); }
58
38
  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); }
59
-
60
39
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
61
-
62
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); }; }
63
-
64
41
  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); }
65
-
66
42
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
67
-
68
43
  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; } }
69
-
70
44
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
71
-
72
45
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
73
-
74
46
  var _ = {
75
47
  get: _get["default"]
76
48
  };
@@ -83,42 +55,34 @@ var mockup = {
83
55
  }
84
56
  }
85
57
  };
86
-
87
58
  var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
88
59
  displayName: "infographic-section__Container",
89
60
  componentId: "sc-2fohll-0"
90
61
  })(["background-color:", ";"], _color.colorGrayscale.gray100);
91
-
92
62
  var UpperList = /*#__PURE__*/_styledComponents["default"].div.withConfig({
93
63
  displayName: "infographic-section__UpperList",
94
64
  componentId: "sc-2fohll-1"
95
65
  })(["list-style-type:none;display:flex;flex-wrap:nowrap;justify-content:center;align-items:flex-start;", ""], _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n "]))));
96
-
97
66
  var LowerList = /*#__PURE__*/(0, _styledComponents["default"])(UpperList).withConfig({
98
67
  displayName: "infographic-section__LowerList",
99
68
  componentId: "sc-2fohll-2"
100
69
  })(["align-items:flex-end;margin-top:-282px;margin-bottom:59px;", " ", ""], _mediaQuery["default"].desktopOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-top: -170px;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-top: -130px;\n margin-bottom: 51px;\n "]))));
101
-
102
70
  var MobileList = /*#__PURE__*/_styledComponents["default"].div.withConfig({
103
71
  displayName: "infographic-section__MobileList",
104
72
  componentId: "sc-2fohll-3"
105
73
  })(["margin-bottom:39px;"]);
106
-
107
74
  var Item = /*#__PURE__*/_styledComponents["default"].div.withConfig({
108
75
  displayName: "infographic-section__Item",
109
76
  componentId: "sc-2fohll-4"
110
77
  })(["max-width:430px;transition:300ms all linear;&:first-child{margin-right:30px;}&:last-child{margin-left:30px;}", " ", " ", " ", ""], _mediaQuery["default"].desktopOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n max-width: 290px;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-width: 220px;\n &:first-child {\n margin-right: 20px;\n }\n\n &:last-child {\n margin-left: 20px;\n }\n "]))), _mediaQuery["default"].mobileOnly(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n max-width: 100%;\n &:first-child {\n margin-left: 0;\n }\n &:last-child {\n margin-right: 0;\n }\n "]))), _mediaQuery["default"].tabletAndAbove(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n &:hover {\n opacity: 0.7;\n }\n "]))));
111
-
112
78
  var WordBlock = /*#__PURE__*/_styledComponents["default"].div.withConfig({
113
79
  displayName: "infographic-section__WordBlock",
114
80
  componentId: "sc-2fohll-5"
115
81
  })(["background-color:", ";width:430px;min-height:115px;padding:8px 20px 15px 12px;", " ", " ", ""], _color.colorGrayscale.white, _mediaQuery["default"].desktopOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 290px;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin: 0 auto;\n width: 220px;\n "]))), _mediaQuery["default"].mobileOnly(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n "]))));
116
-
117
82
  var Title = /*#__PURE__*/_styledComponents["default"].h3.withConfig({
118
83
  displayName: "infographic-section__Title",
119
84
  componentId: "sc-2fohll-6"
120
85
  })(["margin:0;font-weight:", ";font-family:", ";font-size:20px;color:", ";", " ", ""], _font.fontWeight.bold, _font.fontFamily.title, _color.colorGrayscale.gray800, _mediaQuery["default"].desktopAndAbove(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n ", ";\n "])), (0, _styleUtils.truncate)('relative', 1.4, 2, _color.colorGrayscale.white)), _mediaQuery["default"].tabletOnly(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n font-size: 16px;\n ", ";\n "])), (0, _styleUtils.truncate)('relative', 1.4, 3, _color.colorGrayscale.white)));
121
-
122
86
  var ImgFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
123
87
  displayName: "infographic-section__ImgFrame",
124
88
  componentId: "sc-2fohll-7"
@@ -129,32 +93,26 @@ var ImgFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
129
93
  }), _mediaQuery["default"].tabletOnly(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin: 0 auto;\n width: 220px;\n height: ", ";\n "])), function (props) {
130
94
  return props.$isPortrait ? '290px' : '145px';
131
95
  }), _mediaQuery["default"].mobileOnly(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n width: 100%;\n height: 186px;\n "]))));
132
-
133
96
  var More = /*#__PURE__*/_styledComponents["default"].div.withConfig({
134
97
  displayName: "infographic-section__More",
135
98
  componentId: "sc-2fohll-8"
136
99
  })(["text-align:center;"]);
137
-
138
100
  var Infographic = /*#__PURE__*/function (_React$PureComponent) {
139
101
  _inherits(Infographic, _React$PureComponent);
140
-
141
102
  var _super = _createSuper(Infographic);
142
-
143
103
  function Infographic() {
144
104
  _classCallCheck(this, Infographic);
145
-
146
105
  return _super.apply(this, arguments);
147
106
  }
148
-
149
107
  _createClass(Infographic, [{
150
108
  key: "render",
151
109
  value: function render() {
152
110
  var _this$props = this.props,
153
- title = _this$props.title,
154
- imgObj = _this$props.imgObj,
155
- isPortrait = _this$props.isPortrait,
156
- slug = _this$props.slug,
157
- isExternal = _this$props.isExternal;
111
+ title = _this$props.title,
112
+ imgObj = _this$props.imgObj,
113
+ isPortrait = _this$props.isPortrait,
114
+ slug = _this$props.slug,
115
+ isExternal = _this$props.isExternal;
158
116
  var href = (0, _getHref.getHref)(slug, isExternal);
159
117
  return /*#__PURE__*/_react["default"].createElement(Item, null, /*#__PURE__*/_react["default"].createElement(_twreporterLink["default"], {
160
118
  href: href,
@@ -169,10 +127,8 @@ var Infographic = /*#__PURE__*/function (_React$PureComponent) {
169
127
  })), /*#__PURE__*/_react["default"].createElement(WordBlock, null, /*#__PURE__*/_react["default"].createElement(_categoryName["default"], null, _sectionStrings["default"].infographic), /*#__PURE__*/_react["default"].createElement(Title, null, title))));
170
128
  }
171
129
  }]);
172
-
173
130
  return Infographic;
174
131
  }(_react["default"].PureComponent);
175
-
176
132
  Infographic.defaultProps = {
177
133
  title: '',
178
134
  imgObj: {},
@@ -187,37 +143,29 @@ Infographic.propTypes = {
187
143
  isPortrait: _propTypes["default"].bool,
188
144
  slug: _propTypes["default"].string
189
145
  };
190
-
191
146
  var InfographicSection = /*#__PURE__*/function (_React$PureComponent2) {
192
147
  _inherits(InfographicSection, _React$PureComponent2);
193
-
194
148
  var _super2 = _createSuper(InfographicSection);
195
-
196
149
  function InfographicSection() {
197
150
  _classCallCheck(this, InfographicSection);
198
-
199
151
  return _super2.apply(this, arguments);
200
152
  }
201
-
202
153
  _createClass(InfographicSection, [{
203
154
  key: "render",
204
155
  value: function render() {
205
156
  var _this$props2 = this.props,
206
- data = _this$props2.data,
207
- moreURI = _this$props2.moreURI,
208
- useTinyImg = _this$props2.useTinyImg;
157
+ data = _this$props2.data,
158
+ moreURI = _this$props2.moreURI,
159
+ useTinyImg = _this$props2.useTinyImg;
209
160
  var listNumber = 3;
210
161
  var postComps = data.slice(0, 6).map(function (item, index) {
211
162
  var portraitImg = _.get(item, 'leading_image_portrait');
212
-
213
163
  var imgObj = _.get(item, 'hero_image') || _.get(item, 'og_image');
214
-
215
164
  if (index === 0 || index === 4 || index === 5) {
216
165
  if (_typeof(_.get(portraitImg, 'resized_targets')) === 'object') {
217
166
  imgObj = portraitImg;
218
167
  }
219
168
  }
220
-
221
169
  return /*#__PURE__*/_react["default"].createElement(Infographic, {
222
170
  key: _.get(item, 'id'),
223
171
  category: _.get(item, 'categories.[0].name'),
@@ -239,10 +187,8 @@ var InfographicSection = /*#__PURE__*/function (_React$PureComponent2) {
239
187
  }))));
240
188
  }
241
189
  }]);
242
-
243
190
  return InfographicSection;
244
191
  }(_react["default"].PureComponent);
245
-
246
192
  InfographicSection.defaultProps = {
247
193
  data: [],
248
194
  moreURI: 'categories/infographic',
@@ -253,7 +199,4 @@ InfographicSection.propTypes = {
253
199
  data: _propTypes["default"].arrayOf((0, _post["default"])()),
254
200
  useTinyImg: _propTypes["default"].bool
255
201
  };
256
-
257
- var _default = (0, _sectionAnimationWrapper["default"])(InfographicSection);
258
-
259
- exports["default"] = _default;
202
+ var _default = exports["default"] = (0, _sectionAnimationWrapper["default"])(InfographicSection);
@@ -1,54 +1,33 @@
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 _app = _interopRequireDefault(require("../constants/app"));
15
-
16
11
  var _juniorLink = _interopRequireDefault(require("@twreporter/react-components/lib/junior-link"));
17
-
18
12
  var _font = require("@twreporter/core/lib/constants/font");
19
-
20
13
  var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
21
-
22
14
  var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
23
-
24
15
  var _color = require("@twreporter/core/lib/constants/color");
25
-
26
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
27
-
16
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9; // constants
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
18
  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
-
19
+ 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); } }
34
20
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
35
-
21
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
22
+ 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); }
36
23
  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); }
37
-
38
24
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
-
40
25
  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
26
  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
27
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
-
46
28
  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
29
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
49
-
50
30
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
51
-
52
31
  // assets
53
32
  var ArrowIcon = function ArrowIcon(props) {
54
33
  return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("title", null, "ic/chevron_right"), /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("path", {
@@ -69,7 +48,6 @@ var ArrowIcon = function ArrowIcon(props) {
69
48
  d: "M-8-6h24v24H-8z"
70
49
  }))));
71
50
  };
72
-
73
51
  ArrowIcon.defaultProps = {
74
52
  width: "8",
75
53
  height: "12",
@@ -77,13 +55,11 @@ ArrowIcon.defaultProps = {
77
55
  xmlns: "http://www.w3.org/2000/svg",
78
56
  xmlnsXlink: "http://www.w3.org/1999/xlink"
79
57
  }; // @twreporter
80
-
81
58
  var mockup = {
82
59
  defaultWidth: 320,
83
60
  contentWidth: 238
84
61
  };
85
62
  var mobileContentWidthPct = mockup.contentWidth / mockup.defaultWidth * 100;
86
-
87
63
  var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
88
64
  displayName: "junior-box-section__Container",
89
65
  componentId: "sc-1yjyxv7-0"
@@ -96,38 +72,29 @@ var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
96
72
  }), _mediaQuery["default"].hdOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-image: ", ";\n "])), function (props) {
97
73
  return "url(".concat(_app["default"].assetsPath, "/").concat(props.$releaseBranch, "/KidsReporter_DesktopHD.jpg)");
98
74
  }));
99
-
100
75
  var ContentContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
101
76
  displayName: "junior-box-section__ContentContainer",
102
77
  componentId: "sc-1yjyxv7-1"
103
78
  })(["display:flex;justify-content:space-between;align-items:center;max-width:1024px;margin:0 auto;padding:0 100px;color:", ";font-family:", ";h3{margin:0;font-size:32px;font-weight:", ";font-family:", ";line-height:1.63;}p{margin-top:10px;font-size:14px;line-height:1.57;text-align:left;}", " ", " ", ""], _color.colorGrayscale.black, _font.fontFamily["default"], _font.fontWeight.bold, _font.fontFamily.title, _mediaQuery["default"].hdOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n max-width: 1440px;\n padding: 0 219px;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n padding: 0 110px;\n p{\n margin-top: 17px;\n }\n "]))), _mediaQuery["default"].mobileOnly(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n max-width: ", "%;\n display: block;\n text-align: center;\n padding: 0;\n h3{\n font-size: 24px;\n line-height: 2.17;\n }\n p{\n margin-top: 0;\n }\n "])), mobileContentWidthPct));
104
-
105
79
  var CTAButton = /*#__PURE__*/_styledComponents["default"].div.withConfig({
106
80
  displayName: "junior-box-section__CTAButton",
107
81
  componentId: "sc-1yjyxv7-2"
108
82
  })(["a{width:116px;height:40px;border-radius:20px;background:", ";border:none;color:", ";font-size:16px;cursor:pointer;display:table;", " ", " span{display:table-cell;vertical-align:middle;text-align:center;font-weight:", ";}}"], _color.colorSupportive.heavy, _color.colorGrayscale.white, _mediaQuery["default"].tabletOnly(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: absolute;\n right: 110px;\n top: 9px;\n "]))), _mediaQuery["default"].mobileOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n margin: 40px auto 0 auto;\n "]))), _font.fontWeight.bold);
109
-
110
83
  var TextColumn = /*#__PURE__*/_styledComponents["default"].div.withConfig({
111
84
  displayName: "junior-box-section__TextColumn",
112
85
  componentId: "sc-1yjyxv7-3"
113
86
  })(["", ""], _mediaQuery["default"].desktopOnly(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n max-width: 608px;\n "]))));
114
-
115
87
  var Icon = /*#__PURE__*/_styledComponents["default"].div.withConfig({
116
88
  displayName: "junior-box-section__Icon",
117
89
  componentId: "sc-1yjyxv7-4"
118
90
  })(["display:inline-block;margin-left:8.6px;width:7px;height:12px;"]);
119
-
120
91
  var JuniorBoxSection = /*#__PURE__*/function (_React$PureComponent) {
121
92
  _inherits(JuniorBoxSection, _React$PureComponent);
122
-
123
93
  var _super = _createSuper(JuniorBoxSection);
124
-
125
94
  function JuniorBoxSection() {
126
95
  _classCallCheck(this, JuniorBoxSection);
127
-
128
96
  return _super.apply(this, arguments);
129
97
  }
130
-
131
98
  _createClass(JuniorBoxSection, [{
132
99
  key: "render",
133
100
  value: function render() {
@@ -137,15 +104,12 @@ var JuniorBoxSection = /*#__PURE__*/function (_React$PureComponent) {
137
104
  }, /*#__PURE__*/_react["default"].createElement(ContentContainer, null, /*#__PURE__*/_react["default"].createElement(TextColumn, null, /*#__PURE__*/_react["default"].createElement("h3", null, "\u770B\u5152\u5C11\u65B0\u805E\uFF0C\u8207\u5B69\u5B50\u5C0D\u8A71"), /*#__PURE__*/_react["default"].createElement("p", null, "\u5411\u5B69\u5B50\u89E3\u91CB\u91CD\u8981\u7684\u4E8B\u4EF6\u3001\u56B4\u8085\u7684\u8B70\u984C\uFF0C\u662F\u6C11\u4E3B\u793E\u6703\u5F88\u91CD\u8981\u7684\u4E8B\uFF0C\u4E5F\u662F\u300A\u5831\u5C0E\u8005\u300B\u8EAB\u70BA\u975E\u71DF\u5229\u5A92\u9AD4\u7684\u91CD\u8981\u8CAC\u4EFB\uFF0C\u8B93\u6211\u5011\u548C\u4F60\u4E00\u8D77\u5C0B\u627E\u5C0D\u8A71\u7684\u5951\u6A5F\u3002")), /*#__PURE__*/_react["default"].createElement(CTAButton, null, /*#__PURE__*/_react["default"].createElement(_juniorLink["default"], null, /*#__PURE__*/_react["default"].createElement("span", null, "\u524D\u5F80\u95B1\u8B80", /*#__PURE__*/_react["default"].createElement(Icon, null, /*#__PURE__*/_react["default"].createElement(ArrowIcon, null)))))));
138
105
  }
139
106
  }]);
140
-
141
107
  return JuniorBoxSection;
142
108
  }(_react["default"].PureComponent);
143
-
144
109
  JuniorBoxSection.propTypes = {
145
110
  releaseBranch: _releaseBranch.BRANCH_PROP_TYPES
146
111
  };
147
112
  JuniorBoxSection.defaultProps = {
148
113
  releaseBranch: _releaseBranch.BRANCH.master
149
114
  };
150
- var _default = JuniorBoxSection;
151
- exports["default"] = _default;
115
+ var _default = exports["default"] = JuniorBoxSection;
@@ -1,66 +1,42 @@
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 _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
10
  var _post = _interopRequireDefault(require("./prop-types/post"));
15
-
16
11
  var _styledComponents = _interopRequireDefault(require("styled-components"));
17
-
18
12
  var _getHref = require("../utils/getHref");
19
-
20
13
  var _styleUtils = require("../utils/style-utils");
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 _sectionContentWrapper = _interopRequireDefault(require("./common-utils/section-content-wrapper"));
27
-
28
17
  var _twreporterLink = _interopRequireDefault(require("./common-utils/twreporter-link"));
29
-
30
18
  var _font = require("@twreporter/core/lib/constants/font");
31
-
32
19
  var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
33
-
34
20
  var _color = require("@twreporter/core/lib/constants/color");
35
-
36
21
  var _get = _interopRequireDefault(require("lodash/get"));
37
-
38
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
39
-
22
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11; // utils
23
+ // components
24
+ // @twreporter
25
+ // lodash
40
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
41
-
42
27
  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
-
28
+ 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); } }
46
29
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
47
-
30
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
31
+ 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); }
48
32
  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); }
49
-
50
33
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
51
-
52
34
  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
35
  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
36
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
57
-
58
37
  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
38
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
61
-
62
39
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
63
-
64
40
  var _ = {
65
41
  get: _get["default"]
66
42
  };
@@ -82,65 +58,49 @@ var headerPadding = {
82
58
  tablet: '34px',
83
59
  mobile: '16px'
84
60
  };
85
-
86
61
  var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
87
62
  displayName: "latest-section__Container",
88
63
  componentId: "hzxpx3-0"
89
64
  })(["background-color:", ";position:relative;", ""], _color.colorGrayscale.gray100, _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0;\n "]))));
90
-
91
65
  var ContentContainer = /*#__PURE__*/(0, _styledComponents["default"])(_sectionContentWrapper["default"]).withConfig({
92
66
  displayName: "latest-section__ContentContainer",
93
67
  componentId: "hzxpx3-1"
94
68
  })(["display:flex;padding:30px 0;overflow-x:hidden;justify-content:center;", " ", " ", " ", ""], _mediaQuery["default"].hdOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n max-width: 1280px;\n transform: translateX(8px); // side-bar width / 2\n "]))), _mediaQuery["default"].desktopOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 30px 32px 30px 48px; // side-bar width 16px\n "]))), _mediaQuery["default"].tabletOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 30px ", ";\n "])), headerPadding.tablet), _mediaQuery["default"].mobileOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: 30px ", ";\n "])), headerPadding.mobile));
95
-
96
69
  var ItemFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
97
70
  displayName: "latest-section__ItemFrame",
98
71
  componentId: "hzxpx3-2"
99
72
  })(["width:199px;padding:0;margin-left:30px;&:first-child{margin:0;}", " ", " ", " @media (max-width:", "){&:nth-child(4){display:none;}}@media (max-width:", "){&:nth-child(3){display:none;}}@media (max-width:", "){width:136px;margin-left:16px;}"], _mediaQuery["default"].desktopOnly(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n width: 130px;\n "]))), _mediaQuery["default"].tabletAndBelow(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n &:nth-child(6) {\n display: none;\n }\n &:nth-child(5) {\n display: none;\n }\n "]))), _mediaQuery["default"].tabletOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 160px;\n margin-left: 20px;\n "]))), mobileMidWidth, mobileSemiMidWidth, mobileMinWidth);
100
-
101
73
  var ImageFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
102
74
  displayName: "latest-section__ImageFrame",
103
75
  componentId: "hzxpx3-3"
104
76
  })(["width:100%;height:128px;background-size:cover;background-position:center;display:block;", " ", " ", " @media (max-width:", "){height:93px;}@media (max-width:", "){height:88px;}"], _mediaQuery["default"].desktopOnly(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n height: 90px;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n height: 110px;\n "]))), _mediaQuery["default"].mobileOnly(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n height: 100px;\n "]))), mobileSemiMidWidth, mobileMinWidth);
105
-
106
77
  var ContentFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
107
78
  displayName: "latest-section__ContentFrame",
108
79
  componentId: "hzxpx3-4"
109
80
  })(["margin:0 auto;"]);
110
-
111
81
  var Category = /*#__PURE__*/(0, _styledComponents["default"])(_categoryName["default"]).withConfig({
112
82
  displayName: "latest-section__Category",
113
83
  componentId: "hzxpx3-5"
114
84
  })(["height:16px;line-height:1.33;margin-top:12px;margin-bottom:4px;"]);
115
-
116
85
  var Title = /*#__PURE__*/_styledComponents["default"].div.withConfig({
117
86
  displayName: "latest-section__Title",
118
87
  componentId: "hzxpx3-6"
119
88
  })(["height:auto;font-size:16px;font-weight:", ";font-family:", ";color:", ";"], _font.fontWeight.bold, _font.fontFamily.title, _color.colorGrayscale.gray800);
120
-
121
89
  var LatestSection = /*#__PURE__*/function (_React$Component) {
122
90
  _inherits(LatestSection, _React$Component);
123
-
124
91
  var _super = _createSuper(LatestSection);
125
-
126
92
  function LatestSection() {
127
93
  _classCallCheck(this, LatestSection);
128
-
129
94
  return _super.apply(this, arguments);
130
95
  }
131
-
132
96
  _createClass(LatestSection, [{
133
97
  key: "render",
134
98
  value: function render() {
135
99
  var latestItems = this.props.data.map(function (item) {
136
100
  var isExternal = _.get(item, 'is_external', false);
137
-
138
101
  var href = (0, _getHref.getHref)(_.get(item, 'slug', 'error'), isExternal);
139
-
140
102
  var imgObj = _.get(item, 'hero_image') || _.get(item, 'og_image');
141
-
142
103
  var categoryName = _.get(item, 'category_set[0].category.name', '基金會新聞');
143
-
144
104
  return /*#__PURE__*/_react["default"].createElement(ItemFrame, {
145
105
  key: _.get(item, 'id')
146
106
  }, /*#__PURE__*/_react["default"].createElement(_twreporterLink["default"], {
@@ -156,10 +116,8 @@ var LatestSection = /*#__PURE__*/function (_React$Component) {
156
116
  return /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(ContentContainer, null, latestItems));
157
117
  }
158
118
  }]);
159
-
160
119
  return LatestSection;
161
120
  }(_react["default"].Component);
162
-
163
121
  LatestSection.defaultProps = {
164
122
  data: [],
165
123
  moduleMap: {}
@@ -167,5 +125,4 @@ LatestSection.defaultProps = {
167
125
  LatestSection.propTypes = {
168
126
  data: _propTypes["default"].arrayOf((0, _post["default"])())
169
127
  };
170
- var _default = LatestSection;
171
- exports["default"] = _default;
128
+ var _default = exports["default"] = LatestSection;