@twreporter/universal-header 2.3.0 → 2.4.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/lib/components/action-button-old.js +5 -5
  3. package/lib/components/action-button.js +8 -5
  4. package/lib/components/channels-old.js +8 -8
  5. package/lib/components/channels.js +17 -5
  6. package/lib/components/drop-down-menu.js +2 -2
  7. package/lib/components/hamburger-footer.js +156 -0
  8. package/lib/components/hamburger-footer.stories.js +75 -0
  9. package/lib/components/hamburger-icons.js +11 -11
  10. package/lib/components/hamburger-menu-item.js +174 -0
  11. package/lib/components/hamburger-menu-item.stories.js +150 -0
  12. package/lib/components/hamburger-menu-old.js +148 -0
  13. package/lib/components/hamburger-menu.js +309 -96
  14. package/lib/components/hamburger-menu.stories.js +64 -0
  15. package/lib/components/header-old.js +5 -5
  16. package/lib/components/header.js +160 -32
  17. package/lib/components/header.stories.js +16 -7
  18. package/lib/components/icons-old.js +9 -9
  19. package/lib/components/icons.js +5 -5
  20. package/lib/components/mobile-header.js +12 -12
  21. package/lib/components/search-box.js +2 -2
  22. package/lib/components/slogan-old.js +2 -2
  23. package/lib/components/slogan.js +1 -1
  24. package/lib/constants/actions.js +5 -11
  25. package/lib/constants/channels-old.js +41 -0
  26. package/lib/constants/channels.js +58 -25
  27. package/lib/constants/external-links.js +7 -1
  28. package/lib/constants/footer.js +24 -0
  29. package/lib/constants/hamburger-menu.js +13 -0
  30. package/lib/constants/prop-types-old.js +46 -0
  31. package/lib/constants/prop-types.js +26 -20
  32. package/lib/constants/social-media.js +16 -0
  33. package/lib/containers/header-old.js +11 -11
  34. package/lib/containers/header.js +23 -44
  35. package/lib/contexts/header-context.js +6 -7
  36. package/lib/standalone-header.js +7 -7
  37. package/lib/utils/links-old.js +177 -0
  38. package/lib/utils/links.js +60 -66
  39. package/lib/utils/theme-old.js +345 -0
  40. package/lib/utils/theme.js +49 -243
  41. package/package.json +4 -4
@@ -3,19 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports.selectSloganThemeNew = void 0;
7
-
8
- var _colors = _interopRequireDefault(require("../constants/colors"));
6
+ exports.selectHamburgerMenuTheme = exports.selectHamburgerItemTheme = exports.selectHamburgerFooterTheme = exports.selectSloganTheme = exports.selectHeaderTheme = exports.selectLogoType = void 0;
9
7
 
10
8
  var _theme = _interopRequireDefault(require("../constants/theme"));
11
9
 
12
- var _icon = require("./icon");
13
-
14
10
  var _color = require("@twreporter/core/lib/constants/color");
15
11
 
16
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
13
 
18
- function selectLogoType(theme) {
14
+ var selectLogoType = function selectLogoType(theme) {
19
15
  switch (theme) {
20
16
  case _theme["default"].photography:
21
17
  case _theme["default"].transparent:
@@ -28,88 +24,25 @@ function selectLogoType(theme) {
28
24
  return 'default';
29
25
  }
30
26
  }
31
- }
32
-
33
- function selectServiceIcons(theme) {
34
- switch (theme) {
35
- case _theme["default"].photography:
36
- {
37
- return _icon.ServiceIcons.photography;
38
- }
39
-
40
- case _theme["default"].transparent:
41
- {
42
- return _icon.ServiceIcons.transparent;
43
- }
44
-
45
- case _theme["default"].index:
46
- case _theme["default"].normal:
47
- default:
48
- {
49
- return _icon.ServiceIcons.normal;
50
- }
51
- }
52
- }
53
-
54
- function selectHamburgerServiceIcons(theme) {
55
- switch (theme) {
56
- case _theme["default"].photography:
57
- {
58
- return _icon.ServiceIcons.photography;
59
- }
60
-
61
- case _theme["default"].transparent:
62
- case _theme["default"].index:
63
- case _theme["default"].normal:
64
- default:
65
- {
66
- return _icon.ServiceIcons.normal;
67
- }
68
- }
69
- }
70
-
71
- function selectIcons(theme) {
72
- switch (theme) {
73
- case _theme["default"].photography:
74
- {
75
- return _icon.Icons.photography;
76
- }
77
-
78
- case _theme["default"].transparent:
79
- {
80
- return _icon.Icons.transparent;
81
- }
27
+ };
82
28
 
83
- case _theme["default"].index:
84
- case _theme["default"].normal:
85
- default:
86
- {
87
- return _icon.Icons.normal;
88
- }
89
- }
90
- }
29
+ exports.selectLogoType = selectLogoType;
91
30
 
92
- function selectChannelTheme(theme) {
31
+ var selectHeaderTheme = function selectHeaderTheme(theme) {
93
32
  switch (theme) {
94
33
  case _theme["default"].photography:
95
34
  {
96
35
  return {
97
36
  bgColor: _color.colorPhoto.dark,
98
- fontColor: _color.colorGrayscale.gray600,
99
- hoverFontColor: _color.colorGrayscale.white,
100
- hoverBgColor: _colors["default"].gray50,
101
- borderColor: _colors["default"].gray250
37
+ topRowBgColor: _color.colorPhoto.dark
102
38
  };
103
39
  }
104
40
 
105
41
  case _theme["default"].transparent:
106
42
  {
107
43
  return {
108
- bgColor: 'transparent',
109
- fontColor: _color.colorGrayscale.white,
110
- hoverFontColor: _color.colorGrayscale.gray900,
111
- hoverBgColor: _color.colorGrayscale.white,
112
- borderColor: _colors["default"].gray250
44
+ bgColor: _color.colorOpacity['black_0.2'],
45
+ topRowBgColor: 'unset'
113
46
  };
114
47
  }
115
48
 
@@ -117,10 +50,7 @@ function selectChannelTheme(theme) {
117
50
  {
118
51
  return {
119
52
  bgColor: _color.colorGrayscale.white,
120
- fontColor: _color.colorGrayscale.gray600,
121
- hoverFontColor: _color.colorGrayscale.gray900,
122
- hoverBgColor: _colors["default"].gray150,
123
- borderColor: _color.colorGrayscale.gray200
53
+ topRowBgColor: _color.colorGrayscale.white
124
54
  };
125
55
  }
126
56
 
@@ -129,91 +59,72 @@ function selectChannelTheme(theme) {
129
59
  {
130
60
  return {
131
61
  bgColor: _color.colorGrayscale.gray100,
132
- fontColor: _color.colorGrayscale.gray600,
133
- hoverFontColor: _color.colorGrayscale.gray900,
134
- hoverBgColor: _colors["default"].gray150,
135
- borderColor: _color.colorGrayscale.gray200
62
+ topRowBgColor: _color.colorGrayscale.gray100
136
63
  };
137
64
  }
138
65
  }
139
- }
66
+ };
67
+
68
+ exports.selectHeaderTheme = selectHeaderTheme;
140
69
 
141
- function selectHeaderTheme(theme) {
70
+ var selectSloganTheme = function selectSloganTheme(theme) {
142
71
  switch (theme) {
143
72
  case _theme["default"].photography:
144
- {
145
- return {
146
- bgColor: _color.colorPhoto.dark,
147
- borderColor: _colors["default"].gray250
148
- };
149
- }
150
-
151
73
  case _theme["default"].transparent:
152
74
  {
153
- return {
154
- bgColor: _colors["default"].gray150,
155
- borderColor: _colors["default"].gray250
156
- };
75
+ return _color.colorGrayscale.white;
157
76
  }
158
77
 
159
78
  case _theme["default"].index:
160
- {
161
- return {
162
- bgColor: _color.colorGrayscale.white,
163
- borderColor: _color.colorGrayscale.gray200
164
- };
165
- }
166
-
167
79
  case _theme["default"].normal:
168
80
  default:
169
81
  {
170
- return {
171
- bgColor: _color.colorGrayscale.gray100,
172
- borderColor: _color.colorGrayscale.gray200
173
- };
82
+ return _color.colorGrayscale.gray800;
174
83
  }
175
84
  }
176
- }
85
+ };
177
86
 
178
- function selectActionButtonTheme(theme) {
87
+ exports.selectSloganTheme = selectSloganTheme;
88
+
89
+ var selectHamburgerFooterTheme = function selectHamburgerFooterTheme(theme) {
179
90
  switch (theme) {
180
91
  case _theme["default"].photography:
181
92
  {
182
93
  return {
183
- color: _color.colorGrayscale.white,
184
- bgColor: _color.colorSupportive.main,
185
- hoverBgColor: _colors["default"].brownDark
94
+ color: _color.colorGrayscale.gray400,
95
+ hoverColor: _color.colorGrayscale.gray400,
96
+ hoverBgColor: _color.colorOpacity['white_0.2'],
97
+ activeColor: _color.colorGrayscale.gray400,
98
+ activeBgColor: _color.colorOpacity['white_0.5']
186
99
  };
187
100
  }
188
101
 
189
102
  case _theme["default"].transparent:
190
- {
191
- return {
192
- color: _color.colorSupportive.main,
193
- bgColor: _color.colorGrayscale.white,
194
- hoverBgColor: _color.colorGrayscale.gray300
195
- };
196
- }
197
-
198
103
  case _theme["default"].index:
199
104
  case _theme["default"].normal:
200
105
  default:
201
106
  {
202
107
  return {
203
- color: _color.colorGrayscale.white,
204
- bgColor: _color.colorBrand.heavy,
205
- hoverBgColor: _colors["default"].redDark
108
+ color: _color.colorGrayscale.gray600,
109
+ hoverColor: _color.colorGrayscale.gray800,
110
+ hoverBgColor: _color.colorGrayscale.gray100,
111
+ activeColor: _color.colorGrayscale.gray800,
112
+ activeBgColor: _color.colorGrayscale.gray200
206
113
  };
207
114
  }
208
115
  }
209
- }
116
+ };
117
+
118
+ exports.selectHamburgerFooterTheme = selectHamburgerFooterTheme;
210
119
 
211
- function selectHamburgerMenuTheme(theme) {
120
+ var selectHamburgerItemTheme = function selectHamburgerItemTheme(theme, active) {
212
121
  switch (theme) {
213
122
  case _theme["default"].photography:
214
123
  {
215
124
  return {
216
- bgColor: _color.colorPhoto.dark
125
+ color: active ? _color.colorSupportive.main : _color.colorGrayscale.white,
126
+ hoverBgColor: _color.colorOpacity['white_0.2'],
127
+ activeBgColor: _color.colorOpacity['white_0.5']
217
128
  };
218
129
  }
219
130
 
@@ -223,18 +134,23 @@ function selectHamburgerMenuTheme(theme) {
223
134
  default:
224
135
  {
225
136
  return {
226
- bgColor: _color.colorGrayscale.gray100
137
+ color: active ? _color.colorBrand.heavy : _color.colorGrayscale.gray800,
138
+ hoverBgColor: _color.colorGrayscale.gray100,
139
+ activeBgColor: _color.colorGrayscale.gray200
227
140
  };
228
141
  }
229
142
  }
230
- }
143
+ };
144
+
145
+ exports.selectHamburgerItemTheme = selectHamburgerItemTheme;
231
146
 
232
- function selectHamburgerServiceTheme(theme) {
147
+ var selectHamburgerMenuTheme = function selectHamburgerMenuTheme(theme) {
233
148
  switch (theme) {
234
149
  case _theme["default"].photography:
235
150
  {
236
151
  return {
237
- borderColor: _colors["default"].gray450
152
+ bgColor: _color.colorPhoto.dark,
153
+ scrollBarColor: _color.colorOpacity['white_0.8']
238
154
  };
239
155
  }
240
156
 
@@ -244,121 +160,11 @@ function selectHamburgerServiceTheme(theme) {
244
160
  default:
245
161
  {
246
162
  return {
247
- borderColor: _colors["default"].gray250
163
+ bgColor: _color.colorGrayscale.white,
164
+ scrollBarColor: _color.colorOpacity['black_0.2']
248
165
  };
249
166
  }
250
167
  }
251
- }
252
-
253
- var selectSloganThemeNew = function selectSloganThemeNew(theme) {
254
- switch (theme) {
255
- case _theme["default"].photography:
256
- case _theme["default"].transparent:
257
- {
258
- return _color.colorGrayscale.white;
259
- }
260
-
261
- case _theme["default"].index:
262
- case _theme["default"].normal:
263
- default:
264
- {
265
- return _color.colorGrayscale.gray800;
266
- }
267
- }
268
168
  };
269
169
 
270
- exports.selectSloganThemeNew = selectSloganThemeNew;
271
-
272
- function selectSloganTheme(theme) {
273
- switch (theme) {
274
- case _theme["default"].photography:
275
- {
276
- return _color.colorSupportive.main;
277
- }
278
-
279
- case _theme["default"].transparent:
280
- {
281
- return _color.colorGrayscale.white;
282
- }
283
-
284
- case _theme["default"].index:
285
- case _theme["default"].normal:
286
- default:
287
- {
288
- return _color.colorGrayscale.gray900;
289
- }
290
- }
291
- }
292
- /*
293
- * HB is the abbreviation of hamburger.
294
- * The HB series of theme functions are used in hamburger menu.
295
- */
296
-
297
-
298
- function selectActionButtonHBTheme(theme) {
299
- switch (theme) {
300
- case _theme["default"].transparent:
301
- {
302
- return selectActionButtonTheme('normal');
303
- }
304
-
305
- case _theme["default"].photography:
306
- case _theme["default"].index:
307
- case _theme["default"].normal:
308
- default:
309
- {
310
- return selectActionButtonTheme(theme);
311
- }
312
- }
313
- }
314
-
315
- function selectChannelHBTheme(theme) {
316
- switch (theme) {
317
- case _theme["default"].transparent:
318
- {
319
- return selectChannelTheme('normal');
320
- }
321
-
322
- case _theme["default"].photography:
323
- case _theme["default"].index:
324
- case _theme["default"].normal:
325
- default:
326
- {
327
- return selectChannelTheme(theme);
328
- }
329
- }
330
- }
331
-
332
- function selectSloganHBTheme(theme) {
333
- switch (theme) {
334
- case _theme["default"].transparent:
335
- {
336
- return selectSloganTheme('normal');
337
- }
338
-
339
- case _theme["default"].photography:
340
- case _theme["default"].index:
341
- case _theme["default"].normal:
342
- default:
343
- {
344
- return selectSloganTheme(theme);
345
- }
346
- }
347
- }
348
-
349
- var _default = {
350
- selectLogoType: selectLogoType,
351
- selectServiceIcons: selectServiceIcons,
352
- selectHamburgerServiceIcons: selectHamburgerServiceIcons,
353
- selectIcons: selectIcons,
354
- selectHeaderTheme: selectHeaderTheme,
355
- selectChannelTheme: selectChannelTheme,
356
- selectActionButtonTheme: selectActionButtonTheme,
357
- selectSloganTheme: selectSloganTheme,
358
- selectChannelHBTheme: selectChannelHBTheme,
359
- selectActionButtonHBTheme: selectActionButtonHBTheme,
360
- selectSloganHBTheme: selectSloganHBTheme,
361
- selectHamburgerMenuTheme: selectHamburgerMenuTheme,
362
- selectHamburgerServiceTheme: selectHamburgerServiceTheme
363
- };
364
- exports["default"] = _default;
170
+ exports.selectHamburgerMenuTheme = selectHamburgerMenuTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twreporter/universal-header",
3
- "version": "2.3.0",
3
+ "version": "2.4.0-rc.0",
4
4
  "description": "Universal header of TWReporter sites",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -20,8 +20,8 @@
20
20
  ],
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@twreporter/core": "^1.7.0",
24
- "@twreporter/react-components": "^8.14.0",
23
+ "@twreporter/core": "^1.8.0-rc.0",
24
+ "@twreporter/react-components": "^8.15.0-rc.0",
25
25
  "lodash": "^4.17.11",
26
26
  "prop-types": "^15.6.2",
27
27
  "querystring": "^0.2.0",
@@ -48,5 +48,5 @@
48
48
  "@storybook/testing-library": "^0.0.13",
49
49
  "babel-loader": "^8.2.5"
50
50
  },
51
- "gitHead": "7c69d3797214348fb441596bd4c78788010c8fe5"
51
+ "gitHead": "18f6387366e10e692e08e5356f69409d3535c1b6"
52
52
  }