@twreporter/universal-header 2.2.0-rc.7 → 2.2.0-rc.8

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 CHANGED
@@ -3,6 +3,18 @@
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
+ # [2.2.0-rc.8](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/universal-header@2.2.0-rc.7...@twreporter/universal-header@2.2.0-rc.8) (2021-10-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix ui defect ([2ab85e2](https://github.com/twreporter/twreporter-npm-packages/commit/2ab85e2eabd9ae33b857353712358777b50a9f9a))
12
+ * **universal-header:** fix ui defect ([c1be79f](https://github.com/twreporter/twreporter-npm-packages/commit/c1be79f6ab811b0c44d9a8753230f73486be57cc))
13
+
14
+
15
+
16
+
17
+
6
18
  # [2.2.0-rc.7](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/universal-header@2.2.0-rc.6...@twreporter/universal-header@2.2.0-rc.7) (2021-09-29)
7
19
 
8
20
 
@@ -105,7 +105,7 @@ var ActionsContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig(
105
105
  var ActionContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
106
106
  displayName: "action-button__ActionContainer",
107
107
  componentId: "sc-4wc24t-1"
108
- })(["transition:opacity 0.3s;transition-delay:400ms;opacity:", ";margin:", ";width:100%;&:first-child{margin-top:0;margin-left:0;}a,a:link,a:visited{color:", ";font-size:", ";font-weight:", ";", " ", "}"], function (props) {
108
+ })(["transition:opacity 0.1s;transition-delay:300ms;opacity:", ";margin:", ";width:100%;&:first-child{margin-top:0;margin-left:0;}a,a:link,a:visited{color:", ";font-size:", ";font-weight:", ";", " ", "}"], function (props) {
109
109
  return props.isActive ? 1 : 0;
110
110
  }, function (props) {
111
111
  return (0, _css.arrayToCssShorthand)(styles.itemMargin[props.direction]);
@@ -112,19 +112,17 @@ var styles = {
112
112
  column: 'relative'
113
113
  },
114
114
  dropdownTop: {
115
- row: 35,
116
- // px
117
- column: 0 // px
118
-
115
+ row: "calc(100% + 1px)",
116
+ column: 0
119
117
  }
120
118
  };
121
119
  var dropDownMenuEffectCSS = /*#__PURE__*/(0, _styledComponents.css)([".effect-enter{max-height:0;}.effect-enter-active{max-height:400px;transition:max-height 400ms ease-in 100ms;}"]);
122
- var linkUnderline = /*#__PURE__*/(0, _styledComponents.css)(["animation:", " 0.5s linear;position:absolute;left:0;bottom:-1px;display:block;content:'';width:100%;height:4px;background-color:#A67A44;"], _animations["default"].changeOpacity('0', '1'));
120
+ var linkUnderline = /*#__PURE__*/(0, _styledComponents.css)(["animation:", " 0.5s linear;position:absolute;left:0;bottom:-1px;display:block;content:'';width:100%;height:4px;background-color:#a67a44;"], _animations["default"].changeOpacity('0', '1'));
123
121
 
124
122
  var DropDownMenuWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
125
123
  displayName: "channels__DropDownMenuWrapper",
126
124
  componentId: "nu2llv-0"
127
- })(["position:", ";z-index:999;width:100%;left:0;top:", "px;", ""], function (props) {
125
+ })(["position:", ";z-index:999;width:100%;left:0;top:", ";", ""], function (props) {
128
126
  return styles.dropdownPosition[props.direction];
129
127
  }, function (props) {
130
128
  return styles.dropdownTop[props.direction];
@@ -133,12 +131,12 @@ var DropDownMenuWrapper = /*#__PURE__*/_styledComponents["default"].div.withConf
133
131
  var Box = /*#__PURE__*/_styledComponents["default"].div.withConfig({
134
132
  displayName: "channels__Box",
135
133
  componentId: "nu2llv-1"
136
- })(["width:100%;"]);
134
+ })(["width:100%;height:100%;"]);
137
135
 
138
136
  var List = /*#__PURE__*/_styledComponents["default"].ul.withConfig({
139
137
  displayName: "channels__List",
140
138
  componentId: "nu2llv-2"
141
- })(["justify-content:space-between;background-color:", ";user-select:none;box-sizing:border-box;display:flex;flex-direction:", ";flex-wrap:nowrap;align-items:center;list-style-type:none;margin:auto;padding-inline-start:0;border-color:", ";border-width:", ";border-style:solid;"], function (props) {
139
+ })(["height:100%;justify-content:space-between;background-color:", ";user-select:none;box-sizing:border-box;display:flex;flex-direction:", ";flex-wrap:nowrap;align-items:center;list-style-type:none;margin:auto;padding-inline-start:0;border-color:", ";border-width:", ";border-style:solid;"], function (props) {
142
140
  return props.bgColor || _colors["default"].white;
143
141
  }, function (props) {
144
142
  return props.direction;
@@ -151,7 +149,7 @@ var List = /*#__PURE__*/_styledComponents["default"].ul.withConfig({
151
149
  var ListItem = /*#__PURE__*/_styledComponents["default"].li.withConfig({
152
150
  displayName: "channels__ListItem",
153
151
  componentId: "nu2llv-3"
154
- })(["display:flex;flex-direction:", ";position:relative;width:", ";font-size:", ";letter-spacing:0.5px;cursor:pointer;margin:", ";flex:1;text-shadow:", ";border-style:solid;border-color:inherit;border-width:", ";&:first-child{border-width:", ";}&::after{", "}a,a:link,a:visited{display:flex;justify-content:space-between;align-items:center;font-size:", ";font-weight:", ";padding:", ";width:100%;color:", ";border:0;line-height:18px;&:hover{background-color:", ";color:", ";}}"], function (props) {
152
+ })(["display:flex;flex-direction:", ";position:relative;width:", ";height:100%;font-size:", ";letter-spacing:0.5px;cursor:pointer;margin:", ";flex:1;text-shadow:", ";border-style:solid;border-color:inherit;border-width:", ";&:first-child{border-width:", ";}&::after{", "}a,a:link,a:visited{display:flex;justify-content:space-between;align-items:center;font-size:", ";font-weight:", ";padding:", ";width:100%;color:", ";border:0;line-height:18px;&:hover{background-color:", ";color:", ";}}"], function (props) {
155
153
  return props.direction;
156
154
  }, function (props) {
157
155
  return styles.itemWidth[props.direction];
@@ -198,18 +196,26 @@ var Channels = /*#__PURE__*/function (_React$PureComponent) {
198
196
 
199
197
  _this = _super.call(this, props);
200
198
  _this.state = {
201
- activeDataIndex: _this._checkWhichChannelActive(props.currentPathname)
199
+ activeDataIndex: _this._checkWhichChannelActive(props.currentPathname),
200
+ activeDropdownIndex: invalidDataIndex
202
201
  };
203
202
  _this.handleDropDownChannelClick = _this._handleDropDownChannelClick.bind(_assertThisInitialized(_this));
204
203
  _this.handleNormalChannelClick = _this._handleNormalChannelClick.bind(_assertThisInitialized(_this));
205
204
  _this.handleDropDownMenuClick = _this._handleDropDownMenuClick.bind(_assertThisInitialized(_this));
206
- _this.setActiveData = _this._setActiveData.bind(_assertThisInitialized(_this));
207
- _this.resetActiveData = _this._resetActiveDataIndex.bind(_assertThisInitialized(_this));
208
205
  _this.callback = _this._callback.bind(_assertThisInitialized(_this));
209
206
  return _this;
210
207
  }
211
208
 
212
209
  _createClass(Channels, [{
210
+ key: "componentDidUpdate",
211
+ value: function componentDidUpdate() {
212
+ if (this.context.hideHeader) {
213
+ this.setState({
214
+ activeDropdownIndex: invalidDataIndex
215
+ });
216
+ }
217
+ }
218
+ }, {
213
219
  key: "_checkWhichChannelActive",
214
220
  value: function _checkWhichChannelActive(currentPathname) {
215
221
  var data = this.props.data;
@@ -245,33 +251,29 @@ var Channels = /*#__PURE__*/function (_React$PureComponent) {
245
251
  key: "_handleDropDownChannelClick",
246
252
  value: function _handleDropDownChannelClick(e, channelIndex) {
247
253
  e.preventDefault();
248
- this.setActiveData(channelIndex, true);
254
+ var activeDropdownIndex = this.state.activeDropdownIndex;
255
+ var nextActiveDropdownIndex = channelIndex === activeDropdownIndex ? invalidDataIndex : channelIndex;
256
+ this.setState({
257
+ activeDropdownIndex: nextActiveDropdownIndex
258
+ });
249
259
  }
250
260
  }, {
251
261
  key: "_handleNormalChannelClick",
252
262
  value: function _handleNormalChannelClick(channelIndex) {
253
- this.setActiveData(channelIndex, false);
263
+ this.setState({
264
+ activeDataIndex: channelIndex,
265
+ activeDropdownIndex: invalidDataIndex
266
+ });
254
267
  this.callback(channelIndex);
255
268
  }
256
269
  }, {
257
270
  key: "_handleDropDownMenuClick",
258
- value: function _handleDropDownMenuClick() {
259
- this.resetActiveData(invalidDataIndex);
260
- this.callback(invalidDataIndex);
261
- }
262
- }, {
263
- key: "_setActiveData",
264
- value: function _setActiveData(dataIndex, clickTwiceInactive) {
265
- var activeDataIndex = this.state.activeDataIndex;
266
- var nextActiveIndex = clickTwiceInactive && activeDataIndex === dataIndex ? invalidDataIndex : dataIndex;
271
+ value: function _handleDropDownMenuClick(parentIndex) {
267
272
  this.setState({
268
- activeDataIndex: nextActiveIndex
273
+ activeDataIndex: parentIndex,
274
+ activeDropdownIndex: invalidDataIndex
269
275
  });
270
- }
271
- }, {
272
- key: "_resetActiveDataIndex",
273
- value: function _resetActiveDataIndex() {
274
- this.setActiveData(invalidDataIndex);
276
+ this.callback(parentIndex);
275
277
  }
276
278
  }, {
277
279
  key: "_callback",
@@ -292,8 +294,8 @@ var Channels = /*#__PURE__*/function (_React$PureComponent) {
292
294
  var _this$props = this.props,
293
295
  data = _this$props.data,
294
296
  direction = _this$props.direction;
295
- var activeDataIndex = this.state.activeDataIndex;
296
- var toShowDropdownMenu = activeDataIndex === dataIndex;
297
+ var activeDropdownIndex = this.state.activeDropdownIndex;
298
+ var toShowDropdownMenu = activeDropdownIndex === dataIndex;
297
299
 
298
300
  var dropdownMenuData = _.get(data, [dataIndex, dropDownMenuKey], []);
299
301
 
@@ -308,11 +310,12 @@ var Channels = /*#__PURE__*/function (_React$PureComponent) {
308
310
  unmountOnExit: true
309
311
  }, /*#__PURE__*/_react["default"].createElement(_dropDownMenu["default"], {
310
312
  data: dropdownMenuData,
311
- onClick: this.handleDropDownMenuClick
313
+ onClick: function onClick(e) {
314
+ return _this2.handleDropDownMenuClick(dataIndex);
315
+ }
312
316
  })));
313
317
 
314
- var isActive = activeDataIndex === dataIndex;
315
- var status = isActive ? 'collapse' : 'expand';
318
+ var status = toShowDropdownMenu ? 'collapse' : 'expand';
316
319
 
317
320
  var _themeUtils$selectIco = _slicedToArray(_theme["default"].selectIcons(theme)[status], 2),
318
321
  StatusIcon = _themeUtils$selectIco[0],
@@ -413,5 +416,7 @@ _defineProperty(Channels, "defaultProps", {
413
416
  callback: function callback() {}
414
417
  });
415
418
 
419
+ _defineProperty(Channels, "contextType", _headerContext["default"]);
420
+
416
421
  var _default = Channels;
417
422
  exports["default"] = _default;
@@ -33,8 +33,12 @@ var _customizedLink = _interopRequireDefault(require("./customized-link"));
33
33
 
34
34
  var _slogan = _interopRequireDefault(require("./slogan"));
35
35
 
36
+ var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
37
+
36
38
  var _css = require("@twreporter/core/lib/utils/css");
37
39
 
40
+ var _templateObject;
41
+
38
42
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
39
43
 
40
44
  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); }
@@ -53,7 +57,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
53
57
 
54
58
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
55
59
 
56
- var CHANNEL_HEIGHT = 37; // px
60
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
61
+
62
+ var CHANNEL_HEIGHT = 36; // px
57
63
 
58
64
  var styles = {
59
65
  headerHeight: {
@@ -75,26 +81,34 @@ var styles = {
75
81
  hd: 1320 // px
76
82
 
77
83
  },
78
- channelBottomBorderWidth: [1, 0, 1, 0] // px
84
+ channelTopBorderWidth: [0, 1, 1, 0],
85
+ // px
86
+ channelBottomBorderWidth: [1, 0, 1, 0],
87
+ // px
88
+ iconBorderWidth: {
89
+ wide: [0, 0, 0, 0],
90
+ // px
91
+ narrow: [0, 0, 1, 0] // px
79
92
 
93
+ }
80
94
  };
81
95
 
82
96
  var headerWide = _animations["default"].changeHeight("".concat(styles.headerHeight.narrow, "px"), "".concat(styles.headerHeight.wide, "px"));
83
97
 
84
98
  var headerNarrow = _animations["default"].changeHeight("".concat(styles.headerHeight.wide, "px"), "".concat(styles.headerHeight.narrow, "px"));
85
99
 
86
- var HeaderEffect = /*#__PURE__*/(0, _styledComponents.css)([".header-effect-enter{height:", "px;}.header-effect-enter-active{animation:", " 0.3s linear;animation-delay:400ms;}.header-effect-exit-active{animation:", " 0.3s linear;animation-delay:400ms;}.header-effect-exit-done{height:", "px;}"], styles.headerHeight.narrow, headerWide, headerNarrow, styles.headerHeight.narrow);
87
- var ActionEffect = /*#__PURE__*/(0, _styledComponents.css)([".action-effect-enter{transform:translateX(-40px);}.action-effect-enter-active{animation:", " 0.3s;animation-delay:400ms;}.action-effect-exit-active{animation:", " 0.3s;animation-delay:400ms;}.action-effect-exit-done{transform:translateX(-40px);}"], _animations["default"].changeTranslateX('-40px', 0), _animations["default"].changeTranslateX(0, '-40px'));
88
- var SloganEffect = /*#__PURE__*/(0, _styledComponents.css)([".slogan-effect-enter{opacity:0;}.slogagn-effect-enter-active{animation:", " 0.3s;animation-delay:400ms;}.slogan-effect-exit-active{animation:", " 0.3s;animation-delay:400ms;}.slogan-effect-exit-done{opacity:0;}"], _animations["default"].changeOpacity('0', '1'), _animations["default"].changeOpacity('1', '0'));
100
+ var HeaderEffect = /*#__PURE__*/(0, _styledComponents.css)([".header-effect-enter{height:", "px;}.header-effect-enter-active{animation:", " 0.2s linear;animation-delay:300ms;}.header-effect-exit-active{animation:", " 0.2s linear;animation-delay:300ms;}.header-effect-exit-done{height:", "px;}"], styles.headerHeight.narrow, headerWide, headerNarrow, styles.headerHeight.narrow);
101
+ var ActionEffect = /*#__PURE__*/(0, _styledComponents.css)([".action-effect-enter{transform:translateX(-40px);}.action-effect-enter-active{animation:", " 0.2s;animation-delay:300ms;}.action-effect-exit-active{animation:", " 0.2s;animation-delay:300ms;}.action-effect-exit-done{transform:translateX(-40px);}"], _animations["default"].changeTranslateX('-40px', 0), _animations["default"].changeTranslateX(0, '-40px'));
102
+ var SloganEffect = /*#__PURE__*/(0, _styledComponents.css)([".slogan-effect-enter{opacity:0;}.slogagn-effect-enter-active{animation:", " 0.2s;animation-delay:300ms;}.slogan-effect-exit-active{animation:", " 0.2s;animation-delay:300ms;}.slogan-effect-exit-done{opacity:0;}"], _animations["default"].changeOpacity('0', '1'), _animations["default"].changeOpacity('1', '0'));
89
103
  var channelSlideIn = /*#__PURE__*/(0, _styledComponents.keyframes)(["from{transform:translateY(", "px);opacity:0;}to{transform:translateY(0);opacity:1;}"], -CHANNEL_HEIGHT);
90
104
  var channelSlideOut = /*#__PURE__*/(0, _styledComponents.keyframes)(["from{transform:translateY(0);}to{transform:translateY(", "px);}"], -CHANNEL_HEIGHT);
91
- var ChannelEffect = /*#__PURE__*/(0, _styledComponents.css)([".channel-effect-enter{opacity:0;}.channel-effect-enter-active{animation:", " 0.2s linear;animation-delay:500ms;}.channel-effect-exit-active{animation:", " 0.2s linear;animation-delay:100ms;}"], channelSlideIn, channelSlideOut);
92
- var LogoEffect = /*#__PURE__*/(0, _styledComponents.css)([".logo-effect-enter{width:80%;}.logo-effect-enter-active{animation:", " 0.3s linear;animation-delay:400ms;}.logo-effect-exit-active{animation:", " 0.3s linear;animation-delay:400ms;}.logo-effect-exit-done{width:80%;}"], _animations["default"].changeWidth('80%', '100%'), _animations["default"].changeWidth('100%', '80%'));
105
+ var ChannelEffect = /*#__PURE__*/(0, _styledComponents.css)([".channel-effect-enter{opacity:0;}.channel-effect-enter-active{animation:", " 0.2s linear;animation-delay:400ms;}.channel-effect-exit-active{animation:", " 0.1s linear;animation-delay:100ms;}"], channelSlideIn, channelSlideOut);
106
+ var LogoEffect = /*#__PURE__*/(0, _styledComponents.css)([".logo-effect-enter{width:80%;}.logo-effect-enter-active{animation:", " 0.2s linear;animation-delay:300ms;}.logo-effect-exit-active{animation:", " 0.2s linear;animation-delay:300ms;}.logo-effect-exit-done{width:80%;}"], _animations["default"].changeWidth('80%', '100%'), _animations["default"].changeWidth('100%', '80%'));
93
107
 
94
108
  var Box = /*#__PURE__*/_styledComponents["default"].div.withConfig({
95
109
  displayName: "header__Box",
96
110
  componentId: "sc-1krza7i-0"
97
- })(["transform:translateY(", ");transition:transform 0.3s linear;background-color:", ";box-sizing:border-box;position:relative;width:100%;display:flex;flex-direction:column;align-items:center;a:link,a:visited,a:hover,a:active{text-decoration:none;}", ""], function (props) {
111
+ })(["transform:translateY( ", " );transition:transform 0.3s linear;background-color:", ";box-sizing:border-box;position:relative;width:100%;display:flex;flex-direction:column;align-items:center;a:link,a:visited,a:hover,a:active{text-decoration:none;}", ""], function (props) {
98
112
  return props.isHide ? "".concat(-styles.headerHeight.narrow, "px") : 0;
99
113
  }, function (props) {
100
114
  return props.bgColor;
@@ -132,10 +146,17 @@ var ActionContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
132
146
  componentId: "sc-1krza7i-6"
133
147
  })(["", " ", ""], FlexItem, ActionEffect);
134
148
 
149
+ var IconContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
150
+ displayName: "header__IconContainer",
151
+ componentId: "sc-1krza7i-7"
152
+ })(["", " height:", "px;margin:0;padding-left:14px;border-color:#e2e2e2;border-style:solid;border-width:", ";transition:border-width 0.1s linear 0.2s;"], FlexItem, styles.headerHeight.narrow, function (props) {
153
+ return (0, _css.arrayToCssShorthand)(styles.iconBorderWidth[props.headerType]);
154
+ });
155
+
135
156
  var ChannelTopContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
136
157
  displayName: "header__ChannelTopContainer",
137
- componentId: "sc-1krza7i-7"
138
- })(["position:absolute;width:calc(100% - 530px);min-width:480px;max-width:910px;right:calc(50% - 540px);", " ", ""], FlexItem, ChannelEffect);
158
+ componentId: "sc-1krza7i-8"
159
+ })(["position:absolute;width:calc(100% - 530px);min-width:480px;max-width:910px;height:", "px;right:186px;", " ", " ", ""], styles.headerHeight.narrow, FlexItem, ChannelEffect, _mediaQuery["default"].hdOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n right: calc(50% - 540px);\n "]))));
139
160
 
140
161
  var Header = function Header(_ref) {
141
162
  var pathname = _ref.pathname,
@@ -168,24 +189,24 @@ var Header = function Header(_ref) {
168
189
  classNames: "header-effect",
169
190
  timeout: {
170
191
  appear: 0,
171
- enter: 700,
172
- exit: 700
192
+ enter: 500,
193
+ exit: 500
173
194
  }
174
195
  }, /*#__PURE__*/_react["default"].createElement(TopRow, null, /*#__PURE__*/_react["default"].createElement(FlexGroup, null, /*#__PURE__*/_react["default"].createElement(LogoContainer, null, /*#__PURE__*/_react["default"].createElement(_customizedLink["default"], _links["default"].getLogoLink(isLinkExternal, releaseBranch), /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
175
196
  "in": !toUseNarrow,
176
197
  classNames: "logo-effect",
177
198
  timeout: {
178
199
  appear: 0,
179
- enter: 700,
180
- exit: 700
200
+ enter: 500,
201
+ exit: 500
181
202
  }
182
203
  }, /*#__PURE__*/_react["default"].createElement(Logo, null)))), /*#__PURE__*/_react["default"].createElement(ActionContainer, null, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
183
204
  "in": !toUseNarrow,
184
205
  classNames: "action-effect",
185
206
  timeout: {
186
207
  appear: 0,
187
- enter: 700,
188
- exit: 700
208
+ enter: 500,
209
+ exit: 500
189
210
  }
190
211
  }, /*#__PURE__*/_react["default"].createElement(_actionButton["default"], {
191
212
  actions: toUseNarrow ? narrowActions : actions
@@ -194,31 +215,34 @@ var Header = function Header(_ref) {
194
215
  classNames: "slogan-effect",
195
216
  timeout: {
196
217
  appear: 0,
197
- enter: 700,
198
- exit: 700
218
+ enter: 500,
219
+ exit: 500
199
220
  }
200
221
  }, /*#__PURE__*/_react["default"].createElement(_slogan["default"], null)))), /*#__PURE__*/_react["default"].createElement(ChannelTopContainer, null, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
201
222
  "in": toUseNarrow,
202
223
  classNames: "channel-effect",
203
224
  timeout: {
204
225
  appear: 0,
205
- enter: 700,
206
- exit: 300
226
+ enter: 600,
227
+ exit: 200
207
228
  },
208
229
  unmountOnExit: true
209
230
  }, /*#__PURE__*/_react["default"].createElement(_channels["default"], {
210
231
  currentPathname: currentPathname,
211
232
  data: channels,
233
+ borderWidth: styles.channelTopBorderWidth,
212
234
  callback: setPathname
213
- }))), /*#__PURE__*/_react["default"].createElement(_icons["default"], {
235
+ }))), /*#__PURE__*/_react["default"].createElement(IconContainer, {
236
+ headerType: toUseNarrow ? 'narrow' : 'wide'
237
+ }, /*#__PURE__*/_react["default"].createElement(_icons["default"], {
214
238
  services: services
215
- }))), /*#__PURE__*/_react["default"].createElement(ChannelContainer, null, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
239
+ })))), /*#__PURE__*/_react["default"].createElement(ChannelContainer, null, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
216
240
  "in": !toUseNarrow,
217
241
  classNames: "channel-effect",
218
242
  timeout: {
219
243
  appear: 0,
220
- enter: 700,
221
- exit: 300
244
+ enter: 600,
245
+ exit: 200
222
246
  },
223
247
  unmountOnExit: true
224
248
  }, /*#__PURE__*/_react["default"].createElement(_channels["default"], {
@@ -32,9 +32,9 @@ var style = {
32
32
  var SloganContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
33
33
  displayName: "slogan__SloganContainer",
34
34
  componentId: "sc-1eoofl8-0"
35
- })(["color:", ";font-size:", ";font-family:Noto Serif TC;display:flex;align-items:center;"], function (props) {
35
+ })(["color:", ";font-size:", ";font-family:", ";display:flex;align-items:center;"], function (props) {
36
36
  return props.color || _colors["default"].grayDark;
37
- }, style.fontSize.desktop);
37
+ }, style.fontSize.desktop, _fonts["default"].family.serif);
38
38
 
39
39
  var Slogan = function Slogan(_ref) {
40
40
  var themeFunction = _ref.themeFunction;
@@ -27,6 +27,9 @@ var _default = {
27
27
  normal: '300',
28
28
  medium: '500',
29
29
  bold: '700'
30
+ },
31
+ family: {
32
+ serif: 'source-han-serif-tc,serif'
30
33
  }
31
34
  };
32
35
  exports["default"] = _default;
@@ -91,9 +91,9 @@ var _ = {
91
91
  throttle: _throttle["default"]
92
92
  };
93
93
  var HIDE_HEADER_THRESHOLD = 46;
94
- var TRANSFORM_HEADER_THRESHOLD = 20;
94
+ var TRANSFORM_HEADER_THRESHOLD = 40;
95
95
  var TRANSFORM_TIMEOUT = 800;
96
- var stickyTop = /*#__PURE__*/(0, _styledComponents.css)(["position:sticky;top:0;z-index:999;"]);
96
+ var stickyTop = /*#__PURE__*/(0, _styledComponents.css)(["position:sticky;top:0;z-index:1000;"]);
97
97
 
98
98
  var MobileOnly = /*#__PURE__*/_styledComponents["default"].div.withConfig({
99
99
  displayName: "header__MobileOnly",
@@ -168,14 +168,13 @@ var Container = /*#__PURE__*/function (_React$PureComponent) {
168
168
  var _this2 = this;
169
169
 
170
170
  var isCurrentNarrow = this.state.toUseNarrow;
171
+ var nextToUseNarrow = scrollTop > TRANSFORM_HEADER_THRESHOLD;
171
172
  var scrollState = {};
172
173
 
173
174
  if (this.isTransforming) {
174
175
  return scrollState;
175
176
  }
176
177
 
177
- scrollState.toUseNarrow = scrollTop > TRANSFORM_HEADER_THRESHOLD;
178
-
179
178
  if (scrollDirection === 'up') {
180
179
  this.readyY = scrollTop;
181
180
  scrollState.hideHeader = false;
@@ -186,6 +185,14 @@ var Container = /*#__PURE__*/function (_React$PureComponent) {
186
185
  if (isCurrentNarrow && scrollTop - this.readyY > HIDE_HEADER_THRESHOLD) {
187
186
  scrollState.hideHeader = true;
188
187
  }
188
+ }
189
+
190
+ if (isCurrentNarrow) {
191
+ // after transforming to narrow header, always remain narrow when scroll down
192
+ scrollState.toUseNarrow = scrollDirection === 'down' ? true : nextToUseNarrow;
193
+ } else {
194
+ // after transfroming to wide header, always remain wide when scroll up
195
+ scrollState.toUseNarrow = scrollDirection === 'up' ? false : nextToUseNarrow;
189
196
  } // register transform timer to mark header transform status
190
197
 
191
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twreporter/universal-header",
3
- "version": "2.2.0-rc.7",
3
+ "version": "2.2.0-rc.8",
4
4
  "description": "Universal header of TWReporter sites",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -19,7 +19,7 @@
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
21
  "@twreporter/core": "^1.2.1",
22
- "@twreporter/react-components": "8.5.0-rc.0",
22
+ "@twreporter/react-components": "^8.5.0-rc.1",
23
23
  "lodash": "^4.17.11",
24
24
  "prop-types": "^15.6.2",
25
25
  "querystring": "^0.2.0",
@@ -34,5 +34,5 @@
34
34
  "files": [
35
35
  "lib"
36
36
  ],
37
- "gitHead": "f3fdc229621bd493f3d04013258b9f0e4f42893a"
37
+ "gitHead": "62a706e2369ff578eecd86c24aa5549516227c22"
38
38
  }