@twreporter/react-article-components 2.2.0-rc.0 → 2.2.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.
- package/CHANGELOG.md +8 -0
- package/lib/components/article-page.js +39 -108
- package/lib/components/aside/desktop-aside.js +25 -65
- package/lib/components/aside/desktop-tools.js +11 -57
- package/lib/components/aside/metadata.js +22 -89
- package/lib/components/aside/mobile-tool-bar.js +79 -175
- package/lib/components/aside/utils/theme.js +5 -11
- package/lib/components/body/annotation.js +15 -73
- package/lib/components/body/audio/audio-contexts.js +4 -16
- package/lib/components/body/audio/audio-provider.js +13 -48
- package/lib/components/body/audio/control-button.js +4 -28
- package/lib/components/body/audio/index.js +10 -56
- package/lib/components/body/audio/seek-bar.js +6 -23
- package/lib/components/body/audio/time.js +0 -6
- package/lib/components/body/blockquote.js +11 -52
- package/lib/components/body/brief.js +10 -55
- package/lib/components/body/centered-quote.js +10 -52
- package/lib/components/body/embedded-code.js +22 -101
- package/lib/components/body/headings.js +6 -23
- package/lib/components/body/image-diff.js +13 -66
- package/lib/components/body/image.js +11 -46
- package/lib/components/body/index.js +21 -118
- package/lib/components/body/infobox.js +13 -58
- package/lib/components/body/list.js +8 -29
- package/lib/components/body/multimedia.js +10 -29
- package/lib/components/body/paragraph.js +5 -23
- package/lib/components/body/slider/index.js +28 -96
- package/lib/components/body/slideshow/index.js +36 -107
- package/lib/components/body/tracking-section.js +7 -46
- package/lib/components/body/youtube.js +8 -41
- package/lib/components/donation-box.js +10 -44
- package/lib/components/img-with-placeholder/index.js +34 -106
- package/lib/components/leading/extend.js +6 -25
- package/lib/components/leading/fullscreen.js +17 -63
- package/lib/components/leading/index.js +2 -10
- package/lib/components/leading/normal.js +19 -64
- package/lib/components/leading/pink.js +20 -59
- package/lib/components/leading/small.js +6 -25
- package/lib/components/license.js +9 -40
- package/lib/components/link.js +8 -37
- package/lib/components/related/card.js +20 -73
- package/lib/components/related/index.js +25 -71
- package/lib/components/related/list.js +16 -70
- package/lib/components/related/mockup.js +10 -12
- package/lib/components/separation-curve.js +0 -15
- package/lib/components/table-of-contents/index.js +17 -46
- package/lib/components/table-of-contents/styled.js +10 -38
- package/lib/constants/anchor.js +4 -8
- package/lib/constants/css.js +2 -15
- package/lib/constants/element-alignment.js +2 -3
- package/lib/constants/prop-types/article-page.js +2 -7
- package/lib/constants/prop-types/aside.js +2 -8
- package/lib/constants/prop-types/body.js +4 -9
- package/lib/constants/prop-types/img-with-placeholder.js +2 -7
- package/lib/constants/prop-types/leading.js +8 -13
- package/lib/constants/prop-types/related.js +2 -7
- package/lib/constants/theme.js +2 -3
- package/lib/constants/typography.js +2 -5
- package/lib/contexts/dynamic-components-context.js +2 -8
- package/lib/managers/layout-manager.js +13 -28
- package/lib/managers/theme-manager.js +13 -32
- package/lib/managers/ui-manager.js +14 -26
- package/lib/utils/image.js +5 -14
- package/package.json +6 -6
|
@@ -1,82 +1,54 @@
|
|
|
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
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
8
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
9
|
var _body = _interopRequireDefault(require("../../constants/prop-types/body"));
|
|
15
|
-
|
|
16
10
|
var _multimedia = _interopRequireDefault(require("./multimedia"));
|
|
17
|
-
|
|
18
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
-
|
|
20
12
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
21
|
-
|
|
22
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
14
|
+
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); }
|
|
24
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
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); } }
|
|
27
|
-
|
|
16
|
+
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); } }
|
|
28
17
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
29
|
-
|
|
30
18
|
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); }
|
|
31
|
-
|
|
32
19
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
-
|
|
34
20
|
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); }; }
|
|
35
|
-
|
|
36
21
|
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); }
|
|
37
|
-
|
|
38
22
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
23
|
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; } }
|
|
41
|
-
|
|
42
24
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
25
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
27
|
+
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); }
|
|
46
28
|
var _ = {
|
|
47
29
|
get: _get["default"]
|
|
48
30
|
};
|
|
49
31
|
var Block = _multimedia["default"].Block;
|
|
50
|
-
|
|
51
32
|
var IframeBlock = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
52
33
|
displayName: "youtube__IframeBlock",
|
|
53
34
|
componentId: "sc-7pioae-0"
|
|
54
35
|
})(["padding-bottom:56.25%;position:relative;> iframe{position:absolute;top:0;left:0;width:100%;height:100%;}"]);
|
|
55
|
-
|
|
56
36
|
var Desc = _multimedia["default"].Caption;
|
|
57
|
-
|
|
58
|
-
var Youtube = /*#__PURE__*/function (_React$PureComponent) {
|
|
37
|
+
var Youtube = exports["default"] = /*#__PURE__*/function (_React$PureComponent) {
|
|
59
38
|
_inherits(Youtube, _React$PureComponent);
|
|
60
|
-
|
|
61
39
|
var _super = _createSuper(Youtube);
|
|
62
|
-
|
|
63
40
|
function Youtube() {
|
|
64
41
|
_classCallCheck(this, Youtube);
|
|
65
|
-
|
|
66
42
|
return _super.apply(this, arguments);
|
|
67
43
|
}
|
|
68
|
-
|
|
69
44
|
_createClass(Youtube, [{
|
|
70
45
|
key: "render",
|
|
71
46
|
value: function render() {
|
|
72
47
|
var _this$props = this.props,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
48
|
+
className = _this$props.className,
|
|
49
|
+
data = _this$props.data;
|
|
76
50
|
var id = _.get(data, 'content.0.youtubeId');
|
|
77
|
-
|
|
78
51
|
var desc = _.get(data, 'content.0.description');
|
|
79
|
-
|
|
80
52
|
return /*#__PURE__*/_react["default"].createElement(Block, {
|
|
81
53
|
className: className
|
|
82
54
|
}, /*#__PURE__*/_react["default"].createElement(IframeBlock, null, /*#__PURE__*/_react["default"].createElement("iframe", {
|
|
@@ -87,17 +59,12 @@ var Youtube = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
87
59
|
})), desc ? /*#__PURE__*/_react["default"].createElement(Desc, null, desc) : null);
|
|
88
60
|
}
|
|
89
61
|
}]);
|
|
90
|
-
|
|
91
62
|
return Youtube;
|
|
92
63
|
}(_react["default"].PureComponent);
|
|
93
|
-
|
|
94
|
-
exports["default"] = Youtube;
|
|
95
|
-
|
|
96
64
|
_defineProperty(Youtube, "propTypes", {
|
|
97
65
|
className: _propTypes["default"].string,
|
|
98
66
|
data: _body["default"].elementData.isRequired
|
|
99
67
|
});
|
|
100
|
-
|
|
101
68
|
_defineProperty(Youtube, "defaultProps", {
|
|
102
69
|
className: ''
|
|
103
70
|
});
|
|
@@ -1,101 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
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 = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
10
|
var _externalLinks = _interopRequireDefault(require("@twreporter/core/lib/constants/external-links"));
|
|
15
|
-
|
|
16
11
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
17
|
-
|
|
18
12
|
var _donationLinkAnchor = require("@twreporter/core/lib/constants/donation-link-anchor");
|
|
19
|
-
|
|
20
13
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
21
|
-
|
|
22
14
|
var _css = _interopRequireDefault(require("../constants/css"));
|
|
23
|
-
|
|
24
15
|
var _typography = _interopRequireDefault(require("../constants/typography"));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3; // @twreporter
|
|
17
|
+
// constants
|
|
28
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
34
21
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
|
-
|
|
36
|
-
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); } }
|
|
37
|
-
|
|
22
|
+
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); } }
|
|
38
23
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
|
-
|
|
24
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
25
|
+
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); }
|
|
40
26
|
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); }
|
|
41
|
-
|
|
42
27
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
|
-
|
|
44
28
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
45
|
-
|
|
46
29
|
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); }
|
|
47
|
-
|
|
48
30
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
-
|
|
50
31
|
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; } }
|
|
51
|
-
|
|
52
32
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
|
-
|
|
54
33
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
55
|
-
|
|
56
34
|
var _content = {
|
|
57
35
|
title: '用行動支持報導者',
|
|
58
36
|
desc: ['獨立的精神,是自由思想的條件。獨立的媒體,才能守護公共領域,讓自由的討論和真相浮現。', '在艱困的媒體環境,《報導者》堅持以非營利組織的模式投入公共領域的調查與深度報導。我們透過讀者的贊助支持來營運,不仰賴商業廣告置入,在獨立自主的前提下,穿梭在各項重要公共議題中。', '你的支持能幫助《報導者》持續追蹤國內外新聞事件的真相,邀請你加入 3 種支持方案,和我們一起推動這場媒體小革命。'],
|
|
59
37
|
bt: '立即支持'
|
|
60
38
|
};
|
|
61
|
-
|
|
62
39
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
63
40
|
displayName: "donation-box__Container",
|
|
64
41
|
componentId: "sc-1uszvr7-0"
|
|
65
42
|
})(["margin:60px auto 55px auto;padding:40px 30px 30px 30px;width:502px;min-height:284px;background:", ";border-left:solid 1px ", ";", ""], _color.colorGrayscale.white, function (props) {
|
|
66
43
|
return props.theme.colors.secondary.support;
|
|
67
44
|
}, _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 40px auto;\n width: 100%;\n min-height: 335px;\n "]))));
|
|
68
|
-
|
|
69
45
|
var Title = /*#__PURE__*/_styledComponents["default"].p.withConfig({
|
|
70
46
|
displayName: "donation-box__Title",
|
|
71
47
|
componentId: "sc-1uszvr7-1"
|
|
72
48
|
})(["display:inline-block;background:", ";padding-right:2px;box-shadow:5px 15px 0 ", " inset;font-size:22px;font-weight:", ";color:", ";margin-bottom:15px;", ""], function (props) {
|
|
73
49
|
return props.theme.colors.secondary.background;
|
|
74
50
|
}, _color.colorGrayscale.white, _typography["default"].font.weight.bold, _color.colorGrayscale.gray900, _mediaQuery["default"].mobileOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: 18px;\n "]))));
|
|
75
|
-
|
|
76
51
|
var Text = /*#__PURE__*/_styledComponents["default"].p.withConfig({
|
|
77
52
|
displayName: "donation-box__Text",
|
|
78
53
|
componentId: "sc-1uszvr7-2"
|
|
79
54
|
})(["font-size:16px;line-height:1.75;color:", ";margin-bottom:0.5em;&:last-of-type{margin-bottom:0;}", ""], _color.colorGrayscale.gray900, _css["default"].linkChildren);
|
|
80
|
-
|
|
81
55
|
var Donate = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
82
56
|
displayName: "donation-box__Donate",
|
|
83
57
|
componentId: "sc-1uszvr7-3"
|
|
84
58
|
})(["width:100%;height:55px;margin-top:50px;", " a{width:140px;height:55px;background:", ";display:table;float:right;cursor:pointer;text-decoration:none;p{display:table-cell;text-align:center;vertical-align:middle;font-size:14px;color:", ";font-weight:", ";letter-spacing:1.3px;}&:hover{background:", ";}}"], _mediaQuery["default"].mobileOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-top: 40px;\n "]))), _color.colorGrayscale.black, _color.colorGrayscale.white, _typography["default"].font.weight.normal, function (props) {
|
|
85
59
|
return props.theme.colors.secondary.accent;
|
|
86
60
|
});
|
|
87
|
-
|
|
88
|
-
var DonationBox = /*#__PURE__*/function (_PureComponent) {
|
|
61
|
+
var DonationBox = exports["default"] = /*#__PURE__*/function (_PureComponent) {
|
|
89
62
|
_inherits(DonationBox, _PureComponent);
|
|
90
|
-
|
|
91
63
|
var _super = _createSuper(DonationBox);
|
|
92
|
-
|
|
93
64
|
function DonationBox() {
|
|
94
65
|
_classCallCheck(this, DonationBox);
|
|
95
|
-
|
|
96
66
|
return _super.apply(this, arguments);
|
|
97
67
|
}
|
|
98
|
-
|
|
99
68
|
_createClass(DonationBox, [{
|
|
100
69
|
key: "render",
|
|
101
70
|
value: function render() {
|
|
@@ -110,8 +79,5 @@ var DonationBox = /*#__PURE__*/function (_PureComponent) {
|
|
|
110
79
|
}, /*#__PURE__*/_react["default"].createElement("p", null, _content.bt))));
|
|
111
80
|
}
|
|
112
81
|
}]);
|
|
113
|
-
|
|
114
82
|
return DonationBox;
|
|
115
|
-
}(_react.PureComponent);
|
|
116
|
-
|
|
117
|
-
exports["default"] = DonationBox;
|
|
83
|
+
}(_react.PureComponent);
|
|
@@ -1,72 +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
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
7
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
-
|
|
14
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
10
|
var _storageUrlProcessor = require("@twreporter/core/lib/utils/storage-url-processor");
|
|
17
|
-
|
|
18
11
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
19
|
-
|
|
20
12
|
var _rwd = require("@twreporter/react-components/lib/rwd");
|
|
21
|
-
|
|
22
13
|
var _icon = require("@twreporter/react-components/lib/icon");
|
|
23
|
-
|
|
24
14
|
var _releaseBranch = _interopRequireDefault(require("@twreporter/core/lib/constants/release-branch"));
|
|
25
|
-
|
|
26
15
|
var _zIndex = _interopRequireDefault(require("@twreporter/core/lib/constants/z-index"));
|
|
27
|
-
|
|
28
16
|
var _mediaQuery = require("@twreporter/core/lib/utils/media-query");
|
|
29
|
-
|
|
30
17
|
var _image = require("../../utils/image");
|
|
31
|
-
|
|
32
18
|
var _imgWithPlaceholder = _interopRequireDefault(require("../../constants/prop-types/img-with-placeholder"));
|
|
33
|
-
|
|
34
19
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
35
|
-
|
|
36
20
|
var _map = _interopRequireDefault(require("lodash/map"));
|
|
37
|
-
|
|
38
21
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
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; }
|
|
43
|
-
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
44
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
|
-
|
|
25
|
+
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); }
|
|
46
26
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
47
|
-
|
|
48
27
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
49
|
-
|
|
50
|
-
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); } }
|
|
51
|
-
|
|
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); } }
|
|
52
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; }
|
|
53
|
-
|
|
54
30
|
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); }
|
|
55
|
-
|
|
56
31
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
57
|
-
|
|
58
32
|
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); }; }
|
|
59
|
-
|
|
60
33
|
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); }
|
|
61
|
-
|
|
62
34
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
63
|
-
|
|
64
35
|
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; } }
|
|
65
|
-
|
|
66
36
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
|
|
37
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
38
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
39
|
+
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); } // @twreporter
|
|
70
40
|
var PlaceholderIcon = function PlaceholderIcon(props) {
|
|
71
41
|
return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("title", null, "Fill 1"), /*#__PURE__*/_react["default"].createElement("path", {
|
|
72
42
|
d: "M5 112.563a5.001 5.001 0 0 1-5-5V4.999C0 3.298.866 1.713 2.298.794A5.003 5.003 0 0 1 7.08.451l42.724 19.521a5 5 0 0 1-4.156 9.097L10 12.783V99.78l49.843-22.775V32.014a5 5 0 0 1 3.669-4.82l37.105-10.247a4.999 4.999 0 0 1 6.331 4.819v67.44a5.003 5.003 0 0 1-6.142 4.868l-20.106-4.716a5 5 0 0 1 2.284-9.736l13.965 3.275V28.332L69.844 35.82v44.4a5 5 0 0 1-2.922 4.549L7.078 112.11a4.996 4.996 0 0 1-2.079.451",
|
|
@@ -74,13 +44,12 @@ var PlaceholderIcon = function PlaceholderIcon(props) {
|
|
|
74
44
|
fillRule: "evenodd"
|
|
75
45
|
}));
|
|
76
46
|
};
|
|
77
|
-
|
|
78
47
|
PlaceholderIcon.defaultProps = {
|
|
79
48
|
width: "54",
|
|
80
49
|
height: "57",
|
|
81
50
|
viewBox: "0 0 107 113",
|
|
82
51
|
xmlns: "http://www.w3.org/2000/svg"
|
|
83
|
-
};
|
|
52
|
+
}; // lodash
|
|
84
53
|
var _ = {
|
|
85
54
|
get: _get["default"],
|
|
86
55
|
map: _map["default"],
|
|
@@ -90,14 +59,12 @@ var objectFitConsts = {
|
|
|
90
59
|
contain: 'contain',
|
|
91
60
|
cover: 'cover'
|
|
92
61
|
};
|
|
93
|
-
|
|
94
62
|
var ImgContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
95
63
|
displayName: "img-with-placeholder__ImgContainer",
|
|
96
64
|
componentId: "c6mvsc-0"
|
|
97
65
|
})(["position:relative;overflow:hidden;width:100%;", ""], function (props) {
|
|
98
66
|
return props.$heightString;
|
|
99
67
|
});
|
|
100
|
-
|
|
101
68
|
var ImgPlaceholder = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
102
69
|
displayName: "img-with-placeholder__ImgPlaceholder",
|
|
103
70
|
componentId: "c6mvsc-1"
|
|
@@ -108,14 +75,12 @@ var ImgPlaceholder = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
108
75
|
}, function (props) {
|
|
109
76
|
return props.$src;
|
|
110
77
|
});
|
|
111
|
-
|
|
112
78
|
var Placeholder = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
113
79
|
displayName: "img-with-placeholder__Placeholder",
|
|
114
80
|
componentId: "c6mvsc-2"
|
|
115
81
|
})(["width:100%;height:100%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:", ";svg{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);}"], function (props) {
|
|
116
82
|
return props.$toShow ? 'block' : 'none';
|
|
117
83
|
});
|
|
118
|
-
|
|
119
84
|
var ImgWithObjectFit = /*#__PURE__*/_styledComponents["default"].img.withConfig({
|
|
120
85
|
displayName: "img-with-placeholder__ImgWithObjectFit",
|
|
121
86
|
componentId: "c6mvsc-3"
|
|
@@ -126,7 +91,6 @@ var ImgWithObjectFit = /*#__PURE__*/_styledComponents["default"].img.withConfig(
|
|
|
126
91
|
}, function (props) {
|
|
127
92
|
return props.toShowFallback ? '0' : '1';
|
|
128
93
|
});
|
|
129
|
-
|
|
130
94
|
var FallbackObjectFitImg = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
131
95
|
displayName: "img-with-placeholder__FallbackObjectFitImg",
|
|
132
96
|
componentId: "c6mvsc-4"
|
|
@@ -137,28 +101,25 @@ var FallbackObjectFitImg = /*#__PURE__*/_styledComponents["default"].div.withCon
|
|
|
137
101
|
}, function (props) {
|
|
138
102
|
return props.$url;
|
|
139
103
|
});
|
|
140
|
-
|
|
141
104
|
var ImgBox = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
142
105
|
displayName: "img-with-placeholder__ImgBox",
|
|
143
106
|
componentId: "c6mvsc-5"
|
|
144
107
|
})(["position:absolute;top:0;left:0;width:100%;height:100%;opacity:", ";transition:opacity 0.5s;& > img{width:100%;}"], function (props) {
|
|
145
108
|
return props.$toShow ? '1' : '0';
|
|
146
109
|
});
|
|
147
|
-
|
|
148
110
|
var FullScreenImageMask = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
149
111
|
displayName: "img-with-placeholder__FullScreenImageMask",
|
|
150
112
|
componentId: "c6mvsc-6"
|
|
151
113
|
})(["position:fixed;left:0px;top:0px;width:100vw;height:100vh;background-color:", ";z-index:", ";display:flex;justify-content:center;align-items:center;"], _color.colorOpacity['black_0.5'], _zIndex["default"].articleImgFullScreenMask);
|
|
152
|
-
|
|
153
114
|
var FullScreenImage = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
154
115
|
displayName: "img-with-placeholder__FullScreenImage",
|
|
155
116
|
componentId: "c6mvsc-7"
|
|
156
117
|
})(["position:relative;img{max-width:90vw;max-height:90vh;}"]);
|
|
157
|
-
|
|
158
118
|
var CrossIcon = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
159
119
|
displayName: "img-with-placeholder__CrossIcon",
|
|
160
120
|
componentId: "c6mvsc-8"
|
|
161
121
|
})(["cursor:pointer;position:absolute;top:0px;right:-40px;height:24px;width:24px;svg{background-color:", ";}"], _color.colorGrayscale.white);
|
|
122
|
+
|
|
162
123
|
/**
|
|
163
124
|
* An image element with placeholder.
|
|
164
125
|
* The width and height of the image are required to preserve the space on the page for image.
|
|
@@ -166,28 +127,19 @@ var CrossIcon = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
166
127
|
* @class Image
|
|
167
128
|
* @extends {React.PureComponent}
|
|
168
129
|
*/
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
130
|
+
var Img = exports["default"] = /*#__PURE__*/function (_React$PureComponent) {
|
|
172
131
|
_inherits(Img, _React$PureComponent);
|
|
173
|
-
|
|
174
132
|
var _super = _createSuper(Img);
|
|
175
|
-
|
|
176
133
|
function Img(props) {
|
|
177
134
|
var _this;
|
|
178
|
-
|
|
179
135
|
_classCallCheck(this, Img);
|
|
180
|
-
|
|
181
136
|
_this = _super.call(this, props);
|
|
182
|
-
|
|
183
137
|
_defineProperty(_assertThisInitialized(_this), "_handleWindowResize", function () {
|
|
184
138
|
var windowWidth = window.innerWidth;
|
|
185
|
-
|
|
186
139
|
_this.setState({
|
|
187
140
|
isMobile: windowWidth < _mediaQuery.DEFAULT_SCREEN.tablet.minWidth
|
|
188
141
|
});
|
|
189
142
|
});
|
|
190
|
-
|
|
191
143
|
_this.state = {
|
|
192
144
|
isLoaded: false,
|
|
193
145
|
toShowPlaceholder: true,
|
|
@@ -201,20 +153,18 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
201
153
|
_this._supportObjectFit = true;
|
|
202
154
|
return _this;
|
|
203
155
|
}
|
|
204
|
-
|
|
205
156
|
_createClass(Img, [{
|
|
206
157
|
key: "componentDidMount",
|
|
207
158
|
value: function componentDidMount() {
|
|
208
159
|
// Check if browser support css object-fit.
|
|
209
160
|
// Ref: https://github.com/anselmh/object-fit/blob/c6e275b099caf59ca44bfc5cbbaf4c388ace9980/src/polyfill.object-fit.core.js#L396
|
|
210
161
|
this._supportObjectFit = 'objectFit' in document.documentElement.style === true;
|
|
211
|
-
this._isMounted = true;
|
|
162
|
+
this._isMounted = true;
|
|
163
|
+
// If the browser has cached the image already, the `load` event of `<img>` will never be triggered.
|
|
212
164
|
// Hence, we need to trigger `handleImageLoaded` manually.
|
|
213
|
-
|
|
214
165
|
if (_.get(this._img.current, 'complete')) {
|
|
215
166
|
this.handleImageLoaded();
|
|
216
167
|
}
|
|
217
|
-
|
|
218
168
|
window.addEventListener('resize', this.handleWindowResize);
|
|
219
169
|
this.handleWindowResize();
|
|
220
170
|
}
|
|
@@ -228,10 +178,10 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
228
178
|
key: "handleImageLoaded",
|
|
229
179
|
value: function handleImageLoaded() {
|
|
230
180
|
var _this2 = this;
|
|
231
|
-
|
|
232
181
|
// Progressive image
|
|
233
182
|
// Let user see the blur image,
|
|
234
183
|
// and slowly make the blur image clearer
|
|
184
|
+
|
|
235
185
|
// in order to make sure users see the blur image,
|
|
236
186
|
// delay the clear image rendering
|
|
237
187
|
setTimeout(function () {
|
|
@@ -240,8 +190,9 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
240
190
|
isLoaded: true
|
|
241
191
|
});
|
|
242
192
|
}
|
|
243
|
-
}, 500);
|
|
193
|
+
}, 500);
|
|
244
194
|
|
|
195
|
+
// after clear image rendered, not display placeholder anymore
|
|
245
196
|
setTimeout(function () {
|
|
246
197
|
if (_this2._isMounted) {
|
|
247
198
|
_this2.setState({
|
|
@@ -255,23 +206,20 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
255
206
|
value: function _renderImagePlaceholder() {
|
|
256
207
|
var toShowPlaceholder = this.state.toShowPlaceholder;
|
|
257
208
|
var _this$props = this.props,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
209
|
+
imgPlaceholderSrc = _this$props.imgPlaceholderSrc,
|
|
210
|
+
placeholderNoBlur = _this$props.placeholderNoBlur,
|
|
211
|
+
noImgPlaceholder = _this$props.noImgPlaceholder;
|
|
262
212
|
if (noImgPlaceholder) {
|
|
263
213
|
return null;
|
|
264
214
|
}
|
|
265
|
-
|
|
266
215
|
if (imgPlaceholderSrc) {
|
|
267
216
|
return /*#__PURE__*/_react["default"].createElement(ImgPlaceholder, {
|
|
268
217
|
$src: (0, _storageUrlProcessor.replaceGCSUrlOrigin)(imgPlaceholderSrc),
|
|
269
218
|
$toShow: toShowPlaceholder,
|
|
270
219
|
$noBlur: placeholderNoBlur
|
|
271
220
|
});
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
221
|
+
}
|
|
222
|
+
// render default placeholder
|
|
275
223
|
return /*#__PURE__*/_react["default"].createElement(Placeholder, {
|
|
276
224
|
$toShow: toShowPlaceholder
|
|
277
225
|
}, /*#__PURE__*/_react["default"].createElement(PlaceholderIcon, null));
|
|
@@ -280,64 +228,50 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
280
228
|
key: "render",
|
|
281
229
|
value: function render() {
|
|
282
230
|
var _this$context,
|
|
283
|
-
|
|
284
|
-
|
|
231
|
+
_this3 = this;
|
|
285
232
|
var _this$state = this.state,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
233
|
+
isLoaded = _this$state.isLoaded,
|
|
234
|
+
showFullScreenImg = _this$state.showFullScreenImg,
|
|
235
|
+
isMobile = _this$state.isMobile;
|
|
289
236
|
var _this$props2 = this.props,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
var releaseBranch = (this === null || this === void 0
|
|
300
|
-
|
|
237
|
+
alt = _this$props2.alt,
|
|
238
|
+
className = _this$props2.className,
|
|
239
|
+
imgProps = _this$props2.imgProps,
|
|
240
|
+
imageSet = _this$props2.imageSet,
|
|
241
|
+
defaultImage = _this$props2.defaultImage,
|
|
242
|
+
objectFit = _this$props2.objectFit,
|
|
243
|
+
objectPosition = _this$props2.objectPosition,
|
|
244
|
+
sizes = _this$props2.sizes,
|
|
245
|
+
clickable = _this$props2.clickable;
|
|
246
|
+
var releaseBranch = (this === null || this === void 0 || (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.releaseBranch) || _releaseBranch["default"].release;
|
|
301
247
|
var openFullScreen = function openFullScreen() {
|
|
302
248
|
if (isMobile) return;
|
|
303
|
-
|
|
304
249
|
_this3.setState({
|
|
305
250
|
showFullScreenImg: true
|
|
306
251
|
});
|
|
307
|
-
|
|
308
252
|
document.body.classList.add('disable-scroll');
|
|
309
253
|
};
|
|
310
|
-
|
|
311
254
|
var closeFullScreen = function closeFullScreen() {
|
|
312
255
|
_this3.setState({
|
|
313
256
|
showFullScreenImg: false
|
|
314
257
|
});
|
|
315
|
-
|
|
316
258
|
document.body.classList.remove('disable-scroll');
|
|
317
259
|
};
|
|
318
|
-
|
|
319
260
|
var appendedClassName = className + ' avoid-break';
|
|
320
|
-
|
|
321
261
|
var defaultImageOriginalUrl = _.get(defaultImage, 'url');
|
|
322
262
|
/* Render placeholder only if no valid image is given */
|
|
323
|
-
|
|
324
|
-
|
|
325
263
|
if (!defaultImageOriginalUrl && (!imageSet || imageSet.length === 0)) {
|
|
326
264
|
return /*#__PURE__*/_react["default"].createElement(ImgContainer, {
|
|
327
265
|
className: appendedClassName,
|
|
328
266
|
$heightString: "height: 100%;"
|
|
329
267
|
}, this._renderImagePlaceholder());
|
|
330
268
|
}
|
|
331
|
-
|
|
332
269
|
var srcset = (0, _image.getSrcsetString)(imageSet);
|
|
333
270
|
var isObjectFit = Boolean(objectFit);
|
|
334
|
-
|
|
335
271
|
var heightWidthRatio = _.get(defaultImage, 'height') / _.get(defaultImage, 'width');
|
|
336
|
-
|
|
337
272
|
if (isObjectFit && !heightWidthRatio) {
|
|
338
273
|
console.warn('Warning on Img component:', 'The `objecFit` is set, but no valid height/width ratio of `props.defaultImage` is given.', '`props.defaultImage`:', defaultImage);
|
|
339
274
|
}
|
|
340
|
-
|
|
341
275
|
var defaultImageSrc = (0, _storageUrlProcessor.replaceGCSUrlOrigin)(_.get(defaultImage, 'url'));
|
|
342
276
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(ImgContainer, {
|
|
343
277
|
className: appendedClassName,
|
|
@@ -379,14 +313,9 @@ var Img = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
379
313
|
}))))));
|
|
380
314
|
}
|
|
381
315
|
}]);
|
|
382
|
-
|
|
383
316
|
return Img;
|
|
384
317
|
}(_react["default"].PureComponent);
|
|
385
|
-
|
|
386
|
-
exports["default"] = Img;
|
|
387
|
-
|
|
388
318
|
_defineProperty(Img, "contextType", _styledComponents.ThemeContext);
|
|
389
|
-
|
|
390
319
|
_defineProperty(Img, "propTypes", {
|
|
391
320
|
alt: _propTypes["default"].string,
|
|
392
321
|
className: _propTypes["default"].string,
|
|
@@ -406,7 +335,6 @@ _defineProperty(Img, "propTypes", {
|
|
|
406
335
|
sizes: _propTypes["default"].string.isRequired,
|
|
407
336
|
clickable: _propTypes["default"].bool
|
|
408
337
|
});
|
|
409
|
-
|
|
410
338
|
_defineProperty(Img, "defaultProps", {
|
|
411
339
|
alt: '',
|
|
412
340
|
className: '',
|