@twreporter/universal-header 2.2.0-rc.8 → 2.2.0-rc.9
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 +12 -0
- package/lib/components/drop-down-menu.js +16 -2
- package/lib/components/header.js +18 -7
- package/lib/components/mobile-header.js +6 -5
- package/lib/utils/theme.js +18 -6
- package/package.json +2 -2
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.9](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/universal-header@2.2.0-rc.8...@twreporter/universal-header@2.2.0-rc.9) (2021-10-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **universal-header:** fix tablet slogan animation delay & duration ([50027da](https://github.com/twreporter/twreporter-npm-packages/commit/50027da20ea34bfc656412803d6b772d25e7f3d7))
|
|
12
|
+
* **universal-header:** fix ui defect ([8d8c20a](https://github.com/twreporter/twreporter-npm-packages/commit/8d8c20a558f4bdcf4f76480125bd0b2426ed53be))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [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
19
|
|
|
8
20
|
|
|
@@ -21,10 +21,14 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
21
21
|
|
|
22
22
|
var _propTypes2 = _interopRequireDefault(require("../constants/prop-types"));
|
|
23
23
|
|
|
24
|
+
var _mediaQuery = _interopRequireDefault(require("@twreporter/core/lib/utils/media-query"));
|
|
25
|
+
|
|
24
26
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
25
27
|
|
|
26
28
|
var _map = _interopRequireDefault(require("lodash/map"));
|
|
27
29
|
|
|
30
|
+
var _templateObject;
|
|
31
|
+
|
|
28
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
33
|
|
|
30
34
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -51,10 +55,20 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
51
55
|
|
|
52
56
|
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; }
|
|
53
57
|
|
|
58
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
59
|
+
|
|
54
60
|
var _ = {
|
|
55
61
|
get: _get["default"],
|
|
56
62
|
map: _map["default"]
|
|
57
63
|
};
|
|
64
|
+
var styles = {
|
|
65
|
+
subMenuHeight: {
|
|
66
|
+
mobile: 58,
|
|
67
|
+
// px
|
|
68
|
+
desktop: 46 // px
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
};
|
|
58
72
|
|
|
59
73
|
var ViewPort = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
60
74
|
displayName: "drop-down-menu__ViewPort",
|
|
@@ -74,12 +88,12 @@ var MenuContent = /*#__PURE__*/_styledComponents["default"].ul.withConfig({
|
|
|
74
88
|
var SubMenuBox = /*#__PURE__*/_styledComponents["default"].li.withConfig({
|
|
75
89
|
displayName: "drop-down-menu__SubMenuBox",
|
|
76
90
|
componentId: "sc-8es5ea-3"
|
|
77
|
-
})(["display:flex;box-sizing:border-box;white-space:nowrap;position:relative;margin:0;border-bottom:1px solid #e2e2e2;width:100%;a,a:link,a:visited{width:100%;border:0;color:#808080;&:hover{color:", ";background-color:rgba(0,0,0,0.1);}}"], _colors["default"].grayDark);
|
|
91
|
+
})(["display:flex;box-sizing:border-box;white-space:nowrap;position:relative;margin:0;border-bottom:1px solid #e2e2e2;width:100%;height:", "px;", " a,a:link,a:visited{width:100%;border:0;color:#808080;&:hover{color:", ";background-color:rgba(0,0,0,0.1);}}"], styles.subMenuHeight.mobile, _mediaQuery["default"].desktopAndAbove(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n "])), styles.subMenuHeight.desktop), _colors["default"].grayDark);
|
|
78
92
|
|
|
79
93
|
var SubMenuContent = /*#__PURE__*/_styledComponents["default"].span.withConfig({
|
|
80
94
|
displayName: "drop-down-menu__SubMenuContent",
|
|
81
95
|
componentId: "sc-8es5ea-4"
|
|
82
|
-
})(["font-size:", ";font-weight:", ";cursor:pointer;"], _fonts["default"].size.base, _fonts["default"].weight.
|
|
96
|
+
})(["font-size:", ";font-weight:", ";cursor:pointer;"], _fonts["default"].size.base, _fonts["default"].weight.bold);
|
|
83
97
|
|
|
84
98
|
var DropDownMenu = /*#__PURE__*/function (_React$PureComponent) {
|
|
85
99
|
_inherits(DropDownMenu, _React$PureComponent);
|
package/lib/components/header.js
CHANGED
|
@@ -90,6 +90,12 @@ var styles = {
|
|
|
90
90
|
// px
|
|
91
91
|
narrow: [0, 0, 1, 0] // px
|
|
92
92
|
|
|
93
|
+
},
|
|
94
|
+
zIndex: {
|
|
95
|
+
topRow: 3,
|
|
96
|
+
channelBottom: 1,
|
|
97
|
+
channelTop: 4,
|
|
98
|
+
actionButton: 5
|
|
93
99
|
}
|
|
94
100
|
};
|
|
95
101
|
|
|
@@ -117,12 +123,12 @@ var Box = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
117
123
|
var TopRow = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
118
124
|
displayName: "header__TopRow",
|
|
119
125
|
componentId: "sc-1krza7i-1"
|
|
120
|
-
})(["height:", "px;padding:", ";max-width:", "px;width:100%;box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;z-index:
|
|
126
|
+
})(["height:", "px;padding:", ";max-width:", "px;width:100%;box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;z-index:", ";"], styles.headerHeight.wide, (0, _css.arrayToCssShorthand)(styles.topRowPadding.desktop), styles.topRowMaxWidth.hd, styles.zIndex.topRow);
|
|
121
127
|
|
|
122
128
|
var ChannelContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
123
129
|
displayName: "header__ChannelContainer",
|
|
124
130
|
componentId: "sc-1krza7i-2"
|
|
125
|
-
})(["width:calc(100% - 120px);max-width:", "px;z-index:
|
|
131
|
+
})(["width:calc(100% - 120px);max-width:", "px;z-index:", ";", ""], styles.channelMaxWidth.hd, styles.zIndex.channelBottom, ChannelEffect);
|
|
126
132
|
|
|
127
133
|
var FlexGroup = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
128
134
|
displayName: "header__FlexGroup",
|
|
@@ -144,19 +150,21 @@ var SloganContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
144
150
|
var ActionContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
145
151
|
displayName: "header__ActionContainer",
|
|
146
152
|
componentId: "sc-1krza7i-6"
|
|
147
|
-
})(["", " ", ""], FlexItem, ActionEffect);
|
|
153
|
+
})(["z-index:", ";", " ", ""], styles.zIndex.actionButton, FlexItem, ActionEffect);
|
|
148
154
|
|
|
149
155
|
var IconContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
150
156
|
displayName: "header__IconContainer",
|
|
151
157
|
componentId: "sc-1krza7i-7"
|
|
152
|
-
})(["", " height:", "px;margin:0;padding-left:14px;border-color
|
|
158
|
+
})(["", " height:", "px;margin:0;padding-left:14px;border-color:", ";border-style:solid;border-width:", ";transition:border-width 0.1s linear 0.2s;"], FlexItem, styles.headerHeight.narrow, function (props) {
|
|
159
|
+
return props.borderColor;
|
|
160
|
+
}, function (props) {
|
|
153
161
|
return (0, _css.arrayToCssShorthand)(styles.iconBorderWidth[props.headerType]);
|
|
154
162
|
});
|
|
155
163
|
|
|
156
164
|
var ChannelTopContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
157
165
|
displayName: "header__ChannelTopContainer",
|
|
158
166
|
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 "]))));
|
|
167
|
+
})(["position:absolute;width:calc(100% - 530px);min-width:480px;max-width:910px;height:", "px;right:186px;z-index:", ";", " ", " ", ""], styles.headerHeight.narrow, styles.zIndex.channelTop, FlexItem, ChannelEffect, _mediaQuery["default"].hdOnly(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n right: calc(50% - 540px);\n "]))));
|
|
160
168
|
|
|
161
169
|
var Header = function Header(_ref) {
|
|
162
170
|
var pathname = _ref.pathname,
|
|
@@ -177,7 +185,9 @@ var Header = function Header(_ref) {
|
|
|
177
185
|
toUseNarrow = _ref2.toUseNarrow,
|
|
178
186
|
hideHeader = _ref2.hideHeader;
|
|
179
187
|
|
|
180
|
-
var
|
|
188
|
+
var _themeUtils$selectHea = _theme["default"].selectHeaderTheme(theme),
|
|
189
|
+
bgColor = _themeUtils$selectHea.bgColor,
|
|
190
|
+
borderColor = _themeUtils$selectHea.borderColor;
|
|
181
191
|
|
|
182
192
|
var Logo = _theme["default"].selectLogoComponent(theme);
|
|
183
193
|
|
|
@@ -233,7 +243,8 @@ var Header = function Header(_ref) {
|
|
|
233
243
|
borderWidth: styles.channelTopBorderWidth,
|
|
234
244
|
callback: setPathname
|
|
235
245
|
}))), /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
236
|
-
headerType: toUseNarrow ? 'narrow' : 'wide'
|
|
246
|
+
headerType: toUseNarrow ? 'narrow' : 'wide',
|
|
247
|
+
borderColor: borderColor
|
|
237
248
|
}, /*#__PURE__*/_react["default"].createElement(_icons["default"], {
|
|
238
249
|
services: services
|
|
239
250
|
})))), /*#__PURE__*/_react["default"].createElement(ChannelContainer, null, /*#__PURE__*/_react["default"].createElement(_CSSTransition["default"], {
|
|
@@ -105,7 +105,7 @@ var styles = {
|
|
|
105
105
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
var SloganEffect = /*#__PURE__*/(0, _styledComponents.css)([".slogan-effect-enter{opacity:0;}.slogagn-effect-enter-active{animation:", " 0.
|
|
108
|
+
var SloganEffect = /*#__PURE__*/(0, _styledComponents.css)([".slogan-effect-enter{opacity:0;}.slogagn-effect-enter-active{animation:", " 0.1s;animation-delay:300ms;}.slogan-effect-exit-active{animation:", " 0.1s;animation-delay:300ms;}.slogan-effect-exit-done{opacity:0;}"], _animations["default"].changeOpacity('0', '1'), _animations["default"].changeOpacity('1', '0'));
|
|
109
109
|
|
|
110
110
|
var TabletOnly = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
111
111
|
displayName: "mobile-header__TabletOnly",
|
|
@@ -115,7 +115,7 @@ var TabletOnly = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
|
115
115
|
var FlexBox = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
116
116
|
displayName: "mobile-header__FlexBox",
|
|
117
117
|
componentId: "sc-1vxvz2u-1"
|
|
118
|
-
})(["transform:translateY(", ");transition:transform 0.3s linear;background-color:", ";display:flex;box-sizing:border-box;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;padding:", ";", ""], function (props) {
|
|
118
|
+
})(["transform:translateY( ", " );transition:transform 0.3s linear;background-color:", ";display:flex;box-sizing:border-box;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;padding:", ";", ""], function (props) {
|
|
119
119
|
return props.isHide ? "".concat(-styles.headerHeight.mobile, "px") : 0;
|
|
120
120
|
}, function (props) {
|
|
121
121
|
return props.bgColor;
|
|
@@ -216,7 +216,8 @@ var MobileHeader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
216
216
|
|
|
217
217
|
var Logo = _theme["default"].selectLogoComponent(theme);
|
|
218
218
|
|
|
219
|
-
var
|
|
219
|
+
var _themeUtils$selectHea = _theme["default"].selectHeaderTheme(theme),
|
|
220
|
+
bgColor = _themeUtils$selectHea.bgColor;
|
|
220
221
|
|
|
221
222
|
var MenuIcon = _theme["default"].selectIcons(theme).menu;
|
|
222
223
|
|
|
@@ -232,8 +233,8 @@ var MobileHeader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
232
233
|
classNames: "slogan-effect",
|
|
233
234
|
timeout: {
|
|
234
235
|
appear: 0,
|
|
235
|
-
enter:
|
|
236
|
-
exit:
|
|
236
|
+
enter: 400,
|
|
237
|
+
exit: 400
|
|
237
238
|
}
|
|
238
239
|
}, /*#__PURE__*/_react["default"].createElement(_slogan["default"], null))))), /*#__PURE__*/_react["default"].createElement(Hamburger, {
|
|
239
240
|
onClick: _this2.handleOnHamburgerClick
|
package/lib/utils/theme.js
CHANGED
|
@@ -220,27 +220,39 @@ function selectChannelTheme(theme) {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function
|
|
223
|
+
function selectHeaderTheme(theme) {
|
|
224
224
|
switch (theme) {
|
|
225
225
|
case _theme["default"].photography:
|
|
226
226
|
{
|
|
227
|
-
return
|
|
227
|
+
return {
|
|
228
|
+
bgColor: _colors["default"].photography,
|
|
229
|
+
borderColor: 'rgba(128, 128, 128, 0.2)'
|
|
230
|
+
};
|
|
228
231
|
}
|
|
229
232
|
|
|
230
233
|
case _theme["default"].transparent:
|
|
231
234
|
{
|
|
232
|
-
return
|
|
235
|
+
return {
|
|
236
|
+
bgColor: 'rgba(0, 0, 0, 0.1)',
|
|
237
|
+
borderColor: 'rgba(128, 128, 128, 0.2)'
|
|
238
|
+
};
|
|
233
239
|
}
|
|
234
240
|
|
|
235
241
|
case _theme["default"].index:
|
|
236
242
|
{
|
|
237
|
-
return
|
|
243
|
+
return {
|
|
244
|
+
bgColor: _colors["default"].white,
|
|
245
|
+
borderColor: _colors["default"].gray
|
|
246
|
+
};
|
|
238
247
|
}
|
|
239
248
|
|
|
240
249
|
case _theme["default"].normal:
|
|
241
250
|
default:
|
|
242
251
|
{
|
|
243
|
-
return
|
|
252
|
+
return {
|
|
253
|
+
bgColor: _colors["default"].grayLight,
|
|
254
|
+
borderColor: _colors["default"].gray
|
|
255
|
+
};
|
|
244
256
|
}
|
|
245
257
|
}
|
|
246
258
|
}
|
|
@@ -398,11 +410,11 @@ function selectSloganHBTheme(theme) {
|
|
|
398
410
|
}
|
|
399
411
|
|
|
400
412
|
var _default = {
|
|
401
|
-
selectBgColor: selectBgColor,
|
|
402
413
|
selectLogoComponent: selectLogoComponent,
|
|
403
414
|
selectServiceIcons: selectServiceIcons,
|
|
404
415
|
selectHamburgerServiceIcons: selectHamburgerServiceIcons,
|
|
405
416
|
selectIcons: selectIcons,
|
|
417
|
+
selectHeaderTheme: selectHeaderTheme,
|
|
406
418
|
selectChannelTheme: selectChannelTheme,
|
|
407
419
|
selectActionButtonTheme: selectActionButtonTheme,
|
|
408
420
|
selectSloganTheme: selectSloganTheme,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/universal-header",
|
|
3
|
-
"version": "2.2.0-rc.
|
|
3
|
+
"version": "2.2.0-rc.9",
|
|
4
4
|
"description": "Universal header of TWReporter sites",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"files": [
|
|
35
35
|
"lib"
|
|
36
36
|
],
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "81aa803c1e1cb4cfa5a858e5d2ba6bb502c4fef3"
|
|
38
38
|
}
|