@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,41 +4,28 @@ 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 _imageWithFallback = _interopRequireDefault(require("../../image-with-fallback"));
|
|
15
|
-
|
|
16
11
|
var _paragraph = require("../../text/paragraph");
|
|
17
|
-
|
|
18
12
|
var _headline = require("../../text/headline");
|
|
19
|
-
|
|
20
13
|
var _icon = require("../../icon");
|
|
21
|
-
|
|
22
14
|
var _button = require("../../button");
|
|
23
|
-
|
|
24
15
|
var _customizedLink = _interopRequireDefault(require("../../customized-link"));
|
|
25
|
-
|
|
26
16
|
var _sharedEnum = require("../../shared-enum");
|
|
27
|
-
|
|
28
17
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
29
|
-
|
|
30
18
|
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
31
|
-
|
|
32
19
|
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
33
|
-
|
|
34
20
|
var _entityPath = _interopRequireDefault(require("@twreporter/core/lib/constants/entity-path"));
|
|
35
|
-
|
|
36
21
|
var _width, _height, _marginLeft, _marginTop, _marginBottom;
|
|
37
|
-
|
|
38
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
39
|
-
|
|
40
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
-
|
|
23
|
+
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
|
+
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; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
|
+
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); } // component
|
|
27
|
+
// enum
|
|
28
|
+
// @twreporter
|
|
42
29
|
var imageStyle = {
|
|
43
30
|
width: (_width = {}, _defineProperty(_width, _sharedEnum.Size.S, '72px'), _defineProperty(_width, _sharedEnum.Size.L, '216px'), _width),
|
|
44
31
|
height: (_height = {}, _defineProperty(_height, _sharedEnum.Size.S, '72px'), _defineProperty(_height, _sharedEnum.Size.L, '144px'), _height),
|
|
@@ -54,17 +41,14 @@ var Container = /*#__PURE__*/(0, _styledComponents["default"])(_customizedLink["
|
|
|
54
41
|
displayName: "article-card__Container",
|
|
55
42
|
componentId: "sc-9196c7-0"
|
|
56
43
|
})(["text-decoration:none;&:hover{.hover{opacity:0.8;}}"]);
|
|
57
|
-
|
|
58
44
|
var FlexGroup = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
59
45
|
displayName: "article-card__FlexGroup",
|
|
60
46
|
componentId: "sc-9196c7-1"
|
|
61
47
|
})(["display:flex;"]);
|
|
62
|
-
|
|
63
48
|
var FlexGroupColumn = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
64
49
|
displayName: "article-card__FlexGroupColumn",
|
|
65
50
|
componentId: "sc-9196c7-2"
|
|
66
51
|
})(["display:flex;flex-direction:column;"]);
|
|
67
|
-
|
|
68
52
|
var FlexSpaceBetween = /*#__PURE__*/(0, _styledComponents["default"])(FlexGroup).withConfig({
|
|
69
53
|
displayName: "article-card__FlexSpaceBetween",
|
|
70
54
|
componentId: "sc-9196c7-3"
|
|
@@ -77,12 +61,10 @@ var Meta = /*#__PURE__*/(0, _styledComponents["default"])(FlexGroup).withConfig(
|
|
|
77
61
|
}, function (props) {
|
|
78
62
|
return props.$hide ? "display: none;" : '';
|
|
79
63
|
});
|
|
80
|
-
|
|
81
64
|
var DescContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
82
65
|
displayName: "article-card__DescContainer",
|
|
83
66
|
componentId: "sc-9196c7-5"
|
|
84
67
|
})(["color:", ";margin-top:8px;p{display:-webkit-box;text-overflow:ellipsis;overflow:hidden;line-clamp:3;-webkit-line-clamp:3;-webkit-box-orient:vertical;}"], _color.colorGrayscale.gray800);
|
|
85
|
-
|
|
86
68
|
var BookmarkContainer = /*#__PURE__*/(0, _styledComponents["default"])(FlexGroup).withConfig({
|
|
87
69
|
displayName: "article-card__BookmarkContainer",
|
|
88
70
|
componentId: "sc-9196c7-6"
|
|
@@ -107,31 +89,30 @@ var TitleText = /*#__PURE__*/(0, _styledComponents["default"])(_headline.H4).wit
|
|
|
107
89
|
displayName: "article-card__TitleText",
|
|
108
90
|
componentId: "sc-9196c7-9"
|
|
109
91
|
})(["color:", ";"], _color.colorGrayscale.gray800);
|
|
110
|
-
|
|
111
92
|
var ArticleCard = function ArticleCard(_ref) {
|
|
112
93
|
var _ref$title = _ref.title,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
94
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
|
95
|
+
_ref$description = _ref.description,
|
|
96
|
+
description = _ref$description === void 0 ? '' : _ref$description,
|
|
97
|
+
_ref$date = _ref.date,
|
|
98
|
+
date = _ref$date === void 0 ? '' : _ref$date,
|
|
99
|
+
_ref$image = _ref.image,
|
|
100
|
+
image = _ref$image === void 0 ? {} : _ref$image,
|
|
101
|
+
_ref$category = _ref.category,
|
|
102
|
+
category = _ref$category === void 0 ? '' : _ref$category,
|
|
103
|
+
_ref$size = _ref.size,
|
|
104
|
+
size = _ref$size === void 0 ? _sharedEnum.Size.S : _ref$size,
|
|
105
|
+
_ref$isBookmarked = _ref.isBookmarked,
|
|
106
|
+
isBookmarked = _ref$isBookmarked === void 0 ? false : _ref$isBookmarked,
|
|
107
|
+
toggleBookmark = _ref.toggleBookmark,
|
|
108
|
+
_ref$releaseBranch = _ref.releaseBranch,
|
|
109
|
+
releaseBranch = _ref$releaseBranch === void 0 ? _releaseBranch.BRANCH.master : _ref$releaseBranch,
|
|
110
|
+
_ref$showIsBookmarked = _ref.showIsBookmarked,
|
|
111
|
+
showIsBookmarked = _ref$showIsBookmarked === void 0 ? false : _ref$showIsBookmarked,
|
|
112
|
+
_ref$style = _ref.style,
|
|
113
|
+
style = _ref$style === void 0 ? _theme.ARTICLE_THEME.v2["default"] : _ref$style,
|
|
114
|
+
_ref$slug = _ref.slug,
|
|
115
|
+
slug = _ref$slug === void 0 ? '' : _ref$slug;
|
|
135
116
|
var hideMeta = !category && !date;
|
|
136
117
|
var titleJSX = title ? /*#__PURE__*/_react["default"].createElement(TitleText, {
|
|
137
118
|
text: title,
|
|
@@ -158,35 +139,29 @@ var ArticleCard = function ArticleCard(_ref) {
|
|
|
158
139
|
to: "".concat(isInteractiveArticle ? _entityPath["default"].interactiveArticle : _entityPath["default"].article).concat(slug),
|
|
159
140
|
target: isInteractiveArticle ? '_blank' : ''
|
|
160
141
|
};
|
|
161
|
-
|
|
162
142
|
var onBookmarkClick = function onBookmarkClick(event) {
|
|
163
143
|
event.preventDefault();
|
|
164
144
|
toggleBookmark();
|
|
165
145
|
};
|
|
166
|
-
|
|
167
146
|
var bookmarkIcon = /*#__PURE__*/_react["default"].createElement(_icon.Bookmark, {
|
|
168
147
|
type: isBookmarked ? _icon.Bookmark.Type.SAVED : _icon.Bookmark.Type.ADD,
|
|
169
148
|
releaseBranch: releaseBranch
|
|
170
149
|
});
|
|
171
|
-
|
|
172
150
|
var bookmarkButton = /*#__PURE__*/_react["default"].createElement(_button.TextButton, {
|
|
173
151
|
theme: _button.TextButton.THEME.normal,
|
|
174
152
|
style: _button.TextButton.Style.LIGHT,
|
|
175
153
|
leftIconComponent: bookmarkIcon,
|
|
176
154
|
text: isBookmarked ? '已收藏' : '收藏'
|
|
177
155
|
});
|
|
178
|
-
|
|
179
156
|
var bookmarkJSX = showIsBookmarked ? /*#__PURE__*/_react["default"].createElement(BookmarkContainer, {
|
|
180
157
|
onClick: onBookmarkClick,
|
|
181
158
|
$size: size
|
|
182
159
|
}, bookmarkButton) : null;
|
|
183
|
-
|
|
184
160
|
var metaJSX = /*#__PURE__*/_react["default"].createElement(Meta, {
|
|
185
161
|
$hide: hideMeta,
|
|
186
162
|
$size: size,
|
|
187
163
|
className: "hover"
|
|
188
164
|
}, categoryJSX, dateJSX);
|
|
189
|
-
|
|
190
165
|
var imageJSX = /*#__PURE__*/_react["default"].createElement(ImageContainer, {
|
|
191
166
|
$size: size,
|
|
192
167
|
className: "hover"
|
|
@@ -195,15 +170,13 @@ var ArticleCard = function ArticleCard(_ref) {
|
|
|
195
170
|
alt: image.alt,
|
|
196
171
|
releaseBranch: releaseBranch
|
|
197
172
|
}));
|
|
198
|
-
|
|
199
173
|
if (size === _sharedEnum.Size.S) {
|
|
200
174
|
return /*#__PURE__*/_react["default"].createElement(Container, link, /*#__PURE__*/_react["default"].createElement(FlexGroupColumn, null, /*#__PURE__*/_react["default"].createElement(FlexSpaceBetween, null, /*#__PURE__*/_react["default"].createElement(FlexGroupColumn, null, metaJSX, titleJSX), /*#__PURE__*/_react["default"].createElement(FlexGroup, null, imageJSX)), /*#__PURE__*/_react["default"].createElement(FlexGroupColumn, null, /*#__PURE__*/_react["default"].createElement(DescContainer, null, descriptionJSX), bookmarkJSX)));
|
|
201
|
-
}
|
|
202
|
-
|
|
175
|
+
}
|
|
203
176
|
|
|
177
|
+
// L size
|
|
204
178
|
return /*#__PURE__*/_react["default"].createElement(Container, link, /*#__PURE__*/_react["default"].createElement(FlexSpaceBetween, null, /*#__PURE__*/_react["default"].createElement(LeftColumn, null, metaJSX, /*#__PURE__*/_react["default"].createElement(FlexGroupColumn, null, titleJSX, /*#__PURE__*/_react["default"].createElement(DescContainer, null, descriptionJSX), bookmarkJSX)), imageJSX));
|
|
205
179
|
};
|
|
206
|
-
|
|
207
180
|
ArticleCard.propTypes = {
|
|
208
181
|
title: _propTypes["default"].string.isRequired,
|
|
209
182
|
description: _propTypes["default"].string.isRequired,
|
|
@@ -223,5 +196,4 @@ ArticleCard.propTypes = {
|
|
|
223
196
|
slug: _propTypes["default"].string
|
|
224
197
|
};
|
|
225
198
|
ArticleCard.Size = _sharedEnum.Size;
|
|
226
|
-
var _default = ArticleCard;
|
|
227
|
-
exports["default"] = _default;
|
|
199
|
+
var _default = exports["default"] = ArticleCard;
|
|
@@ -4,47 +4,34 @@ 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 _paragraph = require("../../text/paragraph");
|
|
15
|
-
|
|
16
11
|
var _sharedEnum = require("../../shared-enum");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
var _excluded = ["text", "size"]; // component
|
|
13
|
+
// enum
|
|
20
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
15
|
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
16
|
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
17
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
27
18
|
displayName: "dialog__Container",
|
|
28
19
|
componentId: "mpc5lq-0"
|
|
29
20
|
})(["display:flex;flex-direction:column;align-items:flex-end;"]);
|
|
30
|
-
|
|
31
21
|
var Text = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
32
22
|
displayName: "dialog__Text",
|
|
33
23
|
componentId: "mpc5lq-1"
|
|
34
24
|
})(["padding:16px 24px;background-color:white;box-shadow:0px 0px 24px rgba(0,0,0,0.1);"]);
|
|
35
|
-
|
|
36
25
|
var Triangle = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
37
26
|
displayName: "dialog__Triangle",
|
|
38
27
|
componentId: "mpc5lq-2"
|
|
39
28
|
})(["width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-bottom:12px solid white;transform:translateX(-16px);"]);
|
|
40
|
-
|
|
41
29
|
var Dialog = function Dialog(_ref) {
|
|
42
30
|
var _ref$text = _ref.text,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
text = _ref$text === void 0 ? '' : _ref$text,
|
|
32
|
+
_ref$size = _ref.size,
|
|
33
|
+
size = _ref$size === void 0 ? _sharedEnum.Size.S : _ref$size,
|
|
34
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
35
|
var textIcon = size === _sharedEnum.Size.S ? /*#__PURE__*/_react["default"].createElement(_paragraph.P2, {
|
|
49
36
|
text: text,
|
|
50
37
|
weight: "bold"
|
|
@@ -54,11 +41,9 @@ var Dialog = function Dialog(_ref) {
|
|
|
54
41
|
});
|
|
55
42
|
return /*#__PURE__*/_react["default"].createElement(Container, props, /*#__PURE__*/_react["default"].createElement(Triangle, null), /*#__PURE__*/_react["default"].createElement(Text, null, textIcon));
|
|
56
43
|
};
|
|
57
|
-
|
|
58
44
|
Dialog.propTypes = {
|
|
59
45
|
text: _propTypes["default"].string,
|
|
60
46
|
size: _propTypes["default"].oneOf(Object.values(_sharedEnum.Size))
|
|
61
47
|
};
|
|
62
48
|
Dialog.Size = _sharedEnum.Size;
|
|
63
|
-
var _default = Dialog;
|
|
64
|
-
exports["default"] = _default;
|
|
49
|
+
var _default = exports["default"] = Dialog;
|
|
@@ -4,37 +4,26 @@ 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 _imageWithFallback = _interopRequireDefault(require("../../image-with-fallback"));
|
|
15
|
-
|
|
16
11
|
var _paragraph = require("../../text/paragraph");
|
|
17
|
-
|
|
18
12
|
var _headline = require("../../text/headline");
|
|
19
|
-
|
|
20
13
|
var _customizedLink = _interopRequireDefault(require("../../customized-link"));
|
|
21
|
-
|
|
22
14
|
var _sharedEnum = require("../../shared-enum");
|
|
23
|
-
|
|
24
15
|
var _color = require("@twreporter/core/lib/constants/color");
|
|
25
|
-
|
|
26
16
|
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
27
|
-
|
|
28
17
|
var _entityPath = _interopRequireDefault(require("@twreporter/core/lib/constants/entity-path"));
|
|
29
|
-
|
|
30
18
|
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
31
|
-
|
|
32
19
|
var _width, _height, _marginLeft, _marginBottom;
|
|
33
|
-
|
|
34
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
-
|
|
36
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
-
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
+
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); } // component
|
|
25
|
+
// enum
|
|
26
|
+
// @twreporter
|
|
38
27
|
var imageStyle = {
|
|
39
28
|
width: (_width = {}, _defineProperty(_width, _sharedEnum.Size.S, '48px'), _defineProperty(_width, _sharedEnum.Size.L, '80px'), _width),
|
|
40
29
|
height: (_height = {}, _defineProperty(_height, _sharedEnum.Size.S, '48px'), _defineProperty(_height, _sharedEnum.Size.L, '80px'), _height),
|
|
@@ -47,17 +36,14 @@ var Container = /*#__PURE__*/(0, _styledComponents["default"])(_customizedLink["
|
|
|
47
36
|
displayName: "short-story__Container",
|
|
48
37
|
componentId: "sc-119yx1u-0"
|
|
49
38
|
})(["text-decoration:none;&:hover{opacity:0.8;}"]);
|
|
50
|
-
|
|
51
39
|
var FlexGroup = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
52
40
|
displayName: "short-story__FlexGroup",
|
|
53
41
|
componentId: "sc-119yx1u-1"
|
|
54
42
|
})(["display:flex;"]);
|
|
55
|
-
|
|
56
43
|
var FlexGroupColumn = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
57
44
|
displayName: "short-story__FlexGroupColumn",
|
|
58
45
|
componentId: "sc-119yx1u-2"
|
|
59
46
|
})(["display:flex;flex-direction:column;"]);
|
|
60
|
-
|
|
61
47
|
var FlexSpaceBetween = /*#__PURE__*/(0, _styledComponents["default"])(FlexGroup).withConfig({
|
|
62
48
|
displayName: "short-story__FlexSpaceBetween",
|
|
63
49
|
componentId: "sc-119yx1u-3"
|
|
@@ -88,24 +74,23 @@ var TitleText = /*#__PURE__*/(0, _styledComponents["default"])(_headline.H6).wit
|
|
|
88
74
|
displayName: "short-story__TitleText",
|
|
89
75
|
componentId: "sc-119yx1u-7"
|
|
90
76
|
})(["color:", ";"], _color.colorGrayscale.gray800);
|
|
91
|
-
|
|
92
77
|
var ShortStory = function ShortStory(_ref) {
|
|
93
78
|
var _ref$title = _ref.title,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
79
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
|
80
|
+
_ref$date = _ref.date,
|
|
81
|
+
date = _ref$date === void 0 ? '' : _ref$date,
|
|
82
|
+
_ref$image = _ref.image,
|
|
83
|
+
image = _ref$image === void 0 ? {} : _ref$image,
|
|
84
|
+
_ref$category = _ref.category,
|
|
85
|
+
category = _ref$category === void 0 ? '' : _ref$category,
|
|
86
|
+
_ref$size = _ref.size,
|
|
87
|
+
size = _ref$size === void 0 ? _sharedEnum.Size.S : _ref$size,
|
|
88
|
+
_ref$releaseBranch = _ref.releaseBranch,
|
|
89
|
+
releaseBranch = _ref$releaseBranch === void 0 ? _releaseBranch.BRANCH.master : _ref$releaseBranch,
|
|
90
|
+
_ref$style = _ref.style,
|
|
91
|
+
style = _ref$style === void 0 ? _theme.ARTICLE_THEME.v2["default"] : _ref$style,
|
|
92
|
+
_ref$slug = _ref.slug,
|
|
93
|
+
slug = _ref$slug === void 0 ? '' : _ref$slug;
|
|
109
94
|
var hideMeta = !category && !date;
|
|
110
95
|
var titleJSX = title ? /*#__PURE__*/_react["default"].createElement(TitleText, {
|
|
111
96
|
text: title,
|
|
@@ -122,12 +107,10 @@ var ShortStory = function ShortStory(_ref) {
|
|
|
122
107
|
to: "".concat(isInteractiveArticle ? _entityPath["default"].interactiveArticle : _entityPath["default"].article).concat(slug),
|
|
123
108
|
target: isInteractiveArticle ? '_blank' : ''
|
|
124
109
|
};
|
|
125
|
-
|
|
126
110
|
var metaJSX = /*#__PURE__*/_react["default"].createElement(Meta, {
|
|
127
111
|
$hide: hideMeta,
|
|
128
112
|
$size: size
|
|
129
113
|
}, categoryJSX, dateJSX);
|
|
130
|
-
|
|
131
114
|
var imageJSX = /*#__PURE__*/_react["default"].createElement(ImageContainer, {
|
|
132
115
|
$size: size
|
|
133
116
|
}, /*#__PURE__*/_react["default"].createElement(_imageWithFallback["default"], {
|
|
@@ -135,15 +118,13 @@ var ShortStory = function ShortStory(_ref) {
|
|
|
135
118
|
alt: image.alt,
|
|
136
119
|
releaseBranch: releaseBranch
|
|
137
120
|
}));
|
|
138
|
-
|
|
139
121
|
if (size === _sharedEnum.Size.S) {
|
|
140
122
|
return /*#__PURE__*/_react["default"].createElement(Container, link, /*#__PURE__*/_react["default"].createElement(FlexGroupColumn, null, /*#__PURE__*/_react["default"].createElement(FlexSpaceBetween, null, /*#__PURE__*/_react["default"].createElement(FlexGroupColumn, null, metaJSX, titleJSX), /*#__PURE__*/_react["default"].createElement(FlexGroup, null, imageJSX))));
|
|
141
|
-
}
|
|
142
|
-
|
|
123
|
+
}
|
|
143
124
|
|
|
125
|
+
// L size
|
|
144
126
|
return /*#__PURE__*/_react["default"].createElement(Container, link, /*#__PURE__*/_react["default"].createElement(FlexSpaceBetween, null, /*#__PURE__*/_react["default"].createElement(LeftColumn, null, metaJSX, /*#__PURE__*/_react["default"].createElement(FlexGroupColumn, null, titleJSX)), imageJSX));
|
|
145
127
|
};
|
|
146
|
-
|
|
147
128
|
ShortStory.propTypes = {
|
|
148
129
|
title: _propTypes["default"].string.isRequired,
|
|
149
130
|
date: _propTypes["default"].string,
|
|
@@ -159,5 +140,4 @@ ShortStory.propTypes = {
|
|
|
159
140
|
slug: _propTypes["default"].string
|
|
160
141
|
};
|
|
161
142
|
ShortStory.Size = _sharedEnum.Size;
|
|
162
|
-
var _default = ShortStory;
|
|
163
|
-
exports["default"] = _default;
|
|
143
|
+
var _default = exports["default"] = ShortStory;
|
package/lib/card/index.js
CHANGED
|
@@ -22,18 +22,12 @@ Object.defineProperty(exports, "ShortStory", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
exports["default"] = void 0;
|
|
25
|
-
|
|
26
25
|
var _dialog = _interopRequireDefault(require("./components/dialog"));
|
|
27
|
-
|
|
28
26
|
var _articleCard = _interopRequireDefault(require("./components/article-card"));
|
|
29
|
-
|
|
30
27
|
var _shortStory = _interopRequireDefault(require("./components/short-story"));
|
|
31
|
-
|
|
32
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
33
|
-
|
|
34
|
-
var _default = {
|
|
29
|
+
var _default = exports["default"] = {
|
|
35
30
|
Dialog: _dialog["default"],
|
|
36
31
|
ArticleCard: _articleCard["default"],
|
|
37
32
|
ShortStory: _shortStory["default"]
|
|
38
|
-
};
|
|
39
|
-
exports["default"] = _default;
|
|
33
|
+
};
|
|
@@ -4,21 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.article = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
|
|
12
9
|
var _articleCard = _interopRequireDefault(require("../components/article-card"));
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../storybook/constants");
|
|
15
|
-
|
|
16
11
|
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
13
|
/* eslint react/display-name:0 */
|
|
21
|
-
var _default = {
|
|
14
|
+
var _default = exports["default"] = {
|
|
22
15
|
title: 'Card/Article',
|
|
23
16
|
component: _articleCard["default"],
|
|
24
17
|
argTypes: {
|
|
@@ -26,16 +19,13 @@ var _default = {
|
|
|
26
19
|
size: _constants.SIZE_STORYBOOK_ARG_TYPE
|
|
27
20
|
}
|
|
28
21
|
};
|
|
29
|
-
exports["default"] = _default;
|
|
30
|
-
|
|
31
22
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
32
23
|
displayName: "articleCardstories__Container",
|
|
33
24
|
componentId: "q36nxb-0"
|
|
34
25
|
})(["width:", "px;"], function (props) {
|
|
35
26
|
return props.$size === _articleCard["default"].Size.S ? '343' : '878';
|
|
36
27
|
});
|
|
37
|
-
|
|
38
|
-
var article = {
|
|
28
|
+
var article = exports.article = {
|
|
39
29
|
render: function render(args) {
|
|
40
30
|
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
41
31
|
$size: args.size
|
|
@@ -55,5 +45,4 @@ var article = {
|
|
|
55
45
|
isBookmarked: true,
|
|
56
46
|
showIsBookmarked: false
|
|
57
47
|
}
|
|
58
|
-
};
|
|
59
|
-
exports.article = article;
|
|
48
|
+
};
|
|
@@ -4,31 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dialog = exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
|
|
12
9
|
var _dialog = _interopRequireDefault(require("../components/dialog"));
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../storybook/constants");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
12
|
/* eslint react/display-name:0 */
|
|
19
|
-
var _default = {
|
|
13
|
+
var _default = exports["default"] = {
|
|
20
14
|
title: 'Card/Dialog',
|
|
21
15
|
component: _dialog["default"],
|
|
22
16
|
argTypes: {
|
|
23
17
|
size: _constants.SIZE_STORYBOOK_ARG_TYPE
|
|
24
18
|
}
|
|
25
19
|
};
|
|
26
|
-
exports["default"] = _default;
|
|
27
20
|
var StyledDialog = /*#__PURE__*/(0, _styledComponents["default"])(_dialog["default"]).withConfig({
|
|
28
21
|
displayName: "dialogstories__StyledDialog",
|
|
29
22
|
componentId: "sc-1h10bts-0"
|
|
30
23
|
})(["width:fit-content;"]);
|
|
31
|
-
var dialog = {
|
|
24
|
+
var dialog = exports.dialog = {
|
|
32
25
|
render: function render(args) {
|
|
33
26
|
return /*#__PURE__*/_react["default"].createElement(StyledDialog, args);
|
|
34
27
|
},
|
|
@@ -41,5 +34,4 @@ var dialog = {
|
|
|
41
34
|
"default": 'normal'
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
|
-
};
|
|
45
|
-
exports.dialog = dialog;
|
|
37
|
+
};
|
|
@@ -4,28 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.shortStory = exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
|
|
12
9
|
var _shortStory = _interopRequireDefault(require("../components/short-story"));
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../storybook/constants");
|
|
15
|
-
|
|
16
11
|
var _getEnumArg = require("../../storybook/utils/get-enum-arg");
|
|
17
|
-
|
|
18
12
|
var _releaseBranch = require("@twreporter/core/lib/constants/release-branch");
|
|
19
|
-
|
|
20
13
|
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
15
|
/* eslint react/display-name:0 */
|
|
25
16
|
// components
|
|
26
17
|
// storybooks
|
|
27
18
|
// @twreporters
|
|
28
|
-
var _default = {
|
|
19
|
+
var _default = exports["default"] = {
|
|
29
20
|
title: 'Card/Short Story',
|
|
30
21
|
component: _shortStory["default"],
|
|
31
22
|
argTypes: {
|
|
@@ -34,16 +25,13 @@ var _default = {
|
|
|
34
25
|
style: (0, _getEnumArg.getRadioArg)(_theme.ARTICLE_THEME.v2, _theme.ARTICLE_THEME.v2["default"])
|
|
35
26
|
}
|
|
36
27
|
};
|
|
37
|
-
exports["default"] = _default;
|
|
38
|
-
|
|
39
28
|
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
40
29
|
displayName: "shortStorystories__Container",
|
|
41
30
|
componentId: "luhojz-0"
|
|
42
31
|
})(["width:", "px;"], function (props) {
|
|
43
32
|
return props.$size === _shortStory["default"].Size.S ? '343' : '516';
|
|
44
33
|
});
|
|
45
|
-
|
|
46
|
-
var shortStory = {
|
|
34
|
+
var shortStory = exports.shortStory = {
|
|
47
35
|
render: function render(args) {
|
|
48
36
|
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
49
37
|
$size: args.size
|
|
@@ -62,5 +50,4 @@ var shortStory = {
|
|
|
62
50
|
style: _theme.ARTICLE_THEME.v2["default"],
|
|
63
51
|
slug: 'a-test-slug'
|
|
64
52
|
}
|
|
65
|
-
};
|
|
66
|
-
exports.shortStory = shortStory;
|
|
53
|
+
};
|
|
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.checkbox = void 0;
|
|
7
|
-
|
|
8
7
|
var _ = _interopRequireDefault(require("."));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = {
|
|
9
|
+
var _default = exports["default"] = {
|
|
13
10
|
title: 'Checkbox',
|
|
14
11
|
component: _["default"],
|
|
15
12
|
argTypes: {
|
|
@@ -19,8 +16,7 @@ var _default = {
|
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
exports
|
|
23
|
-
var checkbox = {
|
|
19
|
+
var checkbox = exports.checkbox = {
|
|
24
20
|
args: {
|
|
25
21
|
label: '藝術',
|
|
26
22
|
value: false,
|
|
@@ -29,5 +25,4 @@ var checkbox = {
|
|
|
29
25
|
console.log('callback', e.target.checked);
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
|
-
};
|
|
33
|
-
exports.checkbox = checkbox;
|
|
28
|
+
};
|