@internetarchive/ia-topnav 1.3.5-alpha7 → 1.3.6-alpha.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 (84) hide show
  1. package/.eslintrc +16 -16
  2. package/LICENSE +661 -661
  3. package/README.md +147 -147
  4. package/index.d.ts +109 -109
  5. package/index.js +3 -3
  6. package/package.json +61 -61
  7. package/src/assets/img/hamburger.js +38 -38
  8. package/src/assets/img/ia-icon.js +33 -33
  9. package/src/assets/img/icon-audio.js +23 -23
  10. package/src/assets/img/icon-close.js +16 -16
  11. package/src/assets/img/icon-donate-unpadded.js +16 -16
  12. package/src/assets/img/icon-donate.js +15 -15
  13. package/src/assets/img/icon-ellipses.js +15 -15
  14. package/src/assets/img/icon-ia-logo.js +22 -22
  15. package/src/assets/img/icon-images.js +15 -15
  16. package/src/assets/img/icon-search.js +15 -15
  17. package/src/assets/img/icon-software.js +15 -15
  18. package/src/assets/img/icon-texts.js +15 -15
  19. package/src/assets/img/icon-upload-unpadded.js +14 -14
  20. package/src/assets/img/icon-upload.js +15 -15
  21. package/src/assets/img/icon-user.js +15 -15
  22. package/src/assets/img/icon-video.js +15 -15
  23. package/src/assets/img/icon-web.js +15 -15
  24. package/src/assets/img/icon.js +18 -18
  25. package/src/assets/img/icons.js +33 -33
  26. package/src/assets/img/wordmark-stacked.js +13 -13
  27. package/src/data/menus.js +670 -670
  28. package/src/desktop-subnav.js +45 -45
  29. package/src/dropdown-menu.js +109 -110
  30. package/src/ia-topnav.js +314 -315
  31. package/src/lib/formatUrl.js +1 -1
  32. package/src/lib/location-handler.js +5 -5
  33. package/src/lib/query-handler.js +7 -7
  34. package/src/lib/toSentenceCase.js +8 -8
  35. package/src/login-button.js +79 -79
  36. package/src/media-button.js +113 -114
  37. package/src/media-menu.js +133 -133
  38. package/src/media-slider.js +104 -104
  39. package/src/media-subnav.js +112 -112
  40. package/src/more-slider.js +33 -33
  41. package/src/nav-search.js +117 -120
  42. package/src/primary-nav.js +224 -232
  43. package/src/save-page-form.js +59 -59
  44. package/src/search-menu.js +115 -146
  45. package/src/signed-out-dropdown.js +10 -10
  46. package/src/styles/base.js +48 -48
  47. package/src/styles/desktop-subnav.js +37 -37
  48. package/src/styles/dropdown-menu.js +166 -166
  49. package/src/styles/ia-topnav.js +87 -87
  50. package/src/styles/login-button.js +79 -79
  51. package/src/styles/media-button.js +156 -156
  52. package/src/styles/media-menu.js +70 -70
  53. package/src/styles/media-slider.js +81 -81
  54. package/src/styles/media-subnav.js +156 -156
  55. package/src/styles/more-slider.js +15 -15
  56. package/src/styles/nav-search.js +136 -136
  57. package/src/styles/primary-nav.js +300 -300
  58. package/src/styles/save-page-form.js +54 -54
  59. package/src/styles/search-menu.js +99 -104
  60. package/src/styles/signed-out-dropdown.js +31 -31
  61. package/src/styles/user-menu.js +31 -31
  62. package/src/styles/wayback-search.js +48 -48
  63. package/src/styles/wayback-slider.js +30 -30
  64. package/src/tracked-element.js +27 -27
  65. package/src/user-menu.js +42 -42
  66. package/src/wayback-search.js +18 -18
  67. package/src/wayback-slider.js +87 -87
  68. package/test/assets/img/hamburger.test.js +15 -15
  69. package/test/assets/img/user.test.js +15 -15
  70. package/test/data/menus.test.js +19 -19
  71. package/test/dropdown-menu.test.js +25 -25
  72. package/test/ia-icon.test.js +13 -13
  73. package/test/ia-topnav.test.js +273 -273
  74. package/test/login-button.test.js +15 -15
  75. package/test/media-button.test.js +19 -19
  76. package/test/media-menu.test.js +40 -40
  77. package/test/media-slider.test.js +57 -57
  78. package/test/more-slider.test.js +13 -13
  79. package/test/nav-search.test.js +61 -61
  80. package/test/primary-nav.test.js +82 -82
  81. package/test/save-page-form.test.js +35 -35
  82. package/test/search-menu.test.js +49 -49
  83. package/test/user-menu.test.js +33 -33
  84. package/test/wayback-slider.test.js +80 -80
package/src/ia-topnav.js CHANGED
@@ -1,315 +1,314 @@
1
- import { LitElement, html, nothing } from 'https://offshoot.prod.archive.org/lit.js';
2
-
3
- import './primary-nav.js';
4
- import './user-menu.js';
5
- import './search-menu.js';
6
- import './media-slider.js';
7
- import './desktop-subnav.js';
8
- import './dropdown-menu.js';
9
- import './signed-out-dropdown.js';
10
- import iaTopNavCSS from './styles/ia-topnav.js';
11
- import { buildTopNavMenus, defaultTopNavConfig } from './data/menus.js';
12
-
13
- export default class IATopNav extends LitElement {
14
- static get styles() {
15
- return iaTopNavCSS;
16
- }
17
-
18
- // NOTE:
19
- // When adding properties, also add them to index.d.ts in the root `ia-topnav` directory
20
- // so Typescript can find them
21
- static get properties() {
22
- return {
23
- // we default to fully-qualified `https://archive.org` urls in nav, set to false for relatives
24
- localLinks: Boolean,
25
- // @see `data/menus.js` for a description:
26
- waybackPagesArchived: String,
27
- // the base host is for navigation, so may be empty for relative links
28
- baseHost: { type: String },
29
- // the media base host is the base host for images, such as the profile picture
30
- // which may not be hosted locally
31
- mediaBaseHost: { type: String },
32
- /** Whether the user has privs to edit all items */
33
- admin: { type: Boolean },
34
- /** Whether the user has privs to manage item flags */
35
- canManageFlags: { type: Boolean },
36
- config: {
37
- type: Object,
38
- converter(value) {
39
- return JSON.parse(atob(value));
40
- },
41
- },
42
- hideSearch: { type: Boolean },
43
- /** Identifier for the item or collection currently being viewed */
44
- itemIdentifier: { type: String },
45
- mediaSliderOpen: { type: Boolean },
46
- menus: {
47
- type: Object,
48
- converter(value) {
49
- return JSON.parse(atob(value));
50
- },
51
- },
52
- openMenu: { type: String },
53
- screenName: { type: String },
54
- searchIn: { type: String },
55
- searchQuery: {
56
- type: String,
57
- converter(value) {
58
- return atob(value);
59
- },
60
- },
61
- selectedMenuOption: { type: String },
62
- username: { type: String },
63
- userProfileImagePath: { type: String },
64
- secondIdentitySlotMode: { type: String },
65
- };
66
- }
67
-
68
- constructor() {
69
- super();
70
- this.menuSetup();
71
- this.mediaBaseHost = 'https://archive.org';
72
- this.userProfileImagePath = '/services/img/user/profile';
73
- this.config = defaultTopNavConfig;
74
- this.hideSearch = false;
75
- this.mediaSliderOpen = false;
76
- this.openMenu = '';
77
- this.searchIn = '';
78
- this.selectedMenuOption = '';
79
- this.secondIdentitySlotMode = '';
80
- }
81
-
82
- updated(props) {
83
- if (props.has('username') || props.has('localLinks') || props.has('baseHost') ||
84
- props.has('waybackPagesArchived') || props.has('itemIdentifier')) {
85
- this.menuSetup();
86
- }
87
- }
88
-
89
- firstUpdated() {
90
- // close open menu on `esc` click
91
- document.addEventListener('keydown', e => {
92
- if (e.key === 'Escape') this.closeMenus();
93
- }, false);
94
- }
95
-
96
- menuSetup() {
97
- this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
98
- this.username = this.getAttribute('username')
99
- this.screenName = this.getAttribute('screenname');
100
- this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
101
-
102
- // ensure we update other components that use `baseHost`
103
- this.baseHost = this.localLinks ? '' : 'https://archive.org';
104
-
105
- // re/build the nav
106
- this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived, this.itemIdentifier);
107
- }
108
-
109
- menuToggled({ detail }) {
110
- const currentMenu = this.openMenu;
111
- this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
112
- // Keeps media slider open if media menu is open
113
- if (this.openMenu === 'media') {
114
- return;
115
- }
116
- this.closeMediaSlider();
117
- }
118
-
119
- openMediaSlider() {
120
- this.mediaSliderOpen = true;
121
- }
122
-
123
- closeMediaSlider() {
124
- this.mediaSliderOpen = false;
125
- this.selectedMenuOption = '';
126
- }
127
-
128
- closeMenus() {
129
- this.openMenu = '';
130
- this.closeMediaSlider();
131
- }
132
-
133
- searchInChanged(e) {
134
- this.searchIn = e.detail.searchIn;
135
- }
136
-
137
- trackClick({ detail }) {
138
- this.dispatchEvent(new CustomEvent('analyticsClick', {
139
- bubbles: true,
140
- composed: true,
141
- detail,
142
- }));
143
- }
144
-
145
- trackSubmit({ detail }) {
146
- this.dispatchEvent(new CustomEvent('analyticsSubmit', {
147
- bubbles: true,
148
- composed: true,
149
- detail,
150
- }));
151
- }
152
-
153
- mediaTypeSelected({ detail }) {
154
- if (this.selectedMenuOption === detail.mediatype) {
155
- this.closeMediaSlider();
156
- return;
157
- }
158
- this.selectedMenuOption = detail.mediatype;
159
- this.openMediaSlider();
160
- }
161
-
162
- get searchMenuOpened() {
163
- return this.openMenu === 'search';
164
- }
165
-
166
- get signedOutOpened() {
167
- return this.openMenu === 'login';
168
- }
169
-
170
- get userMenuOpened() {
171
- return this.openMenu === 'user';
172
- }
173
-
174
- get searchMenuTabIndex() {
175
- return this.searchMenuOpened ? '' : '-1';
176
- }
177
-
178
- get userMenuTabIndex() {
179
- return this.userMenuOpened ? '' : '-1';
180
- }
181
-
182
- get signedOutTabIndex() {
183
- return this.signedOutOpened ? '' : '-1';
184
- }
185
-
186
- get closeLayerClass() {
187
- return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
188
- }
189
-
190
- get userMenu() {
191
- return html`
192
- <user-menu
193
- .baseHost=${this.baseHost}
194
- .config=${this.config}
195
- .menuItems=${this.userMenuItems}
196
- ?open=${this.openMenu === 'user'}
197
- .username=${this.username}
198
- ?hideSearch=${this.hideSearch}
199
- tabindex="${this.userMenuTabIndex}"
200
- @menuToggled=${this.menuToggled}
201
- @trackClick=${this.trackClick}
202
- ></user-menu>
203
- `;
204
- }
205
-
206
- get signedOutDropdown() {
207
- return html`
208
- <signed-out-dropdown
209
- .baseHost=${this.baseHost}
210
- .config=${this.config}
211
- .open=${this.signedOutOpened}
212
- ?hideSearch=${this.hideSearch}
213
- tabindex="${this.signedOutTabIndex}"
214
- .menuItems=${this.signedOutMenuItems}
215
- ></signed-out-dropdown>
216
- `;
217
- }
218
-
219
- get signedOutMenuItems() {
220
- return this.menus.signedOut;
221
- }
222
-
223
- /**
224
- * Most users just get the basic menu items.
225
- * For users with `/items` priv, additional admin menu items are included too.
226
- * Having the `/flags` priv adds a further admin item for managing flags.
227
- */
228
- get userMenuItems() {
229
- const basicItems = this.menus.user;
230
-
231
- let adminItems = this.menus.userAdmin;
232
- if (this.canManageFlags) {
233
- adminItems = adminItems.concat(this.menus.userAdminFlags);
234
- }
235
-
236
- return this.itemIdentifier && this.admin
237
- ? [basicItems, adminItems]
238
- : basicItems;
239
- }
240
-
241
- get desktopSubnavMenuItems() {
242
- return this.menus.more;
243
- }
244
-
245
- get allowSecondaryIcon() {
246
- return this.secondIdentitySlotMode === 'allow';
247
- }
248
-
249
- get secondLogoSlot() {
250
- return this.allowSecondaryIcon
251
- ? html`
252
- <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
253
- <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
254
- `
255
- : nothing;
256
- }
257
-
258
- get separatorTemplate() {
259
- return html`<li class="divider" role="presentation"></li>`;
260
- }
261
-
262
- render() {
263
- return html`
264
- <div class="topnav">
265
- <primary-nav
266
- .baseHost=${this.baseHost}
267
- .mediaBaseHost=${this.mediaBaseHost}
268
- .config=${this.config}
269
- .openMenu=${this.openMenu}
270
- .screenName=${this.screenName}
271
- .searchIn=${this.searchIn}
272
- .searchQuery=${this.searchQuery}
273
- .secondIdentitySlotMode=${this.secondIdentitySlotMode}
274
- .selectedMenuOption=${this.selectedMenuOption}
275
- .username=${this.username}
276
- .userProfileImagePath=${this.userProfileImagePath}
277
- ?hideSearch=${this.hideSearch}
278
- @mediaTypeSelected=${this.mediaTypeSelected}
279
- @toggleSearchMenu=${this.toggleSearchMenu}
280
- @trackClick=${this.trackClick}
281
- @trackSubmit=${this.trackSubmit}
282
- @menuToggled=${this.menuToggled}
283
- >
284
- ${this.secondLogoSlot}
285
- </primary-nav>
286
- <media-slider
287
- .baseHost=${this.baseHost}
288
- .config=${this.config}
289
- .selectedMenuOption=${this.selectedMenuOption}
290
- .mediaSliderOpen=${this.mediaSliderOpen}
291
- .menus=${this.menus}
292
- ></media-slider>
293
- </div>
294
- ${this.username ? this.userMenu : this.signedOutDropdown}
295
- <search-menu
296
- .baseHost=${this.baseHost}
297
- .config=${this.config}
298
- .openMenu=${this.openMenu}
299
- tabindex="${this.searchMenuTabIndex}"
300
- ?hideSearch=${this.hideSearch}
301
- @searchInChanged=${this.searchInChanged}
302
- @trackClick=${this.trackClick}
303
- @trackSubmit=${this.trackSubmit}
304
- ></search-menu>
305
- <desktop-subnav
306
- .baseHost=${this.baseHost}
307
- .menuItems=${this.desktopSubnavMenuItems}
308
- @focus=${this.closeMenus}
309
- ></desktop-subnav>
310
- <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
311
- `;
312
- }
313
- }
314
-
315
- customElements.define('ia-topnav', IATopNav);
1
+ import { LitElement, html, nothing } from 'https://offshoot.prod.archive.org/lit.js';
2
+
3
+ import './primary-nav.js';
4
+ import './user-menu.js';
5
+ import './search-menu.js';
6
+ import './media-slider.js';
7
+ import './desktop-subnav.js';
8
+ import './dropdown-menu.js';
9
+ import './signed-out-dropdown.js';
10
+ import iaTopNavCSS from './styles/ia-topnav.js';
11
+ import { buildTopNavMenus, defaultTopNavConfig } from './data/menus.js';
12
+
13
+ export default class IATopNav extends LitElement {
14
+ static get styles() {
15
+ return iaTopNavCSS;
16
+ }
17
+
18
+ // NOTE:
19
+ // When adding properties, also add them to index.d.ts in the root `ia-topnav` directory
20
+ // so Typescript can find them
21
+ static get properties() {
22
+ return {
23
+ // we default to fully-qualified `https://archive.org` urls in nav, set to false for relatives
24
+ localLinks: Boolean,
25
+ // @see `data/menus.js` for a description:
26
+ waybackPagesArchived: String,
27
+ // the base host is for navigation, so may be empty for relative links
28
+ baseHost: { type: String },
29
+ // the media base host is the base host for images, such as the profile picture
30
+ // which may not be hosted locally
31
+ mediaBaseHost: { type: String },
32
+ /** Whether the user has privs to edit all items */
33
+ admin: { type: Boolean },
34
+ /** Whether the user has privs to manage item flags */
35
+ canManageFlags: { type: Boolean },
36
+ config: {
37
+ type: Object,
38
+ converter(value) {
39
+ return JSON.parse(atob(value));
40
+ },
41
+ },
42
+ hideSearch: { type: Boolean },
43
+ /** Identifier for the item or collection currently being viewed */
44
+ itemIdentifier: { type: String },
45
+ mediaSliderOpen: { type: Boolean },
46
+ menus: {
47
+ type: Object,
48
+ converter(value) {
49
+ return JSON.parse(atob(value));
50
+ },
51
+ },
52
+ openMenu: { type: String },
53
+ screenName: { type: String },
54
+ searchIn: { type: String },
55
+ searchQuery: {
56
+ type: String,
57
+ converter(value) {
58
+ return atob(value);
59
+ },
60
+ },
61
+ selectedMenuOption: { type: String },
62
+ username: { type: String },
63
+ userProfileImagePath: { type: String },
64
+ secondIdentitySlotMode: { type: String },
65
+ };
66
+ }
67
+
68
+ constructor() {
69
+ super();
70
+ this.menuSetup();
71
+ this.mediaBaseHost = 'https://archive.org';
72
+ this.userProfileImagePath = '/services/img/user/profile';
73
+ this.config = defaultTopNavConfig;
74
+ this.hideSearch = false;
75
+ this.mediaSliderOpen = false;
76
+ this.openMenu = '';
77
+ this.searchIn = '';
78
+ this.selectedMenuOption = '';
79
+ this.secondIdentitySlotMode = '';
80
+ }
81
+
82
+ updated(props) {
83
+ if (props.has('username') || props.has('localLinks') || props.has('baseHost') ||
84
+ props.has('waybackPagesArchived') || props.has('itemIdentifier')) {
85
+ this.menuSetup();
86
+ }
87
+ }
88
+
89
+ firstUpdated() {
90
+ // close open menu on `esc` click
91
+ document.addEventListener('keydown', e => {
92
+ if (e.key === 'Escape') this.closeMenus();
93
+ }, false);
94
+ }
95
+
96
+ menuSetup() {
97
+ this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
98
+ this.username = this.getAttribute('username')
99
+ this.screenName = this.getAttribute('screenname');
100
+ this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
101
+
102
+ // ensure we update other components that use `baseHost`
103
+ this.baseHost = this.localLinks ? '' : 'https://archive.org';
104
+
105
+ // re/build the nav
106
+ this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived, this.itemIdentifier);
107
+ }
108
+
109
+ menuToggled({ detail }) {
110
+ const currentMenu = this.openMenu;
111
+ this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
112
+ // Keeps media slider open if media menu is open
113
+ if (this.openMenu === 'media') {
114
+ return;
115
+ }
116
+ this.closeMediaSlider();
117
+ }
118
+
119
+ openMediaSlider() {
120
+ this.mediaSliderOpen = true;
121
+ }
122
+
123
+ closeMediaSlider() {
124
+ this.mediaSliderOpen = false;
125
+ this.selectedMenuOption = '';
126
+ }
127
+
128
+ closeMenus() {
129
+ this.openMenu = '';
130
+ this.closeMediaSlider();
131
+ }
132
+
133
+ searchInChanged(e) {
134
+ this.searchIn = e.detail.searchIn;
135
+ }
136
+
137
+ trackClick({ detail }) {
138
+ this.dispatchEvent(new CustomEvent('analyticsClick', {
139
+ bubbles: true,
140
+ composed: true,
141
+ detail,
142
+ }));
143
+ }
144
+
145
+ trackSubmit({ detail }) {
146
+ this.dispatchEvent(new CustomEvent('analyticsSubmit', {
147
+ bubbles: true,
148
+ composed: true,
149
+ detail,
150
+ }));
151
+ }
152
+
153
+ mediaTypeSelected({ detail }) {
154
+ if (this.selectedMenuOption === detail.mediatype) {
155
+ this.closeMediaSlider();
156
+ return;
157
+ }
158
+ this.selectedMenuOption = detail.mediatype;
159
+ this.openMediaSlider();
160
+ }
161
+
162
+ get searchMenuOpened() {
163
+ return this.openMenu === 'search';
164
+ }
165
+
166
+ get signedOutOpened() {
167
+ return this.openMenu === 'login';
168
+ }
169
+
170
+ get userMenuOpened() {
171
+ return this.openMenu === 'user';
172
+ }
173
+
174
+ get searchMenuTabIndex() {
175
+ return this.searchMenuOpened ? '' : '-1';
176
+ }
177
+
178
+ get userMenuTabIndex() {
179
+ return this.userMenuOpened ? '' : '-1';
180
+ }
181
+
182
+ get signedOutTabIndex() {
183
+ return this.signedOutOpened ? '' : '-1';
184
+ }
185
+
186
+ get closeLayerClass() {
187
+ return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
188
+ }
189
+
190
+ get userMenu() {
191
+ return html`
192
+ <user-menu
193
+ .baseHost=${this.baseHost}
194
+ .config=${this.config}
195
+ .menuItems=${this.userMenuItems}
196
+ ?open=${this.openMenu === 'user'}
197
+ .username=${this.username}
198
+ ?hideSearch=${this.hideSearch}
199
+ tabindex="${this.userMenuTabIndex}"
200
+ @menuToggled=${this.menuToggled}
201
+ @trackClick=${this.trackClick}
202
+ ></user-menu>
203
+ `;
204
+ }
205
+
206
+ get signedOutDropdown() {
207
+ return html`
208
+ <signed-out-dropdown
209
+ .baseHost=${this.baseHost}
210
+ .config=${this.config}
211
+ .open=${this.signedOutOpened}
212
+ ?hideSearch=${this.hideSearch}
213
+ tabindex="${this.signedOutTabIndex}"
214
+ .menuItems=${this.signedOutMenuItems}
215
+ ></signed-out-dropdown>
216
+ `;
217
+ }
218
+
219
+ get signedOutMenuItems() {
220
+ return this.menus.signedOut;
221
+ }
222
+
223
+ /**
224
+ * Most users just get the basic menu items.
225
+ * For users with `/items` priv, additional admin menu items are included too.
226
+ * Having the `/flags` priv adds a further admin item for managing flags.
227
+ */
228
+ get userMenuItems() {
229
+ const basicItems = this.menus.user;
230
+
231
+ let adminItems = this.menus.userAdmin;
232
+ if (this.canManageFlags) {
233
+ adminItems = adminItems.concat(this.menus.userAdminFlags);
234
+ }
235
+
236
+ return this.itemIdentifier && this.admin
237
+ ? [basicItems, adminItems]
238
+ : basicItems;
239
+ }
240
+
241
+ get desktopSubnavMenuItems() {
242
+ return this.menus.more;
243
+ }
244
+
245
+ get allowSecondaryIcon() {
246
+ return this.secondIdentitySlotMode === 'allow';
247
+ }
248
+
249
+ get secondLogoSlot() {
250
+ return this.allowSecondaryIcon
251
+ ? html`
252
+ <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
253
+ <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
254
+ `
255
+ : nothing;
256
+ }
257
+
258
+ get separatorTemplate() {
259
+ return html`<li class="divider" role="presentation"></li>`;
260
+ }
261
+
262
+ render() {
263
+ return html`
264
+ <div class="topnav">
265
+ <primary-nav
266
+ .baseHost=${this.baseHost}
267
+ .mediaBaseHost=${this.mediaBaseHost}
268
+ .config=${this.config}
269
+ .openMenu=${this.openMenu}
270
+ .screenName=${this.screenName}
271
+ .searchIn=${this.searchIn}
272
+ .searchQuery=${this.searchQuery}
273
+ .secondIdentitySlotMode=${this.secondIdentitySlotMode}
274
+ .selectedMenuOption=${this.selectedMenuOption}
275
+ .username=${this.username}
276
+ .userProfileImagePath=${this.userProfileImagePath}
277
+ ?hideSearch=${this.hideSearch}
278
+ @mediaTypeSelected=${this.mediaTypeSelected}
279
+ @toggleSearchMenu=${this.toggleSearchMenu}
280
+ @trackClick=${this.trackClick}
281
+ @trackSubmit=${this.trackSubmit}
282
+ @menuToggled=${this.menuToggled}
283
+ >
284
+ ${this.secondLogoSlot}
285
+ </primary-nav>
286
+ <media-slider
287
+ .baseHost=${this.baseHost}
288
+ .config=${this.config}
289
+ .selectedMenuOption=${this.selectedMenuOption}
290
+ .mediaSliderOpen=${this.mediaSliderOpen}
291
+ .menus=${this.menus}
292
+ ></media-slider>
293
+ </div>
294
+ ${this.username ? this.userMenu : this.signedOutDropdown}
295
+ <search-menu
296
+ .baseHost=${this.baseHost}
297
+ .config=${this.config}
298
+ .openMenu=${this.openMenu}
299
+ tabindex="${this.searchMenuTabIndex}"
300
+ ?hideSearch=${this.hideSearch}
301
+ @searchInChanged=${this.searchInChanged}
302
+ @trackClick=${this.trackClick}
303
+ @trackSubmit=${this.trackSubmit}
304
+ ></search-menu>
305
+ <desktop-subnav
306
+ .baseHost=${this.baseHost}
307
+ .menuItems=${this.desktopSubnavMenuItems}
308
+ ></desktop-subnav>
309
+ <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
310
+ `;
311
+ }
312
+ }
313
+
314
+ customElements.define('ia-topnav', IATopNav);
@@ -1 +1 @@
1
- export default (url, baseHost) => (/^https?:/.test(url) ? url : `${baseHost}${url}`);
1
+ export default (url, baseHost) => (/^https?:/.test(url) ? url : `${baseHost}${url}`);
@@ -1,5 +1,5 @@
1
- /* istanbul ignore file */
2
-
3
- export default function (url) {
4
- window.location = url;
5
- }
1
+ /* istanbul ignore file */
2
+
3
+ export default function (url) {
4
+ window.location = url;
5
+ }
@@ -1,7 +1,7 @@
1
- /* istanbul ignore file */
2
-
3
- export default {
4
- performQuery(query) {
5
- window.location = `https://web.archive.org/web/*/${query}`;
6
- }
7
- };
1
+ /* istanbul ignore file */
2
+
3
+ export default {
4
+ performQuery(query) {
5
+ window.location = `https://web.archive.org/web/*/${query}`;
6
+ }
7
+ };
@@ -1,8 +1,8 @@
1
- const toSentenceCase = (phrase) => {
2
- const words = phrase.split(' ');
3
- const lastWord = words.pop();
4
- const capitalizedWord = `${lastWord.substr(0, 1).toUpperCase()}${lastWord.substr(1)}`;
5
- return words.length ? toSentenceCase(`${words.join(' ')}${capitalizedWord}`) : capitalizedWord;
6
- };
7
-
8
- export default toSentenceCase;
1
+ const toSentenceCase = (phrase) => {
2
+ const words = phrase.split(' ');
3
+ const lastWord = words.pop();
4
+ const capitalizedWord = `${lastWord.substr(0, 1).toUpperCase()}${lastWord.substr(1)}`;
5
+ return words.length ? toSentenceCase(`${words.join(' ')}${capitalizedWord}`) : capitalizedWord;
6
+ };
7
+
8
+ export default toSentenceCase;