@twreporter/universal-header 2.2.0-rc.5
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 +302 -0
- package/LICENSE +21 -0
- package/README.md +223 -0
- package/lib/actions/auth.js +105 -0
- package/lib/actions/error-action-creators.js +162 -0
- package/lib/components/action-button.js +216 -0
- package/lib/components/channels.js +420 -0
- package/lib/components/customized-link.js +49 -0
- package/lib/components/drop-down-menu.js +138 -0
- package/lib/components/hamburger-icons.js +270 -0
- package/lib/components/hamburger-menu.js +152 -0
- package/lib/components/header.js +233 -0
- package/lib/components/icons.js +276 -0
- package/lib/components/mobile-header.js +264 -0
- package/lib/components/search-box.js +214 -0
- package/lib/components/slogan.js +57 -0
- package/lib/constants/action-types.js +14 -0
- package/lib/constants/actions.js +35 -0
- package/lib/constants/categories.js +32 -0
- package/lib/constants/channels.js +41 -0
- package/lib/constants/colors.js +17 -0
- package/lib/constants/external-links.js +13 -0
- package/lib/constants/fonts.js +32 -0
- package/lib/constants/prop-types.js +46 -0
- package/lib/constants/services.js +31 -0
- package/lib/constants/slogan.js +9 -0
- package/lib/constants/theme.js +13 -0
- package/lib/containers/header.js +375 -0
- package/lib/contexts/header-context.js +17 -0
- package/lib/index.js +18 -0
- package/lib/reducers/auth.js +109 -0
- package/lib/reducers/index.js +22 -0
- package/lib/standalone-header.js +110 -0
- package/lib/utils/animations.js +32 -0
- package/lib/utils/icon.js +905 -0
- package/lib/utils/jwt.js +37 -0
- package/lib/utils/links.js +177 -0
- package/lib/utils/theme.js +415 -0
- package/package.json +38 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _CSSTransition = _interopRequireDefault(require("react-transition-group/CSSTransition"));
|
|
11
|
+
|
|
12
|
+
var _headerContext = _interopRequireDefault(require("../contexts/header-context"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
var _fonts = _interopRequireDefault(require("../constants/fonts"));
|
|
19
|
+
|
|
20
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
21
|
+
|
|
22
|
+
var _links = _interopRequireDefault(require("../utils/links"));
|
|
23
|
+
|
|
24
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
|
+
|
|
32
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
+
|
|
34
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
35
|
+
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
37
|
+
|
|
38
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
39
|
+
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
+
|
|
42
|
+
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); }; }
|
|
43
|
+
|
|
44
|
+
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); }
|
|
45
|
+
|
|
46
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
+
|
|
48
|
+
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; } }
|
|
49
|
+
|
|
50
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
+
|
|
52
|
+
var SearchCancel = function SearchCancel(props) {
|
|
53
|
+
return /*#__PURE__*/_react["default"].createElement("svg", props, /*#__PURE__*/_react["default"].createElement("g", {
|
|
54
|
+
fill: "none",
|
|
55
|
+
fillRule: "evenodd"
|
|
56
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
57
|
+
d: "M14.162 28.325c7.822 0 14.162-6.341 14.162-14.163C28.325 6.34 21.985 0 14.162 0 6.34 0 0 6.34 0 14.162c0 7.822 6.341 14.163 14.163 14.163",
|
|
58
|
+
fill: "#FFF"
|
|
59
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
60
|
+
fill: "#E60013",
|
|
61
|
+
d: "M7.699 9.82l10.806 10.806 2.12-2.12L9.822 7.698z"
|
|
62
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
63
|
+
fill: "#C7000A",
|
|
64
|
+
d: "M18.505 7.699L7.699 18.505l2.12 2.121L20.627 9.82z"
|
|
65
|
+
})));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
SearchCancel.defaultProps = {
|
|
69
|
+
width: "29",
|
|
70
|
+
height: "29",
|
|
71
|
+
viewBox: "0 0 29 29",
|
|
72
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
73
|
+
};
|
|
74
|
+
var _ = {
|
|
75
|
+
get: _get["default"]
|
|
76
|
+
};
|
|
77
|
+
var styles = {
|
|
78
|
+
inputHeight: 35,
|
|
79
|
+
// px
|
|
80
|
+
containerHeight: 65,
|
|
81
|
+
// px
|
|
82
|
+
inputWidth: 220 // px
|
|
83
|
+
|
|
84
|
+
};
|
|
85
|
+
var searchBoxEffectCSS = /*#__PURE__*/(0, _styledComponents.css)(["&.effect-enter{opacity:0;right:-20px;}&.effect-enter-active{opacity:1;right:0;transition:opacity 500ms ease,right 500ms ease;}&.effect-exit{opacity:1;right:0;}&.effect-exit-active{opacity:0;right:-20px;transition:opacity 200ms ease,right 200ms ease;}"]);
|
|
86
|
+
|
|
87
|
+
var SearchBoxContainer = /*#__PURE__*/_styledComponents["default"].form.withConfig({
|
|
88
|
+
displayName: "search-box__SearchBoxContainer",
|
|
89
|
+
componentId: "sc-1rne3k3-0"
|
|
90
|
+
})(["display:table-cell;vertical-align:middle;text-align:center;position:absolute;z-index:99;right:0;top:49%;transform:translateY(-50%);height:", "px;box-sizing:border-box;", ""], styles.containerHeight, searchBoxEffectCSS);
|
|
91
|
+
|
|
92
|
+
var CellBlock = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
93
|
+
displayName: "search-box__CellBlock",
|
|
94
|
+
componentId: "sc-1rne3k3-1"
|
|
95
|
+
})(["display:table-cell;height:", "px;box-sizing:border-box;vertical-align:middle;line-height:1;svg{height:100%;}"], styles.containerHeight);
|
|
96
|
+
|
|
97
|
+
var SearchInput = /*#__PURE__*/_styledComponents["default"].input.withConfig({
|
|
98
|
+
displayName: "search-box__SearchInput",
|
|
99
|
+
componentId: "sc-1rne3k3-2"
|
|
100
|
+
})(["width:", "px;max-width:calc(100vw - 870px);margin-right:0.5em;font-size:", ";font-weight:", ";height:", "px;border-radius:58px;border:0;padding:0 1em;&:focus{outline:none;}&::placeholder{font-size:", ";font-weight:", ";color:#8c8c8c;opacity:0.5;letter-spacing:0.7px;}"], styles.inputWidth, _fonts["default"].size.base, _fonts["default"].size.medium, styles.inputHeight, _fonts["default"].size.base, _fonts["default"].size.medium);
|
|
101
|
+
|
|
102
|
+
var SearchBox = /*#__PURE__*/function (_React$Component) {
|
|
103
|
+
_inherits(SearchBox, _React$Component);
|
|
104
|
+
|
|
105
|
+
var _super = _createSuper(SearchBox);
|
|
106
|
+
|
|
107
|
+
function SearchBox(props) {
|
|
108
|
+
var _this;
|
|
109
|
+
|
|
110
|
+
_classCallCheck(this, SearchBox);
|
|
111
|
+
|
|
112
|
+
_this = _super.call(this, props);
|
|
113
|
+
_this._handleChange = _this._handleChange.bind(_assertThisInitialized(_this));
|
|
114
|
+
_this._handleSubmit = _this._handleSubmit.bind(_assertThisInitialized(_this));
|
|
115
|
+
_this._onReset = _this._onReset.bind(_assertThisInitialized(_this));
|
|
116
|
+
_this._handleBlur = _this._handleBlur.bind(_assertThisInitialized(_this));
|
|
117
|
+
_this.state = {
|
|
118
|
+
keywords: ''
|
|
119
|
+
};
|
|
120
|
+
return _this;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_createClass(SearchBox, [{
|
|
124
|
+
key: "_handleChange",
|
|
125
|
+
value: function _handleChange(e) {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
|
|
128
|
+
var input = _.get(e, 'target.value', '');
|
|
129
|
+
|
|
130
|
+
return this.setState({
|
|
131
|
+
keywords: input
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "_handleSubmit",
|
|
136
|
+
value: function _handleSubmit(e, releaseBranch, isLinkExternal) {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
var keywords = this.state.keywords;
|
|
139
|
+
|
|
140
|
+
if (window) {
|
|
141
|
+
window.location = "".concat(_links["default"].getSearchLink(isLinkExternal, releaseBranch).to, "?q=").concat(keywords);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
key: "_onReset",
|
|
146
|
+
value: function _onReset(e) {
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
|
|
149
|
+
if (this.state.keywords === '') {
|
|
150
|
+
this.props.closeSearchBox();
|
|
151
|
+
} else {
|
|
152
|
+
this.setState({
|
|
153
|
+
keywords: ''
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "_handleBlur",
|
|
159
|
+
value: function _handleBlur() {
|
|
160
|
+
this.props.closeSearchBox();
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "render",
|
|
164
|
+
value: function render() {
|
|
165
|
+
var _this2 = this;
|
|
166
|
+
|
|
167
|
+
var isSearchOpened = this.props.isSearchOpened;
|
|
168
|
+
return /*#__PURE__*/_react["default"].createElement(_headerContext["default"].Consumer, null, function (_ref) {
|
|
169
|
+
var releaseBranch = _ref.releaseBranch,
|
|
170
|
+
isLinkExternal = _ref.isLinkExternal;
|
|
171
|
+
return /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
|
|
172
|
+
"in": isSearchOpened,
|
|
173
|
+
classNames: "effect",
|
|
174
|
+
timeout: {
|
|
175
|
+
enter: 500,
|
|
176
|
+
exit: 200
|
|
177
|
+
},
|
|
178
|
+
mountOnEnter: true,
|
|
179
|
+
unmountOnExit: true
|
|
180
|
+
}, /*#__PURE__*/_react["default"].createElement(SearchBoxContainer, {
|
|
181
|
+
onSubmit: function onSubmit(e) {
|
|
182
|
+
_this2._handleSubmit(e, releaseBranch, isLinkExternal);
|
|
183
|
+
},
|
|
184
|
+
onReset: _this2._onReset,
|
|
185
|
+
noValidate: "novalidate"
|
|
186
|
+
}, /*#__PURE__*/_react["default"].createElement(CellBlock, null, /*#__PURE__*/_react["default"].createElement(SearchInput, {
|
|
187
|
+
type: "search",
|
|
188
|
+
placeholder: "\u641C\u5C0B\u5831\u5C0E\u8005\u6587\u7AE0",
|
|
189
|
+
onBlur: _this2._handleBlur,
|
|
190
|
+
onChange: _this2._handleChange,
|
|
191
|
+
value: _this2.state.keywords,
|
|
192
|
+
autoFocus: true
|
|
193
|
+
})), /*#__PURE__*/_react["default"].createElement(CellBlock, null, /*#__PURE__*/_react["default"].createElement(SearchCancel, {
|
|
194
|
+
style: {
|
|
195
|
+
cursor: 'pointer'
|
|
196
|
+
},
|
|
197
|
+
onMouseDown: _this2._onReset
|
|
198
|
+
}))));
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}]);
|
|
202
|
+
|
|
203
|
+
return SearchBox;
|
|
204
|
+
}(_react["default"].Component);
|
|
205
|
+
|
|
206
|
+
SearchBox.propTypes = {
|
|
207
|
+
isSearchOpened: _propTypes["default"].bool,
|
|
208
|
+
closeSearchBox: _propTypes["default"].func.isRequired
|
|
209
|
+
};
|
|
210
|
+
SearchBox.defaultProps = {
|
|
211
|
+
isSearchOpened: false
|
|
212
|
+
};
|
|
213
|
+
var _default = SearchBox;
|
|
214
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _headerContext = _interopRequireDefault(require("../contexts/header-context"));
|
|
15
|
+
|
|
16
|
+
var _slogan = _interopRequireDefault(require("../constants/slogan"));
|
|
17
|
+
|
|
18
|
+
var _colors = _interopRequireDefault(require("../constants/colors"));
|
|
19
|
+
|
|
20
|
+
var _fonts = _interopRequireDefault(require("../constants/fonts"));
|
|
21
|
+
|
|
22
|
+
var _theme = _interopRequireDefault(require("../utils/theme"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var style = {
|
|
27
|
+
fontSize: {
|
|
28
|
+
desktop: _fonts["default"].size.base
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var SloganContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
33
|
+
displayName: "slogan__SloganContainer",
|
|
34
|
+
componentId: "sc-1eoofl8-0"
|
|
35
|
+
})(["color:", ";font-size:", ";font-family:Noto Serif TC;display:flex;align-items:center;"], function (props) {
|
|
36
|
+
return props.color || _colors["default"].grayDark;
|
|
37
|
+
}, style.fontSize.desktop);
|
|
38
|
+
|
|
39
|
+
var Slogan = function Slogan(_ref) {
|
|
40
|
+
var themeFunction = _ref.themeFunction;
|
|
41
|
+
return /*#__PURE__*/_react["default"].createElement(_headerContext["default"].Consumer, null, function (_ref2) {
|
|
42
|
+
var theme = _ref2.theme;
|
|
43
|
+
var color = themeFunction(theme);
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement(SloganContainer, {
|
|
45
|
+
color: color
|
|
46
|
+
}, _slogan["default"]);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
Slogan.propTypes = {
|
|
51
|
+
themeFunction: _propTypes["default"].func
|
|
52
|
+
};
|
|
53
|
+
Slogan.defaultProps = {
|
|
54
|
+
themeFunction: _theme["default"].selectSloganTheme
|
|
55
|
+
};
|
|
56
|
+
var _default = Slogan;
|
|
57
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
// auth
|
|
9
|
+
REQUEST_AUTH: 'request_authorization',
|
|
10
|
+
AUTH_SUCCESS: 'grant_authorization_success',
|
|
11
|
+
AUTH_FAILURE: 'grant_authorization_failure',
|
|
12
|
+
AUTH_CLEAR: 'clear_authorization'
|
|
13
|
+
};
|
|
14
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.actionActive = exports.actionOrder = exports.actionLabels = exports.actionKeys = void 0;
|
|
7
|
+
|
|
8
|
+
var _actionLabels, _wide, _narrow;
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
var actionKeys = {
|
|
13
|
+
support: 'support',
|
|
14
|
+
newsLetter: 'newsLetter'
|
|
15
|
+
};
|
|
16
|
+
exports.actionKeys = actionKeys;
|
|
17
|
+
var actionLabels = (_actionLabels = {}, _defineProperty(_actionLabels, actionKeys.support, '贊助'), _defineProperty(_actionLabels, actionKeys.newsLetter, '訂閱'), _actionLabels);
|
|
18
|
+
exports.actionLabels = actionLabels;
|
|
19
|
+
var actionOrder = {
|
|
20
|
+
mobile: [actionKeys.support],
|
|
21
|
+
desktop: [actionKeys.support, actionKeys.newsLetter]
|
|
22
|
+
};
|
|
23
|
+
exports.actionOrder = actionOrder;
|
|
24
|
+
var actionActive = {
|
|
25
|
+
wide: (_wide = {}, _defineProperty(_wide, actionKeys.support, true), _defineProperty(_wide, actionKeys.newsLetter, true), _wide),
|
|
26
|
+
narrow: (_narrow = {}, _defineProperty(_narrow, actionKeys.support, true), _defineProperty(_narrow, actionKeys.newsLetter, false), _narrow)
|
|
27
|
+
};
|
|
28
|
+
exports.actionActive = actionActive;
|
|
29
|
+
var _default = {
|
|
30
|
+
actionKeys: actionKeys,
|
|
31
|
+
actionLabels: actionLabels,
|
|
32
|
+
actionOrder: actionOrder,
|
|
33
|
+
actionActive: actionActive
|
|
34
|
+
};
|
|
35
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.categoryOrder = exports.categoryPathnames = exports.categoryLabels = void 0;
|
|
7
|
+
var categoryLabels = {
|
|
8
|
+
cultureAndArt: '文化.藝術',
|
|
9
|
+
environmentAndEducation: '環境.教育',
|
|
10
|
+
humanRightsAndSociety: '人權.社會',
|
|
11
|
+
international: '國際.兩岸',
|
|
12
|
+
livingAndMedicalCare: '生活.醫療',
|
|
13
|
+
politicsAndEconomy: '政經.產業'
|
|
14
|
+
};
|
|
15
|
+
exports.categoryLabels = categoryLabels;
|
|
16
|
+
var categoryPathnames = {
|
|
17
|
+
cultureAndArt: '/categories/culture_and_art',
|
|
18
|
+
environmentAndEducation: '/categories/environment_and_education',
|
|
19
|
+
humanRightsAndSociety: '/categories/human_rights_and_society',
|
|
20
|
+
international: '/categories/international',
|
|
21
|
+
livingAndMedicalCare: '/categories/living_and_medical_care',
|
|
22
|
+
politicsAndEconomy: '/categories/politics_and_economy'
|
|
23
|
+
};
|
|
24
|
+
exports.categoryPathnames = categoryPathnames;
|
|
25
|
+
var categoryOrder = ['humanRightsAndSociety', 'environmentAndEducation', 'politicsAndEconomy', 'cultureAndArt', 'livingAndMedicalCare', 'international'];
|
|
26
|
+
exports.categoryOrder = categoryOrder;
|
|
27
|
+
var _default = {
|
|
28
|
+
categoryLabels: categoryLabels,
|
|
29
|
+
categoryOrder: categoryOrder,
|
|
30
|
+
categoryPathnames: categoryPathnames
|
|
31
|
+
};
|
|
32
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.channelTypes = exports.channelDropDownType = exports.channelLinkType = exports.channelOrder = exports.channelLabels = exports.channelPathnames = exports.channelKeys = void 0;
|
|
7
|
+
|
|
8
|
+
var _channelPathnames, _channelLabels, _channelTypes;
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
var channelKeys = {
|
|
13
|
+
reviews: 'reviews',
|
|
14
|
+
topics: 'topics',
|
|
15
|
+
photography: 'photography',
|
|
16
|
+
infographic: 'infographic',
|
|
17
|
+
categories: 'categories'
|
|
18
|
+
};
|
|
19
|
+
exports.channelKeys = channelKeys;
|
|
20
|
+
var channelPathnames = (_channelPathnames = {}, _defineProperty(_channelPathnames, channelKeys.reviews, '/categories/reviews'), _defineProperty(_channelPathnames, channelKeys.topics, '/topics'), _defineProperty(_channelPathnames, channelKeys.photography, '/photography'), _defineProperty(_channelPathnames, channelKeys.infographic, '/categories/infographic'), _defineProperty(_channelPathnames, channelKeys.categories, '/#categories'), _channelPathnames);
|
|
21
|
+
exports.channelPathnames = channelPathnames;
|
|
22
|
+
var channelLabels = (_channelLabels = {}, _defineProperty(_channelLabels, channelKeys.reviews, '評論'), _defineProperty(_channelLabels, channelKeys.topics, '專題'), _defineProperty(_channelLabels, channelKeys.photography, '攝影'), _defineProperty(_channelLabels, channelKeys.infographic, '多媒體'), _defineProperty(_channelLabels, channelKeys.categories, '議題'), _channelLabels);
|
|
23
|
+
exports.channelLabels = channelLabels;
|
|
24
|
+
var channelOrder = [channelKeys.reviews, channelKeys.topics, channelKeys.photography, channelKeys.infographic, channelKeys.categories];
|
|
25
|
+
exports.channelOrder = channelOrder;
|
|
26
|
+
var channelLinkType = 'link';
|
|
27
|
+
exports.channelLinkType = channelLinkType;
|
|
28
|
+
var channelDropDownType = 'drop-down';
|
|
29
|
+
exports.channelDropDownType = channelDropDownType;
|
|
30
|
+
var channelTypes = (_channelTypes = {}, _defineProperty(_channelTypes, channelKeys.reviews, channelLinkType), _defineProperty(_channelTypes, channelKeys.topics, channelLinkType), _defineProperty(_channelTypes, channelKeys.photography, channelLinkType), _defineProperty(_channelTypes, channelKeys.infographic, channelLinkType), _defineProperty(_channelTypes, channelKeys.categories, channelDropDownType), _channelTypes);
|
|
31
|
+
exports.channelTypes = channelTypes;
|
|
32
|
+
var _default = {
|
|
33
|
+
channelDropDownType: channelDropDownType,
|
|
34
|
+
channelKeys: channelKeys,
|
|
35
|
+
channelLinkType: channelLinkType,
|
|
36
|
+
channelLabels: channelLabels,
|
|
37
|
+
channelOrder: channelOrder,
|
|
38
|
+
channelPathnames: channelPathnames,
|
|
39
|
+
channelTypes: channelTypes
|
|
40
|
+
};
|
|
41
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
black: '#000000',
|
|
9
|
+
grayDark: '#262626',
|
|
10
|
+
grayLight: '#f1f1f1',
|
|
11
|
+
gray: '#e2e2e2',
|
|
12
|
+
photography: '#08192d',
|
|
13
|
+
brown: '#a67a44',
|
|
14
|
+
white: '#ffffff',
|
|
15
|
+
red: '#c5222a'
|
|
16
|
+
};
|
|
17
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var links = {
|
|
8
|
+
monthlyDonation: 'https://www.twreporter.org/donation/period',
|
|
9
|
+
newsLetter: 'https://twreporter.us14.list-manage.com/subscribe/post?u=4da5a7d3b98dbc9fdad009e7e&id=e0eb0c8c32',
|
|
10
|
+
onceDonation: 'https://www.twreporter.org/donation/one-time'
|
|
11
|
+
};
|
|
12
|
+
var _default = links;
|
|
13
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
size: {
|
|
9
|
+
xsmall: '9px',
|
|
10
|
+
small: '12px',
|
|
11
|
+
base: '14px',
|
|
12
|
+
medium: '16px',
|
|
13
|
+
large: '18px',
|
|
14
|
+
xlarge: '20px',
|
|
15
|
+
h1: '28px',
|
|
16
|
+
h2: '20px',
|
|
17
|
+
title: {
|
|
18
|
+
xlarge: '36px',
|
|
19
|
+
large: '32px',
|
|
20
|
+
bookmark: '27px',
|
|
21
|
+
bookmarkMobile: '20px',
|
|
22
|
+
medium: '24px',
|
|
23
|
+
base: '20px'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
weight: {
|
|
27
|
+
normal: '300',
|
|
28
|
+
medium: '500',
|
|
29
|
+
bold: '700'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _theme = _interopRequireDefault(require("./theme"));
|
|
11
|
+
|
|
12
|
+
var _propTypes2 = _interopRequireDefault(require("@twreporter/core/lib/constants/prop-types"));
|
|
13
|
+
|
|
14
|
+
var _releaseBranch = _interopRequireDefault(require("@twreporter/core/lib/constants/release-branch"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
// @twreporter
|
|
19
|
+
var themePropTypes = _propTypes["default"].oneOf([_theme["default"].normal, _theme["default"].transparent, _theme["default"].photography, _theme["default"].index]);
|
|
20
|
+
|
|
21
|
+
var contextPropTypes = {
|
|
22
|
+
theme: themePropTypes,
|
|
23
|
+
releaseBranch: _propTypes2["default"].releaseBranch,
|
|
24
|
+
isLinkExternal: _propTypes["default"].bool,
|
|
25
|
+
isAuthed: _propTypes["default"].bool
|
|
26
|
+
};
|
|
27
|
+
var contextDefaultProps = {
|
|
28
|
+
theme: _theme["default"].normal,
|
|
29
|
+
releaseBranch: _releaseBranch["default"].master,
|
|
30
|
+
isLinkExternal: false,
|
|
31
|
+
isAuthed: false
|
|
32
|
+
};
|
|
33
|
+
var linkPropTypes = {
|
|
34
|
+
to: _propTypes["default"].string.isRequired,
|
|
35
|
+
isExternal: _propTypes["default"].bool.isRequired
|
|
36
|
+
};
|
|
37
|
+
var _default = {
|
|
38
|
+
context: {
|
|
39
|
+
propTypes: contextPropTypes,
|
|
40
|
+
defaultProps: contextDefaultProps
|
|
41
|
+
},
|
|
42
|
+
link: {
|
|
43
|
+
propTypes: linkPropTypes
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.serviceOrder = exports.servicePathnames = exports.serviceLabels = exports.serviceKeys = void 0;
|
|
7
|
+
|
|
8
|
+
var _serviceLabels, _servicePathnames;
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
var serviceKeys = {
|
|
13
|
+
search: 'search',
|
|
14
|
+
bookmarks: 'bookmarks',
|
|
15
|
+
login: 'login',
|
|
16
|
+
logout: 'logout'
|
|
17
|
+
};
|
|
18
|
+
exports.serviceKeys = serviceKeys;
|
|
19
|
+
var serviceLabels = (_serviceLabels = {}, _defineProperty(_serviceLabels, serviceKeys.bookmarks, '書籤'), _defineProperty(_serviceLabels, serviceKeys.login, '登入'), _defineProperty(_serviceLabels, serviceKeys.logout, '登出'), _defineProperty(_serviceLabels, serviceKeys.search, '搜尋'), _serviceLabels);
|
|
20
|
+
exports.serviceLabels = serviceLabels;
|
|
21
|
+
var servicePathnames = (_servicePathnames = {}, _defineProperty(_servicePathnames, serviceKeys.bookmarks, '/bookmarks'), _defineProperty(_servicePathnames, serviceKeys.login, '/signin'), _defineProperty(_servicePathnames, serviceKeys.logout, '/v2/auth/logout'), _defineProperty(_servicePathnames, serviceKeys.search, '/search'), _servicePathnames);
|
|
22
|
+
exports.servicePathnames = servicePathnames;
|
|
23
|
+
var serviceOrder = [serviceKeys.search, serviceKeys.bookmarks];
|
|
24
|
+
exports.serviceOrder = serviceOrder;
|
|
25
|
+
var _default = {
|
|
26
|
+
serviceKeys: serviceKeys,
|
|
27
|
+
serviceLabels: serviceLabels,
|
|
28
|
+
serviceOrder: serviceOrder,
|
|
29
|
+
servicePathnames: servicePathnames
|
|
30
|
+
};
|
|
31
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
transparent: 'transparent',
|
|
9
|
+
normal: 'normal',
|
|
10
|
+
photography: 'photography',
|
|
11
|
+
index: 'index'
|
|
12
|
+
};
|
|
13
|
+
exports["default"] = _default;
|