@twreporter/react-components 9.0.3-rc.0 → 9.1.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 +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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [9.1.0-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@9.1.0-rc.0...@twreporter/react-components@9.1.0-rc.1) (2024-06-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add missing `/` in url ([923d448](https://github.com/twreporter/twreporter-npm-packages/commit/923d448137278f2ac7eacde5d34a4cb3c4b80dee))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [9.1.0-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@9.0.3-rc.0...@twreporter/react-components@9.1.0-rc.0) (2024-06-18)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **react-components:** use react-redux hook ([37ad2c9](https://github.com/twreporter/twreporter-npm-packages/commit/37ad2c91dac5a40a6d617491402e21da74534855))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [9.0.3-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@9.0.2...@twreporter/react-components@9.0.3-rc.0) (2024-06-18)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -4,23 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.badge = void 0;
|
|
7
|
-
|
|
8
7
|
var _ = _interopRequireDefault(require("."));
|
|
9
|
-
|
|
10
8
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
var _default = {
|
|
10
|
+
var _default = exports["default"] = {
|
|
15
11
|
title: 'Badge',
|
|
16
12
|
component: _["default"]
|
|
17
13
|
};
|
|
18
|
-
exports
|
|
19
|
-
var badge = {
|
|
14
|
+
var badge = exports.badge = {
|
|
20
15
|
args: {
|
|
21
16
|
text: '不定期',
|
|
22
17
|
textColor: _color.colorBrand.heavy,
|
|
23
18
|
backgroundColor: 'white'
|
|
24
19
|
}
|
|
25
|
-
};
|
|
26
|
-
exports.badge = badge;
|
|
20
|
+
};
|
package/lib/badge/index.js
CHANGED
|
@@ -4,48 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.Badge = 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 _paragraph = require("../text/paragraph");
|
|
15
|
-
|
|
16
11
|
var _excluded = ["text", "textColor", "backgroundColor"];
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
13
|
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); }
|
|
21
|
-
|
|
22
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
-
|
|
24
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
-
|
|
26
16
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
27
17
|
displayName: "badge__Container",
|
|
28
18
|
componentId: "sc-1mnvxli-0"
|
|
29
19
|
})(["background:", ";padding:2px 4px;width:fit-content;border-radius:2px;"], function (props) {
|
|
30
20
|
return props.$backgroundColor;
|
|
31
21
|
});
|
|
32
|
-
|
|
33
22
|
var ColorP2 = /*#__PURE__*/(0, _styledComponents["default"])(_paragraph.P2).withConfig({
|
|
34
23
|
displayName: "badge__ColorP2",
|
|
35
24
|
componentId: "sc-1mnvxli-1"
|
|
36
25
|
})(["color:", ";"], function (props) {
|
|
37
26
|
return props.$color;
|
|
38
27
|
});
|
|
39
|
-
|
|
40
|
-
var Badge = function Badge(_ref) {
|
|
28
|
+
var Badge = exports.Badge = function Badge(_ref) {
|
|
41
29
|
var _ref$text = _ref.text,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
text = _ref$text === void 0 ? '' : _ref$text,
|
|
31
|
+
_ref$textColor = _ref.textColor,
|
|
32
|
+
textColor = _ref$textColor === void 0 ? 'black' : _ref$textColor,
|
|
33
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
34
|
+
backgroundColor = _ref$backgroundColor === void 0 ? 'white' : _ref$backgroundColor,
|
|
35
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
36
|
return /*#__PURE__*/_react["default"].createElement(Container, _extends({
|
|
50
37
|
$backgroundColor: backgroundColor
|
|
51
38
|
}, props), /*#__PURE__*/_react["default"].createElement(ColorP2, {
|
|
@@ -53,12 +40,9 @@ var Badge = function Badge(_ref) {
|
|
|
53
40
|
$color: textColor
|
|
54
41
|
}));
|
|
55
42
|
};
|
|
56
|
-
|
|
57
|
-
exports.Badge = Badge;
|
|
58
43
|
Badge.propTypes = {
|
|
59
44
|
text: _propTypes["default"].string.isRequired,
|
|
60
45
|
textColor: _propTypes["default"].string,
|
|
61
46
|
backgroundColor: _propTypes["default"].string
|
|
62
47
|
};
|
|
63
|
-
var _default = Badge;
|
|
64
|
-
exports["default"] = _default;
|
|
48
|
+
var _default = exports["default"] = Badge;
|
|
@@ -1,64 +1,39 @@
|
|
|
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 _date = require("@twreporter/core/lib/utils/date");
|
|
11
|
-
|
|
12
9
|
var _font = require("@twreporter/core/lib/constants/font");
|
|
13
|
-
|
|
14
10
|
var _customizedLink = _interopRequireDefault(require("./customized-link"));
|
|
15
|
-
|
|
16
11
|
var _imageWrapper = _interopRequireDefault(require("./image-wrapper"));
|
|
17
|
-
|
|
18
12
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
19
|
-
|
|
20
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
-
|
|
22
14
|
var _react = _interopRequireDefault(require("react"));
|
|
23
|
-
|
|
24
15
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
25
|
-
|
|
26
16
|
var _propTypes2 = _interopRequireDefault(require("@twreporter/core/lib/constants/prop-types"));
|
|
27
|
-
|
|
28
17
|
var _truncate = _interopRequireDefault(require("@twreporter/core/lib/utils/truncate"));
|
|
29
|
-
|
|
30
18
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
31
|
-
|
|
32
19
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
33
|
-
|
|
34
20
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
35
|
-
|
|
21
|
+
/* eslint-disable camelcase */
|
|
36
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
|
-
|
|
38
23
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
39
|
-
|
|
40
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
41
|
-
|
|
24
|
+
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); } }
|
|
42
25
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43
|
-
|
|
44
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); }
|
|
45
|
-
|
|
46
27
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
|
-
|
|
48
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); }; }
|
|
49
|
-
|
|
50
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); }
|
|
51
|
-
|
|
52
30
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
53
|
-
|
|
54
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; } }
|
|
55
|
-
|
|
56
32
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
-
|
|
58
|
-
function
|
|
59
|
-
|
|
33
|
+
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; }
|
|
34
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
35
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
60
36
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
61
|
-
|
|
62
37
|
var BookmarkIcon = function BookmarkIcon(props) {
|
|
63
38
|
return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("path", {
|
|
64
39
|
d: "M14.666 23.217l-7.161-4.924-7.16 4.924A.22.22 0 0 1 0 23.036V1.499A1.5 1.5 0 0 1 1.5 0h12.012a1.5 1.5 0 0 1 1.498 1.5v21.536a.22.22 0 0 1-.344.18",
|
|
@@ -66,12 +41,12 @@ var BookmarkIcon = function BookmarkIcon(props) {
|
|
|
66
41
|
fillRule: "evenodd"
|
|
67
42
|
}));
|
|
68
43
|
};
|
|
69
|
-
|
|
70
44
|
BookmarkIcon.defaultProps = {
|
|
71
45
|
width: "16",
|
|
72
46
|
height: "24",
|
|
73
47
|
xmlns: "http://www.w3.org/2000/svg"
|
|
74
|
-
};
|
|
48
|
+
}; // @twreporter
|
|
49
|
+
// lodash
|
|
75
50
|
var _ = {
|
|
76
51
|
get: _get["default"]
|
|
77
52
|
};
|
|
@@ -85,8 +60,8 @@ var styles = {
|
|
|
85
60
|
imageBoxPadding: [32, 32, 35, 20],
|
|
86
61
|
// px
|
|
87
62
|
textBoxPadding: [32, 32, 35, 0] // px
|
|
88
|
-
|
|
89
63
|
},
|
|
64
|
+
|
|
90
65
|
tablet: {
|
|
91
66
|
imageWidth: 181,
|
|
92
67
|
// px
|
|
@@ -95,32 +70,29 @@ var styles = {
|
|
|
95
70
|
imageBoxPadding: [32, 32, 35, 20],
|
|
96
71
|
// px
|
|
97
72
|
textBoxPadding: [32, 32, 35, 0] // px
|
|
98
|
-
|
|
99
73
|
},
|
|
74
|
+
|
|
100
75
|
mobile: {
|
|
101
76
|
imageHeight: 121,
|
|
102
77
|
// px
|
|
103
78
|
imageBoxPadding: [22, 22, 22, 22],
|
|
104
79
|
// px
|
|
105
80
|
textBoxPadding: [0, 21, 26, 21] // px
|
|
106
|
-
|
|
107
81
|
}
|
|
108
82
|
};
|
|
83
|
+
|
|
109
84
|
var BookmarkIconComp = /*#__PURE__*/(0, _styledComponents["default"])(BookmarkIcon).withConfig({
|
|
110
85
|
displayName: "bookmark__BookmarkIconComp",
|
|
111
86
|
componentId: "sc-1y8p1w5-0"
|
|
112
87
|
})(["&:hover{path{fill:", ";transition:fill 200ms linear;}}"], _color.colorBrand.dark);
|
|
113
|
-
|
|
114
88
|
var BookmarkFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
115
89
|
displayName: "bookmark__BookmarkFrame",
|
|
116
90
|
componentId: "sc-1y8p1w5-1"
|
|
117
91
|
})(["margin:0;margin-bottom:15px;"]);
|
|
118
|
-
|
|
119
92
|
var BookmarkContentContainer = /*#__PURE__*/_styledComponents["default"].li.withConfig({
|
|
120
93
|
displayName: "bookmark__BookmarkContentContainer",
|
|
121
94
|
componentId: "sc-1y8p1w5-2"
|
|
122
95
|
})(["position:relative;width:100%;background-color:", ";display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;", " margin:0;:last-of-type{margin-bottom:0;}"], _color.colorGrayscale.white, _mediaQuery["default"].mobileOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex-direction: column;\n align-items: center;\n "]))));
|
|
123
|
-
|
|
124
96
|
var ImageBox = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
125
97
|
displayName: "bookmark__ImageBox",
|
|
126
98
|
componentId: "sc-1y8p1w5-3"
|
|
@@ -131,12 +103,10 @@ var ImageBox = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
131
103
|
}).join(' ')), _mediaQuery["default"].mobileOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: ", ";\n width: 100%;\n "])), styles.mobile.imageBoxPadding.map(function (value) {
|
|
132
104
|
return "".concat(value, "px");
|
|
133
105
|
}).join(' ')));
|
|
134
|
-
|
|
135
106
|
var ImageFrame = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
136
107
|
displayName: "bookmark__ImageFrame",
|
|
137
108
|
componentId: "sc-1y8p1w5-4"
|
|
138
109
|
})(["width:", "px;height:", "px;", " ", " line-height:1;"], styles.desktop.imageWidth, styles.desktop.imageHeight, _mediaQuery["default"].tabletOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n "])), styles.tablet.imageWidth, styles.tablet.imageHeight), _mediaQuery["default"].mobileOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: 100%;\n height: ", "px;\n "])), styles.mobile.imageHeight));
|
|
139
|
-
|
|
140
110
|
var TextBox = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
141
111
|
displayName: "bookmark__TextBox",
|
|
142
112
|
componentId: "sc-1y8p1w5-5"
|
|
@@ -147,62 +117,48 @@ var TextBox = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
147
117
|
}).join(' '), styles.tablet.imageHeight + styles.tablet.imageBoxPadding[0] + styles.tablet.imageBoxPadding[2]), _mediaQuery["default"].mobileOnly(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: ", ";\n min-height: 0;\n width: 100%;\n "])), styles.mobile.textBoxPadding.map(function (value) {
|
|
148
118
|
return "".concat(value, "px");
|
|
149
119
|
}).join(' ')));
|
|
150
|
-
|
|
151
120
|
var Category = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
152
121
|
displayName: "bookmark__Category",
|
|
153
122
|
componentId: "sc-1y8p1w5-6"
|
|
154
123
|
})(["font-size:16px;", " line-height:1;color:", ";"], _mediaQuery["default"].mobileOnly(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: 14px;\n "]))), _color.colorBrand.heavy);
|
|
155
|
-
|
|
156
124
|
var FirstRow = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
157
125
|
displayName: "bookmark__FirstRow",
|
|
158
126
|
componentId: "sc-1y8p1w5-7"
|
|
159
127
|
})(["margin-bottom:0.8em;", " width:100%;flex-basis:auto;flex-grow:0;"], _mediaQuery["default"].mobileOnly(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin-bottom: .5em;\n "]))));
|
|
160
|
-
|
|
161
128
|
var Title = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
162
129
|
displayName: "bookmark__Title",
|
|
163
130
|
componentId: "sc-1y8p1w5-8"
|
|
164
131
|
})(["font-size:27px;line-height:1.41;margin-bottom:18px;", " font-weight:", ";color:", ";flex-basis:auto;flex-grow:0;"], _mediaQuery["default"].mobileOnly(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n font-size: 20px;\n line-height: 1.55;\n margin-bottom: 0;\n "]))), _font.fontWeight.bold, _color.colorGrayscale.gray800);
|
|
165
|
-
|
|
166
132
|
var Description = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
167
133
|
displayName: "bookmark__Description",
|
|
168
134
|
componentId: "sc-1y8p1w5-9"
|
|
169
135
|
})(["width:98%;color:", ";font-size:18px;", ";flex-basis:auto;flex-grow:0;", ""], _color.colorGrayscale.gray800, (0, _truncate["default"])('relative', 1.57, 2, _color.colorGrayscale.white, 'justify'), _mediaQuery["default"].mobileOnly(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n flex-basis: 0;\n display: none;\n "]))));
|
|
170
|
-
|
|
171
136
|
var LastRow = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
172
137
|
displayName: "bookmark__LastRow",
|
|
173
138
|
componentId: "sc-1y8p1w5-10"
|
|
174
139
|
})(["margin-top:1em;width:100%;position:relative;"]);
|
|
175
|
-
|
|
176
140
|
var ReadMore = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
177
141
|
displayName: "bookmark__ReadMore",
|
|
178
142
|
componentId: "sc-1y8p1w5-11"
|
|
179
143
|
})(["font-size:14px;text-align:left;color:", ";cursor:pointer;display:inline-block;"], _color.colorGrayscale.gray500);
|
|
180
|
-
|
|
181
144
|
var Date = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
182
145
|
displayName: "bookmark__Date",
|
|
183
146
|
componentId: "sc-1y8p1w5-12"
|
|
184
147
|
})(["vertical-align:top;font-size:16px;font-weight:", ";color:", ";float:right;"], _font.fontWeight["default"], _color.colorGrayscale.gray500);
|
|
185
|
-
|
|
186
148
|
var RemoveBookMarkBtn = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
187
149
|
displayName: "bookmark__RemoveBookMarkBtn",
|
|
188
150
|
componentId: "sc-1y8p1w5-13"
|
|
189
151
|
})(["position:absolute;right:0;top:50%;transform:translateY(-44%);line-height:1;svg{width:15px;height:auto;}cursor:pointer;"]);
|
|
190
|
-
|
|
191
|
-
var Bookmark = /*#__PURE__*/function (_React$PureComponent) {
|
|
152
|
+
var Bookmark = exports["default"] = /*#__PURE__*/function (_React$PureComponent) {
|
|
192
153
|
_inherits(Bookmark, _React$PureComponent);
|
|
193
|
-
|
|
194
154
|
var _super = _createSuper(Bookmark);
|
|
195
|
-
|
|
196
155
|
function Bookmark(props) {
|
|
197
156
|
var _this;
|
|
198
|
-
|
|
199
157
|
_classCallCheck(this, Bookmark);
|
|
200
|
-
|
|
201
158
|
_this = _super.call(this, props);
|
|
202
159
|
_this.handleDelete = _this.handleDelete.bind(_assertThisInitialized(_this));
|
|
203
160
|
return _this;
|
|
204
161
|
}
|
|
205
|
-
|
|
206
162
|
_createClass(Bookmark, [{
|
|
207
163
|
key: "handleDelete",
|
|
208
164
|
value: function handleDelete() {
|
|
@@ -212,15 +168,14 @@ var Bookmark = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
212
168
|
key: "render",
|
|
213
169
|
value: function render() {
|
|
214
170
|
var _$get = _.get(this.props, 'bookmark', {}),
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
171
|
+
thumbnail = _$get.thumbnail,
|
|
172
|
+
category = _$get.category,
|
|
173
|
+
title = _$get.title,
|
|
174
|
+
desc = _$get.desc,
|
|
175
|
+
published_date = _$get.published_date,
|
|
176
|
+
slug = _$get.slug,
|
|
177
|
+
is_external = _$get.is_external,
|
|
178
|
+
host = _$get.host;
|
|
224
179
|
return /*#__PURE__*/_react["default"].createElement(BookmarkFrame, null, /*#__PURE__*/_react["default"].createElement(BookmarkContentContainer, null, /*#__PURE__*/_react["default"].createElement(_customizedLink["default"], {
|
|
225
180
|
isExternal: is_external,
|
|
226
181
|
slug: slug,
|
|
@@ -241,12 +196,8 @@ var Bookmark = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
241
196
|
}))))));
|
|
242
197
|
}
|
|
243
198
|
}]);
|
|
244
|
-
|
|
245
199
|
return Bookmark;
|
|
246
200
|
}(_react["default"].PureComponent);
|
|
247
|
-
|
|
248
|
-
exports["default"] = Bookmark;
|
|
249
|
-
|
|
250
201
|
_defineProperty(Bookmark, "propTypes", {
|
|
251
202
|
bookmark: _propTypes2["default"].bookmark.isRequired,
|
|
252
203
|
handleDelete: _propTypes["default"].func.isRequired
|
|
@@ -4,94 +4,67 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
10
|
var _bookmark = _interopRequireDefault(require("./bookmark"));
|
|
15
|
-
|
|
16
11
|
var _emptyState = _interopRequireDefault(require("../empty-state"));
|
|
17
|
-
|
|
18
12
|
var _headline = require("../text/headline");
|
|
19
|
-
|
|
20
13
|
var _paragraph = require("../text/paragraph");
|
|
21
|
-
|
|
22
14
|
var _divider = _interopRequireDefault(require("../divider"));
|
|
23
|
-
|
|
24
15
|
var _icon = require("../icon");
|
|
25
|
-
|
|
26
16
|
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
27
|
-
|
|
28
17
|
var _propTypes2 = _interopRequireDefault(require("@twreporter/core/lib/constants/prop-types"));
|
|
29
|
-
|
|
30
18
|
var _releaseBranch = _interopRequireDefault(require("@twreporter/core/lib/constants/release-branch"));
|
|
31
|
-
|
|
32
19
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
33
|
-
|
|
34
20
|
var _requestOrigins = _interopRequireDefault(require("@twreporter/core/lib/constants/request-origins"));
|
|
35
|
-
|
|
36
21
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
37
|
-
|
|
38
22
|
var _map = _interopRequireDefault(require("lodash/map"));
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6; // components
|
|
24
|
+
// @twreporter
|
|
25
|
+
// lodash
|
|
42
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
43
|
-
|
|
44
27
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
45
|
-
|
|
46
28
|
var _ = {
|
|
47
29
|
get: _get["default"],
|
|
48
30
|
map: _map["default"]
|
|
49
31
|
};
|
|
50
|
-
|
|
51
32
|
var PageContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
52
33
|
displayName: "bookmarks__PageContainer",
|
|
53
34
|
componentId: "sc-1m95x6z-0"
|
|
54
35
|
})(["padding:64px 0 120px 0;margin:0;", " ", ""], _mediaQuery["default"].tabletOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 32px 0 120px 0;\n "]))), _mediaQuery["default"].mobileOnly(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 24px 0 120px 0;\n "]))));
|
|
55
|
-
|
|
56
36
|
var Column = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
57
37
|
displayName: "bookmarks__Column",
|
|
58
38
|
componentId: "sc-1m95x6z-1"
|
|
59
39
|
})(["margin:0 auto;width:97%;max-width:922px;", " ", ""], _mediaQuery["default"].tabletOnly(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n max-width: 698px;\n "]))), _mediaQuery["default"].mobileOnly(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n "]))));
|
|
60
|
-
|
|
61
40
|
var StatusBar = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
62
41
|
displayName: "bookmarks__StatusBar",
|
|
63
42
|
componentId: "sc-1m95x6z-2"
|
|
64
43
|
})(["", " ", " padding-bottom:64px;width:stretch;"], _mediaQuery["default"].mobileOnly(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-left: 24px;\n padding-right: 24px;\n padding-bottom: 24px;\n "]))), _mediaQuery["default"].tabletOnly(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding-bottom: 32px;\n "]))));
|
|
65
|
-
|
|
66
44
|
var TitleContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
67
45
|
displayName: "bookmarks__TitleContainer",
|
|
68
46
|
componentId: "sc-1m95x6z-3"
|
|
69
47
|
})(["margin-bottom:16px;color:", ";"], _color.colorGrayscale.gray800);
|
|
70
|
-
|
|
71
48
|
var CountContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
72
49
|
displayName: "bookmarks__CountContainer",
|
|
73
50
|
componentId: "sc-1m95x6z-4"
|
|
74
51
|
})(["display:flex;margin-bottom:16px;"]);
|
|
75
|
-
|
|
76
52
|
var CountTitle = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
77
53
|
displayName: "bookmarks__CountTitle",
|
|
78
54
|
componentId: "sc-1m95x6z-5"
|
|
79
55
|
})(["margin-right:8px;"]);
|
|
80
|
-
|
|
81
56
|
var BookmarksContainer = /*#__PURE__*/_styledComponents["default"].ul.withConfig({
|
|
82
57
|
displayName: "bookmarks__BookmarksContainer",
|
|
83
58
|
componentId: "sc-1m95x6z-6"
|
|
84
59
|
})(["margin:0;width:100%;padding:0;"]);
|
|
85
|
-
|
|
86
60
|
function Bookmarks(_ref) {
|
|
87
61
|
var _ref$total = _ref.total,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
62
|
+
total = _ref$total === void 0 ? 0 : _ref$total,
|
|
63
|
+
_ref$bookmarks = _ref.bookmarks,
|
|
64
|
+
bookmarks = _ref$bookmarks === void 0 ? [] : _ref$bookmarks,
|
|
65
|
+
handleDelete = _ref.handleDelete,
|
|
66
|
+
_ref$releaseBranch = _ref.releaseBranch,
|
|
67
|
+
releaseBranch = _ref$releaseBranch === void 0 ? _releaseBranch["default"].master : _ref$releaseBranch;
|
|
95
68
|
var buildBookmark = function buildBookmark(bookmark) {
|
|
96
69
|
return /*#__PURE__*/_react["default"].createElement(_bookmark["default"], {
|
|
97
70
|
key: "bookmark_".concat(_.get(bookmark, 'id')),
|
|
@@ -99,7 +72,6 @@ function Bookmarks(_ref) {
|
|
|
99
72
|
handleDelete: handleDelete
|
|
100
73
|
});
|
|
101
74
|
};
|
|
102
|
-
|
|
103
75
|
var counterJSX = total === 0 ? '' : /*#__PURE__*/_react["default"].createElement(CountContainer, null, /*#__PURE__*/_react["default"].createElement(CountTitle, null, /*#__PURE__*/_react["default"].createElement(_paragraph.P1, {
|
|
104
76
|
text: "\u5168\u90E8",
|
|
105
77
|
weight: "bold"
|
|
@@ -126,12 +98,10 @@ function Bookmarks(_ref) {
|
|
|
126
98
|
text: "\u6211\u7684\u66F8\u7C64"
|
|
127
99
|
})), counterJSX, /*#__PURE__*/_react["default"].createElement(_divider["default"], null)), contentJSX));
|
|
128
100
|
}
|
|
129
|
-
|
|
130
101
|
Bookmarks.propTypes = {
|
|
131
102
|
bookmarks: _propTypes["default"].arrayOf(_propTypes2["default"].bookmark).isRequired,
|
|
132
103
|
handleDelete: _propTypes["default"].func.isRequired,
|
|
133
104
|
total: _propTypes["default"].number,
|
|
134
105
|
releaseBranch: _propTypes2["default"].releaseBranch
|
|
135
106
|
};
|
|
136
|
-
var _default = Bookmarks;
|
|
137
|
-
exports["default"] = _default;
|
|
107
|
+
var _default = exports["default"] = Bookmarks;
|
|
@@ -4,34 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _entityPath = _interopRequireDefault(require("@twreporter/core/lib/constants/entity-path"));
|
|
9
|
-
|
|
10
8
|
var _reactRouterDom = require("react-router-dom");
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
12
|
var CustomizedLink = function CustomizedLink(_ref) {
|
|
19
13
|
var children = _ref.children,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
isExternal = _ref.isExternal,
|
|
15
|
+
slug = _ref.slug,
|
|
16
|
+
host = _ref.host;
|
|
24
17
|
if (isExternal) {
|
|
25
18
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
26
19
|
href: "".concat(host).concat(_entityPath["default"].interactiveArticle).concat(slug)
|
|
27
20
|
}, children);
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
return /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
|
|
31
23
|
to: "".concat(_entityPath["default"].article).concat(slug)
|
|
32
24
|
}, children);
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
CustomizedLink.defaultProps = {
|
|
36
27
|
children: null
|
|
37
28
|
};
|
|
@@ -41,5 +32,4 @@ CustomizedLink.propTypes = {
|
|
|
41
32
|
slug: _propTypes["default"].string.isRequired,
|
|
42
33
|
host: _propTypes["default"].string.isRequired
|
|
43
34
|
};
|
|
44
|
-
var _default = CustomizedLink;
|
|
45
|
-
exports["default"] = _default;
|
|
35
|
+
var _default = exports["default"] = CustomizedLink;
|