@twreporter/react-components 9.0.2 → 9.1.0-rc.0
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 +22 -0
- package/lib/badge/badge.stories.js +3 -9
- package/lib/badge/index.js +8 -24
- package/lib/bookmark-list/bookmark.js +20 -69
- package/lib/bookmark-list/bookmarks.js +10 -40
- package/lib/bookmark-list/customized-link.js +4 -14
- package/lib/bookmark-list/image-wrapper.js +9 -36
- package/lib/bookmark-list/index.js +36 -91
- package/lib/bookmark-list/redirect-to-sign-in.js +1 -10
- package/lib/bookmark-list/stories/bookmark.stories.js +3 -9
- package/lib/bookmark-widget/index.js +91 -220
- package/lib/button/components/iconButton.js +15 -34
- package/lib/button/components/iconWithTextButton.js +16 -31
- package/lib/button/components/link.js +27 -45
- package/lib/button/components/menuButton.js +18 -38
- package/lib/button/components/pillButton.js +31 -60
- package/lib/button/components/textButton.js +29 -61
- package/lib/button/components/toggleButton.js +11 -31
- package/lib/button/enums/index.js +4 -7
- package/lib/button/index.js +5 -18
- package/lib/button/stories/iconButton.stories.js +4 -15
- package/lib/button/stories/iconWithTextButton.stories.js +4 -13
- package/lib/button/stories/link.stories.js +9 -27
- package/lib/button/stories/menuButton.stories.js +3 -10
- package/lib/button/stories/pillButton.stories.js +4 -15
- package/lib/button/stories/textButton.stories.js +4 -15
- package/lib/button/stories/toggleButton.stories.js +3 -8
- package/lib/button/utils/size.js +3 -8
- package/lib/button/utils/theme.js +11 -102
- package/lib/card/components/article-card.js +31 -59
- package/lib/card/components/dialog.js +7 -22
- package/lib/card/components/short-story.js +24 -44
- package/lib/card/index.js +2 -8
- package/lib/card/stories/articleCard.stories.js +3 -14
- package/lib/card/stories/dialog.stories.js +3 -11
- package/lib/card/stories/shortStory.stories.js +3 -16
- package/lib/checkbox/checkbox.stories.js +3 -8
- package/lib/checkbox/index.js +10 -31
- package/lib/color.stories.js +9 -34
- package/lib/confirmation/index.js +7 -29
- package/lib/customized-link.js +5 -18
- package/lib/divider.js +3 -19
- package/lib/divider.stories.js +5 -18
- package/lib/donation-link.js +2 -14
- package/lib/empty-state/enums/index.js +2 -3
- package/lib/empty-state/index.js +20 -41
- package/lib/empty-state/stories/empty-guide.stories.js +3 -11
- package/lib/error/index.js +3 -8
- package/lib/error/message.js +3 -44
- package/lib/footer/constants/links.js +10 -16
- package/lib/footer/footer.stories.js +3 -10
- package/lib/footer/index.js +5 -40
- package/lib/footer/link.js +15 -46
- package/lib/footer/logo.js +12 -32
- package/lib/hook/index.js +3 -18
- package/lib/hook/use-bookmark.js +21 -47
- package/lib/hook/use-font-face-observer.js +9 -24
- package/lib/hook/use-outside-click.js +4 -9
- package/lib/icon/enum/index.js +5 -9
- package/lib/icon/index.js +49 -105
- package/lib/icon/stories/arrow.stories.js +7 -16
- package/lib/icon/stories/article.stories.js +2 -7
- package/lib/icon/stories/bookmark.stories.js +6 -14
- package/lib/icon/stories/changeIconColor.stories.js +2 -12
- package/lib/icon/stories/clock.stories.js +2 -7
- package/lib/icon/stories/copy.stories.js +2 -7
- package/lib/icon/stories/cross.stories.js +2 -7
- package/lib/icon/stories/hamburger.stories.js +2 -7
- package/lib/icon/stories/home.stories.js +2 -7
- package/lib/icon/stories/letter.stories.js +2 -7
- package/lib/icon/stories/loading.stories.js +2 -7
- package/lib/icon/stories/member.stories.js +2 -7
- package/lib/icon/stories/printer.stories.js +2 -7
- package/lib/icon/stories/search.stories.js +2 -7
- package/lib/icon/stories/share.stories.js +2 -7
- package/lib/icon/stories/socialMedia.stories.js +2 -8
- package/lib/icon/stories/text.stories.js +2 -7
- package/lib/icon/stories/topic.stories.js +2 -7
- package/lib/image-with-fallback.js +22 -52
- package/lib/input/components/search-bar.js +40 -85
- package/lib/input/components/text-field.js +20 -40
- package/lib/input/enums/index.js +6 -8
- package/lib/input/index.js +2 -7
- package/lib/input/stories/search-bar.stories.js +3 -16
- package/lib/input/stories/text-field.stories.js +3 -14
- package/lib/input/utils/theme.js +2 -9
- package/lib/is-fetching-wrapper.js +16 -48
- package/lib/junior-link.js +6 -29
- package/lib/link-with-tracker.js +14 -47
- package/lib/listing-page/components/card-list.js +20 -51
- package/lib/listing-page/components/image.js +15 -46
- package/lib/listing-page/components/list-item.js +18 -65
- package/lib/listing-page/components/list.js +17 -61
- package/lib/listing-page/components/page-content.js +2 -12
- package/lib/listing-page/components/topics/index.js +26 -74
- package/lib/listing-page/components/topics/post-item.js +14 -47
- package/lib/listing-page/components/topics/posts.js +1 -10
- package/lib/listing-page/components/topics/section.js +3 -25
- package/lib/listing-page/components/topics/topic-item.js +17 -56
- package/lib/listing-page/constants/mockup-spec.js +2 -3
- package/lib/listing-page/constants/predefined-css.js +2 -10
- package/lib/listing-page/constants/prop-types.js +2 -7
- package/lib/listing-page/constants/topics.js +2 -3
- package/lib/listing-page/index.js +2 -8
- package/lib/listing-page/stories/cardList.stories.js +3 -10
- package/lib/logo/components/logo-footer.js +6 -21
- package/lib/logo/components/logo-header.js +7 -23
- package/lib/logo/components/logo-loading-fallback.js +4 -13
- package/lib/logo/components/logo-symbol.js +7 -23
- package/lib/logo/index.js +2 -9
- package/lib/logo/stories/logoFooter.stories.js +2 -8
- package/lib/logo/stories/logoHeader.stories.js +3 -9
- package/lib/logo/stories/logoLoadingFallback.stories.js +2 -8
- package/lib/logo/stories/logoSymbol.stories.js +3 -9
- package/lib/logo/utils/path.js +2 -9
- package/lib/material-icon.js +9 -17
- package/lib/mobile-member-role-card/index.js +22 -49
- package/lib/mobile-member-role-card/stories/member-role-card.stories.js +3 -12
- package/lib/mobile-pop-up-modal.js +10 -44
- package/lib/more.js +10 -37
- package/lib/pagination/index.js +17 -83
- package/lib/podcast-link.js +6 -29
- package/lib/rwd.js +6 -26
- package/lib/shared-enum.js +2 -3
- package/lib/side-bar/index.js +16 -59
- package/lib/simple-header/index.js +2 -12
- package/lib/simple-header/simpleHeader.stories.js +3 -8
- package/lib/snack-bar/components/snack-bar.js +9 -20
- package/lib/snack-bar/hooks/use-snack-bar.js +12 -25
- package/lib/snack-bar/index.js +2 -7
- package/lib/snack-bar/stories/snackBar.stories.js +12 -29
- package/lib/snack-bar/utils/theme.js +3 -9
- package/lib/storybook/constants/index.js +3 -11
- package/lib/storybook/utils/get-enum-arg.js +2 -5
- package/lib/table-of-contents/index.js +62 -128
- package/lib/text/constants/headline-type.js +5 -8
- package/lib/text/enums/index.js +3 -5
- package/lib/text/headline.js +14 -41
- package/lib/text/paragraph.js +13 -34
- package/lib/text/stories/headline.stories.js +8 -21
- package/lib/text/stories/paragraph.stories.js +6 -17
- package/lib/text/utils/webfonts.js +9 -22
- package/lib/title-bar/components/tab.js +27 -69
- package/lib/title-bar/components/title1.js +6 -17
- package/lib/title-bar/components/title2.js +7 -23
- package/lib/title-bar/index.js +2 -8
- package/lib/title-bar/stories/tab.stories.js +5 -12
- package/lib/title-bar/stories/title1.stories.js +5 -12
- package/lib/title-bar/stories/title2.stories.js +3 -11
- package/lib/utils/link-with-params.js +0 -5
- package/package.json +4 -4
- package/lib/hook/use-store.js +0 -46
|
@@ -4,43 +4,27 @@ 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 _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
10
|
var _card = require("../../card");
|
|
15
|
-
|
|
16
11
|
var _isFetchingWrapper = _interopRequireDefault(require("../../is-fetching-wrapper"));
|
|
17
|
-
|
|
18
12
|
var _divider = _interopRequireDefault(require("../../divider"));
|
|
19
|
-
|
|
20
13
|
var _rwd = require("../../rwd");
|
|
21
|
-
|
|
22
14
|
var _mockupSpec = _interopRequireDefault(require("../constants/mockup-spec"));
|
|
23
|
-
|
|
24
15
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
25
|
-
|
|
26
16
|
var _date = require("@twreporter/core/lib/utils/date");
|
|
27
|
-
|
|
28
17
|
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
29
|
-
|
|
30
18
|
var _forEach = _interopRequireDefault(require("lodash/forEach"));
|
|
31
|
-
|
|
32
19
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
33
|
-
|
|
34
20
|
var _map = _interopRequireDefault(require("lodash/map"));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
var _templateObject, _templateObject2, _templateObject3; // components
|
|
22
|
+
// constants
|
|
23
|
+
// @twreporter
|
|
24
|
+
// lodash
|
|
38
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
39
|
-
|
|
40
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); }
|
|
41
|
-
|
|
42
27
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
43
|
-
|
|
44
28
|
var _ = {
|
|
45
29
|
forEach: _forEach["default"],
|
|
46
30
|
get: _get["default"],
|
|
@@ -50,22 +34,18 @@ var Card = /*#__PURE__*/(0, _styledComponents["default"])(_card.ArticleCard).wit
|
|
|
50
34
|
displayName: "card-list__Card",
|
|
51
35
|
componentId: "yvf001-0"
|
|
52
36
|
})(["width:100%;"]);
|
|
53
|
-
|
|
54
37
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
55
38
|
displayName: "card-list__Container",
|
|
56
39
|
componentId: "yvf001-1"
|
|
57
40
|
})(["display:flex;flex-direction:column;"]);
|
|
58
|
-
|
|
59
41
|
var Item = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
60
42
|
displayName: "card-list__Item",
|
|
61
43
|
componentId: "yvf001-2"
|
|
62
44
|
})(["margin-bottom:24px;&:last-child{margin-bottom:0;}width:100%;"]);
|
|
63
|
-
|
|
64
45
|
var StyledDivider = /*#__PURE__*/(0, _styledComponents["default"])(_divider["default"]).withConfig({
|
|
65
46
|
displayName: "card-list__StyledDivider",
|
|
66
47
|
componentId: "yvf001-3"
|
|
67
48
|
})(["margin-top:24px;"]);
|
|
68
|
-
|
|
69
49
|
var FlexItem = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
70
50
|
displayName: "card-list__FlexItem",
|
|
71
51
|
componentId: "yvf001-4"
|
|
@@ -76,48 +56,40 @@ var FlexItem = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
76
56
|
}), _mediaQuery["default"].tabletOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), function (props) {
|
|
77
57
|
return props.$width !== 0 ? "".concat(props.$width, "%") : _mockupSpec["default"].tablet.maxWidth;
|
|
78
58
|
}), _mediaQuery["default"].mobileOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n justify-content: center;\n "]))));
|
|
79
|
-
|
|
80
59
|
var Content = (0, _isFetchingWrapper["default"])(FlexItem);
|
|
81
|
-
|
|
82
60
|
var CardList = function CardList(_ref) {
|
|
83
61
|
var _ref$data = _ref.data,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
62
|
+
data = _ref$data === void 0 ? [] : _ref$data,
|
|
63
|
+
_ref$isFetching = _ref.isFetching,
|
|
64
|
+
isFetching = _ref$isFetching === void 0 ? false : _ref$isFetching,
|
|
65
|
+
_ref$showSpinner = _ref.showSpinner,
|
|
66
|
+
showSpinner = _ref$showSpinner === void 0 ? false : _ref$showSpinner,
|
|
67
|
+
_ref$releaseBranch = _ref.releaseBranch,
|
|
68
|
+
releaseBranch = _ref$releaseBranch === void 0 ? _releaseBranch.BRANCH.master : _ref$releaseBranch,
|
|
69
|
+
_ref$showIsBookmarked = _ref.showIsBookmarked,
|
|
70
|
+
showIsBookmarked = _ref$showIsBookmarked === void 0 ? false : _ref$showIsBookmarked,
|
|
71
|
+
_ref$width = _ref.width,
|
|
72
|
+
width = _ref$width === void 0 ? 0 : _ref$width;
|
|
96
73
|
if (!data || data.length === 0) {
|
|
97
74
|
return null;
|
|
98
75
|
}
|
|
99
|
-
|
|
100
76
|
var getFirstCategory = function getFirstCategory(categorySets) {
|
|
101
77
|
var res = '';
|
|
102
|
-
|
|
103
78
|
_.forEach(categorySets, function (_ref2) {
|
|
104
79
|
var category = _ref2.category,
|
|
105
|
-
|
|
106
|
-
|
|
80
|
+
subcategory = _ref2.subcategory;
|
|
107
81
|
if (category && category.name) {
|
|
108
82
|
res = category.name;
|
|
109
83
|
return false;
|
|
110
84
|
}
|
|
111
85
|
});
|
|
112
|
-
|
|
113
86
|
return res;
|
|
114
87
|
};
|
|
115
|
-
|
|
116
88
|
var listJSX = _.map(data, function (item) {
|
|
117
89
|
var id = item.id,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
90
|
+
title = item.title,
|
|
91
|
+
slug = item.slug,
|
|
92
|
+
style = item.style;
|
|
121
93
|
var articleCardProps = {
|
|
122
94
|
title: title,
|
|
123
95
|
description: _.get(item, 'og_description', ''),
|
|
@@ -143,14 +115,12 @@ var CardList = function CardList(_ref) {
|
|
|
143
115
|
size: _card.ArticleCard.Size.S
|
|
144
116
|
}))), /*#__PURE__*/_react["default"].createElement(StyledDivider, null));
|
|
145
117
|
});
|
|
146
|
-
|
|
147
118
|
return /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(Content, {
|
|
148
119
|
isFetching: isFetching,
|
|
149
120
|
showSpinner: showSpinner,
|
|
150
121
|
$width: width
|
|
151
122
|
}, listJSX));
|
|
152
123
|
};
|
|
153
|
-
|
|
154
124
|
CardList.propTypes = {
|
|
155
125
|
data: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
156
126
|
id: _propTypes["default"].string.isRequired,
|
|
@@ -171,5 +141,4 @@ CardList.propTypes = {
|
|
|
171
141
|
showIsBookmarked: _propTypes["default"].bool,
|
|
172
142
|
width: _propTypes["default"].number
|
|
173
143
|
};
|
|
174
|
-
var _default = CardList;
|
|
175
|
-
exports["default"] = _default;
|
|
144
|
+
var _default = exports["default"] = CardList;
|
|
@@ -1,46 +1,29 @@
|
|
|
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 = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
-
|
|
16
11
|
var _storageUrlProcessor = require("@twreporter/core/lib/utils/storage-url-processor");
|
|
17
|
-
|
|
18
12
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
19
|
-
|
|
20
13
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
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
|
-
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
+
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); }
|
|
30
20
|
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
21
|
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
22
|
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
23
|
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
24
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
25
|
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
26
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
27
|
/* Notice: this component is deprecated.
|
|
45
28
|
* Please migrate to use @twerporter/react-components/lib/image-with-fallback.js
|
|
46
29
|
*/
|
|
@@ -51,22 +34,19 @@ var LogoIcon = function LogoIcon(props) {
|
|
|
51
34
|
fillRule: "evenodd"
|
|
52
35
|
}));
|
|
53
36
|
};
|
|
54
|
-
|
|
55
37
|
LogoIcon.defaultProps = {
|
|
56
38
|
width: "107",
|
|
57
39
|
height: "113",
|
|
58
40
|
viewBox: "0 0 107 113",
|
|
59
41
|
xmlns: "http://www.w3.org/2000/svg"
|
|
60
|
-
};
|
|
42
|
+
}; // lodash
|
|
61
43
|
var _ = {
|
|
62
44
|
get: _get["default"]
|
|
63
45
|
};
|
|
64
|
-
|
|
65
46
|
var ImgContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
66
47
|
displayName: "image__ImgContainer",
|
|
67
48
|
componentId: "iof1ou-0"
|
|
68
49
|
})(["width:100%;height:100%;position:relative;"]);
|
|
69
|
-
|
|
70
50
|
var ImgObjectFit = /*#__PURE__*/(0, _styledComponents["default"])(ImgContainer).withConfig({
|
|
71
51
|
displayName: "image__ImgObjectFit",
|
|
72
52
|
componentId: "iof1ou-1"
|
|
@@ -78,25 +58,21 @@ var ImgFallback = /*#__PURE__*/(0, _styledComponents["default"])(ImgContainer).w
|
|
|
78
58
|
componentId: "iof1ou-2"
|
|
79
59
|
})(["background-size:cover;background-image:", ";background-position:center center;"], function (props) {
|
|
80
60
|
return "url(".concat((0, _storageUrlProcessor.replaceGCSUrlOrigin)(_.get(props, 'url')), ")");
|
|
81
|
-
});
|
|
61
|
+
});
|
|
82
62
|
|
|
63
|
+
// Vertically and horizontally centering
|
|
83
64
|
var LogoCenteringBlock = /*#__PURE__*/(0, _styledComponents["default"])(ImgContainer).withConfig({
|
|
84
65
|
displayName: "image__LogoCenteringBlock",
|
|
85
66
|
componentId: "iof1ou-3"
|
|
86
67
|
})(["position:absolute;justify-content:center;align-items:center;background-color:", ";display:", ";"], _color.colorGrayscale.white, function (props) {
|
|
87
68
|
return props.$display;
|
|
88
69
|
});
|
|
89
|
-
|
|
90
70
|
var Image = /*#__PURE__*/function (_React$PureComponent) {
|
|
91
71
|
_inherits(Image, _React$PureComponent);
|
|
92
|
-
|
|
93
72
|
var _super = _createSuper(Image);
|
|
94
|
-
|
|
95
73
|
function Image(props) {
|
|
96
74
|
var _this;
|
|
97
|
-
|
|
98
75
|
_classCallCheck(this, Image);
|
|
99
|
-
|
|
100
76
|
_this = _super.call(this, props);
|
|
101
77
|
_this.state = {
|
|
102
78
|
isObjectFit: true,
|
|
@@ -106,16 +82,15 @@ var Image = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
106
82
|
_this.imgNode = null;
|
|
107
83
|
return _this;
|
|
108
84
|
}
|
|
109
|
-
|
|
110
85
|
_createClass(Image, [{
|
|
111
86
|
key: "componentDidMount",
|
|
112
87
|
value: function componentDidMount() {
|
|
113
88
|
this.setState({
|
|
114
89
|
isObjectFit: 'objectFit' in _.get(document, 'documentElement.style')
|
|
115
|
-
});
|
|
90
|
+
});
|
|
91
|
+
// Check if img is already loaded, and cached on the browser.
|
|
116
92
|
// If cached, React.img won't trigger onLoad event.
|
|
117
93
|
// Hence, we need to trigger re-rendering.
|
|
118
|
-
|
|
119
94
|
if (this.imgNode) {
|
|
120
95
|
this.setState({
|
|
121
96
|
isImgOnLoad: this.imgNode.complete
|
|
@@ -138,22 +113,19 @@ var Image = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
138
113
|
key: "render",
|
|
139
114
|
value: function render() {
|
|
140
115
|
var _this2 = this;
|
|
141
|
-
|
|
142
116
|
var _this$props = this.props,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
117
|
+
src = _this$props.src,
|
|
118
|
+
alt = _this$props.alt,
|
|
119
|
+
srcSet = _this$props.srcSet;
|
|
146
120
|
var _this$state = this.state,
|
|
147
|
-
|
|
148
|
-
|
|
121
|
+
isObjectFit = _this$state.isObjectFit,
|
|
122
|
+
isImgOnLoad = _this$state.isImgOnLoad;
|
|
149
123
|
var logoDisplay = 'flex';
|
|
150
|
-
|
|
151
124
|
if (!isObjectFit) {
|
|
152
125
|
logoDisplay = 'none';
|
|
153
126
|
} else if (isImgOnLoad) {
|
|
154
127
|
logoDisplay = 'none';
|
|
155
128
|
}
|
|
156
|
-
|
|
157
129
|
var ImgJSX = isObjectFit ? /*#__PURE__*/_react["default"].createElement(ImgObjectFit, {
|
|
158
130
|
$opacity: isImgOnLoad ? 1 : 0
|
|
159
131
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
@@ -172,10 +144,8 @@ var Image = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
172
144
|
}, /*#__PURE__*/_react["default"].createElement(LogoIcon, null)), ImgJSX);
|
|
173
145
|
}
|
|
174
146
|
}]);
|
|
175
|
-
|
|
176
147
|
return Image;
|
|
177
148
|
}(_react["default"].PureComponent);
|
|
178
|
-
|
|
179
149
|
Image.defaultProps = {
|
|
180
150
|
alt: '',
|
|
181
151
|
src: '',
|
|
@@ -186,5 +156,4 @@ Image.propTypes = {
|
|
|
186
156
|
src: _propTypes["default"].string.isRequired,
|
|
187
157
|
srcSet: _propTypes["default"].string
|
|
188
158
|
};
|
|
189
|
-
var _default = Image;
|
|
190
|
-
exports["default"] = _default;
|
|
159
|
+
var _default = exports["default"] = Image;
|
|
@@ -1,118 +1,83 @@
|
|
|
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 _reactRouterDom = require("react-router-dom");
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
|
-
|
|
18
12
|
var _image = _interopRequireDefault(require("./image"));
|
|
19
|
-
|
|
20
13
|
var _paragraph = require("../../text/paragraph");
|
|
21
|
-
|
|
22
14
|
var _mockupSpec = _interopRequireDefault(require("../constants/mockup-spec"));
|
|
23
|
-
|
|
24
15
|
var _entityPath = _interopRequireDefault(require("@twreporter/core/lib/constants/entity-path"));
|
|
25
|
-
|
|
26
16
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
27
|
-
|
|
28
17
|
var _font = require("@twreporter/core/lib/constants/font");
|
|
29
|
-
|
|
30
18
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
31
|
-
|
|
32
19
|
var _forEach = _interopRequireDefault(require("lodash/forEach"));
|
|
33
|
-
|
|
34
20
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function _interopRequireWildcard(
|
|
41
|
-
|
|
21
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9; // components
|
|
22
|
+
// constants
|
|
23
|
+
// @twreporter
|
|
24
|
+
// lodash
|
|
25
|
+
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); }
|
|
26
|
+
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; }
|
|
42
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
43
|
-
|
|
44
28
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
45
|
-
|
|
46
|
-
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); } }
|
|
47
|
-
|
|
29
|
+
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); } }
|
|
48
30
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
49
|
-
|
|
31
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
32
|
+
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); }
|
|
50
33
|
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); }
|
|
51
|
-
|
|
52
34
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
53
|
-
|
|
54
35
|
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); }; }
|
|
55
|
-
|
|
56
36
|
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); }
|
|
57
|
-
|
|
58
37
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
59
|
-
|
|
60
38
|
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; } }
|
|
61
|
-
|
|
62
39
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
63
|
-
|
|
64
40
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
65
|
-
|
|
66
41
|
var _ = {
|
|
67
42
|
forEach: _forEach["default"],
|
|
68
43
|
get: _get["default"]
|
|
69
44
|
};
|
|
70
|
-
|
|
71
45
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
72
46
|
displayName: "list-item__Container",
|
|
73
47
|
componentId: "sc-1dx5lew-0"
|
|
74
48
|
})(["width:", "px;", " ", " ", " a{color:", ";}"], _mockupSpec["default"].hd.cardWidth, _mediaQuery["default"].desktopOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n "])), _mockupSpec["default"].desktop.cardWidth), _mediaQuery["default"].tabletOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), _mockupSpec["default"].tablet.cardWidth), _mediaQuery["default"].mobileOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n "]))), _color.colorGrayscale.gray900);
|
|
75
|
-
|
|
76
49
|
var HoverEffect = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
77
50
|
displayName: "list-item__HoverEffect",
|
|
78
51
|
componentId: "sc-1dx5lew-1"
|
|
79
52
|
})(["opacity:1;", ""], _mediaQuery["default"].tabletAndAbove(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n &:hover {\n opacity: 0.7;\n }\n transition: 200ms opacity linear;\n "]))));
|
|
80
|
-
|
|
81
53
|
var ImgFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
82
54
|
displayName: "list-item__ImgFrame",
|
|
83
55
|
componentId: "sc-1dx5lew-2"
|
|
84
56
|
})(["height:", "px;", " ", " ", ""], _mockupSpec["default"].hd.imgHeight, _mediaQuery["default"].desktopOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n height: ", "px;\n "])), _mockupSpec["default"].desktop.imgHeight), _mediaQuery["default"].tabletOnly(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n "])), _mockupSpec["default"].tablet.imgHeight), _mediaQuery["default"].mobileOnly(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: ", "px;\n "])), _mockupSpec["default"].mobile.imgHeight));
|
|
85
|
-
|
|
86
57
|
var TextBlock = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
87
58
|
displayName: "list-item__TextBlock",
|
|
88
59
|
componentId: "sc-1dx5lew-3"
|
|
89
60
|
})(["width:", "%;margin:12px auto 0 auto;cursor:pointer;", ""], _mockupSpec["default"].desktop.textWidth / _mockupSpec["default"].desktop.cardWidth * 100, _mediaQuery["default"].mobileOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 100%;\n "]))));
|
|
90
|
-
|
|
91
61
|
var Category = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
92
62
|
displayName: "list-item__Category",
|
|
93
63
|
componentId: "sc-1dx5lew-4"
|
|
94
64
|
})(["color:", ";font-size:12px;line-height:1.33;margin-bottom:10px;"], _color.colorBrand.heavy);
|
|
95
|
-
|
|
96
65
|
var Title = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
97
66
|
displayName: "list-item__Title",
|
|
98
67
|
componentId: "sc-1dx5lew-5"
|
|
99
68
|
})(["font-size:20px;font-weight:", ";font-family:", ";line-height:1.4;color:", ";margin-bottom:10px;"], _font.fontWeight.bold, _font.fontFamily.title, _color.colorGrayscale.gray800);
|
|
100
|
-
|
|
101
69
|
var Desc = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
102
70
|
displayName: "list-item__Desc",
|
|
103
71
|
componentId: "sc-1dx5lew-6"
|
|
104
72
|
})(["position:relative;font-size:16px;line-height:1.5;text-align:justify;padding-bottom:16px;color:", ";"], _color.colorGrayscale.gray800);
|
|
105
|
-
|
|
106
73
|
var Tags = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
107
74
|
displayName: "list-item__Tags",
|
|
108
75
|
componentId: "sc-1dx5lew-7"
|
|
109
76
|
})(["width:100%;margin-top:32px;margin-bottom:40px;padding-left:15px;line-height:1;", ""], _mediaQuery["default"].mobileOnly(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding-left: 0;\n "]))));
|
|
110
|
-
|
|
111
77
|
var PubDate = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
112
78
|
displayName: "list-item__PubDate",
|
|
113
79
|
componentId: "sc-1dx5lew-8"
|
|
114
80
|
})(["position:absolute;bottom:-20px;font-size:12px;right:0;"]);
|
|
115
|
-
|
|
116
81
|
var Tag = /*#__PURE__*/(0, _styledComponents["default"])(_paragraph.P3).withConfig({
|
|
117
82
|
displayName: "list-item__Tag",
|
|
118
83
|
componentId: "sc-1dx5lew-9"
|
|
@@ -121,36 +86,28 @@ var Tag = /*#__PURE__*/(0, _styledComponents["default"])(_paragraph.P3).withConf
|
|
|
121
86
|
}, _color.colorBrand.heavy, function (props) {
|
|
122
87
|
return props.$selected ? _color.colorGrayscale.white : _color.colorBrand.heavy;
|
|
123
88
|
}, _font.fontWeight.bold);
|
|
124
|
-
|
|
125
89
|
var ListItem = /*#__PURE__*/function (_PureComponent) {
|
|
126
90
|
_inherits(ListItem, _PureComponent);
|
|
127
|
-
|
|
128
91
|
var _super = _createSuper(ListItem);
|
|
129
|
-
|
|
130
92
|
function ListItem() {
|
|
131
93
|
_classCallCheck(this, ListItem);
|
|
132
|
-
|
|
133
94
|
return _super.apply(this, arguments);
|
|
134
95
|
}
|
|
135
|
-
|
|
136
96
|
_createClass(ListItem, [{
|
|
137
97
|
key: "render",
|
|
138
98
|
value: function render() {
|
|
139
99
|
var _this$props = this.props,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
100
|
+
title = _this$props.title,
|
|
101
|
+
desc = _this$props.desc,
|
|
102
|
+
img = _this$props.img,
|
|
103
|
+
link = _this$props.link,
|
|
104
|
+
category = _this$props.category,
|
|
105
|
+
tags = _this$props.tags,
|
|
106
|
+
pubDate = _this$props.pubDate;
|
|
147
107
|
var tagsJSX = [];
|
|
148
|
-
|
|
149
108
|
_.forEach(tags, function (tag) {
|
|
150
109
|
var id = _.get(tag, 'id');
|
|
151
|
-
|
|
152
110
|
var name = _.get(tag, 'name');
|
|
153
|
-
|
|
154
111
|
if (id && name) {
|
|
155
112
|
tagsJSX.push( /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
|
|
156
113
|
key: id,
|
|
@@ -160,17 +117,14 @@ var ListItem = /*#__PURE__*/function (_PureComponent) {
|
|
|
160
117
|
}, name)));
|
|
161
118
|
}
|
|
162
119
|
});
|
|
163
|
-
|
|
164
120
|
return /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, link, /*#__PURE__*/_react["default"].createElement(HoverEffect, null, /*#__PURE__*/_react["default"].createElement(ImgFrame, null, /*#__PURE__*/_react["default"].createElement(_image["default"], {
|
|
165
121
|
alt: _.get(img, 'alt', ''),
|
|
166
122
|
src: _.get(img, 'src', '')
|
|
167
123
|
})), /*#__PURE__*/_react["default"].createElement(TextBlock, null, /*#__PURE__*/_react["default"].createElement(Category, null, category), /*#__PURE__*/_react["default"].createElement(Title, null, title), /*#__PURE__*/_react["default"].createElement(Desc, null, desc, /*#__PURE__*/_react["default"].createElement(PubDate, null, pubDate))))), /*#__PURE__*/_react["default"].createElement(Tags, null, tagsJSX));
|
|
168
124
|
}
|
|
169
125
|
}]);
|
|
170
|
-
|
|
171
126
|
return ListItem;
|
|
172
127
|
}(_react.PureComponent);
|
|
173
|
-
|
|
174
128
|
ListItem.defaultProps = {
|
|
175
129
|
tags: [],
|
|
176
130
|
link: {
|
|
@@ -197,5 +151,4 @@ ListItem.propTypes = {
|
|
|
197
151
|
selected: _propTypes["default"].bool
|
|
198
152
|
}))
|
|
199
153
|
};
|
|
200
|
-
var _default = ListItem;
|
|
201
|
-
exports["default"] = _default;
|
|
154
|
+
var _default = exports["default"] = ListItem;
|