@internetarchive/ia-topnav 1.1.36 → 1.1.37-alpha1

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 (83) 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 +36 -36
  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.js +15 -15
  12. package/src/assets/img/icon-ellipses.js +15 -15
  13. package/src/assets/img/icon-ia-logo.js +24 -24
  14. package/src/assets/img/icon-images.js +15 -15
  15. package/src/assets/img/icon-search.js +15 -15
  16. package/src/assets/img/icon-software.js +15 -15
  17. package/src/assets/img/icon-texts.js +15 -15
  18. package/src/assets/img/icon-upload.js +15 -15
  19. package/src/assets/img/icon-user.js +15 -15
  20. package/src/assets/img/icon-video.js +15 -15
  21. package/src/assets/img/icon-web.js +15 -15
  22. package/src/assets/img/icon.js +18 -18
  23. package/src/assets/img/icons.js +29 -29
  24. package/src/assets/img/user.js +38 -38
  25. package/src/assets/img/wordmark-stacked.js +13 -13
  26. package/src/data/menus.js +669 -669
  27. package/src/desktop-subnav.js +45 -45
  28. package/src/dropdown-menu.js +106 -106
  29. package/src/ia-topnav.js +307 -307
  30. package/src/lib/formatUrl.js +1 -1
  31. package/src/lib/location-handler.js +5 -5
  32. package/src/lib/query-handler.js +7 -7
  33. package/src/lib/toSentenceCase.js +8 -8
  34. package/src/login-button.js +79 -79
  35. package/src/media-button.js +113 -113
  36. package/src/media-menu.js +133 -133
  37. package/src/media-slider.js +104 -104
  38. package/src/media-subnav.js +112 -112
  39. package/src/more-slider.js +33 -33
  40. package/src/nav-search.js +125 -125
  41. package/src/primary-nav.js +215 -215
  42. package/src/save-page-form.js +59 -59
  43. package/src/search-menu.js +115 -115
  44. package/src/signed-out-dropdown.js +10 -10
  45. package/src/styles/base.js +48 -48
  46. package/src/styles/desktop-subnav.js +37 -37
  47. package/src/styles/dropdown-menu.js +150 -150
  48. package/src/styles/ia-topnav.js +88 -88
  49. package/src/styles/login-button.js +70 -70
  50. package/src/styles/media-button.js +153 -153
  51. package/src/styles/media-menu.js +70 -70
  52. package/src/styles/media-slider.js +81 -81
  53. package/src/styles/media-subnav.js +156 -156
  54. package/src/styles/more-slider.js +15 -15
  55. package/src/styles/nav-search.js +134 -134
  56. package/src/styles/primary-nav.js +298 -298
  57. package/src/styles/save-page-form.js +53 -53
  58. package/src/styles/search-menu.js +99 -99
  59. package/src/styles/signed-out-dropdown.js +31 -31
  60. package/src/styles/user-menu.js +31 -31
  61. package/src/styles/wayback-search.js +48 -48
  62. package/src/styles/wayback-slider.js +30 -30
  63. package/src/tracked-element.js +27 -27
  64. package/src/user-menu.js +42 -42
  65. package/src/wayback-search.js +18 -18
  66. package/src/wayback-slider.js +88 -88
  67. package/test/assets/img/hamburger.test.js +15 -15
  68. package/test/assets/img/user.test.js +15 -15
  69. package/test/data/menus.test.js +19 -19
  70. package/test/dropdown-menu.test.js +25 -25
  71. package/test/ia-icon.test.js +13 -13
  72. package/test/ia-topnav.test.js +273 -273
  73. package/test/login-button.test.js +15 -15
  74. package/test/media-button.test.js +19 -19
  75. package/test/media-menu.test.js +40 -40
  76. package/test/media-slider.test.js +57 -57
  77. package/test/more-slider.test.js +13 -13
  78. package/test/nav-search.test.js +61 -61
  79. package/test/primary-nav.test.js +82 -82
  80. package/test/save-page-form.test.js +35 -35
  81. package/test/search-menu.test.js +49 -49
  82. package/test/user-menu.test.js +33 -33
  83. package/test/wayback-slider.test.js +80 -80
package/src/ia-topnav.js CHANGED
@@ -1,307 +1,307 @@
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
- menuSetup() {
90
- this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
91
- this.username = this.getAttribute('username')
92
- this.screenName = this.getAttribute('screenname');
93
- this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
94
-
95
- // ensure we update other components that use `baseHost`
96
- this.baseHost = this.localLinks ? '' : 'https://archive.org';
97
-
98
- // re/build the nav
99
- this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived, this.itemIdentifier);
100
- }
101
-
102
- menuToggled({ detail }) {
103
- const currentMenu = this.openMenu;
104
- this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
105
- // Keeps media slider open if media menu is open
106
- if (this.openMenu === 'media') {
107
- return;
108
- }
109
- this.closeMediaSlider();
110
- }
111
-
112
- openMediaSlider() {
113
- this.mediaSliderOpen = true;
114
- }
115
-
116
- closeMediaSlider() {
117
- this.mediaSliderOpen = false;
118
- this.selectedMenuOption = '';
119
- }
120
-
121
- closeMenus() {
122
- this.openMenu = '';
123
- this.closeMediaSlider();
124
- }
125
-
126
- searchInChanged(e) {
127
- this.searchIn = e.detail.searchIn;
128
- }
129
-
130
- trackClick({ detail }) {
131
- this.dispatchEvent(new CustomEvent('analyticsClick', {
132
- bubbles: true,
133
- composed: true,
134
- detail,
135
- }));
136
- }
137
-
138
- trackSubmit({ detail }) {
139
- this.dispatchEvent(new CustomEvent('analyticsSubmit', {
140
- bubbles: true,
141
- composed: true,
142
- detail,
143
- }));
144
- }
145
-
146
- mediaTypeSelected({ detail }) {
147
- if (this.selectedMenuOption === detail.mediatype) {
148
- this.closeMediaSlider();
149
- return;
150
- }
151
- this.selectedMenuOption = detail.mediatype;
152
- this.openMediaSlider();
153
- }
154
-
155
- get searchMenuOpened() {
156
- return this.openMenu === 'search';
157
- }
158
-
159
- get signedOutOpened() {
160
- return this.openMenu === 'login';
161
- }
162
-
163
- get userMenuOpened() {
164
- return this.openMenu === 'user';
165
- }
166
-
167
- get searchMenuTabIndex() {
168
- return this.searchMenuOpened ? '' : '-1';
169
- }
170
-
171
- get userMenuTabIndex() {
172
- return this.userMenuOpened ? '' : '-1';
173
- }
174
-
175
- get signedOutTabIndex() {
176
- return this.signedOutOpened ? '' : '-1';
177
- }
178
-
179
- get closeLayerClass() {
180
- return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
181
- }
182
-
183
- get userMenu() {
184
- return html`
185
- <user-menu
186
- .baseHost=${this.baseHost}
187
- .config=${this.config}
188
- .menuItems=${this.userMenuItems}
189
- ?open=${this.openMenu === 'user'}
190
- .username=${this.username}
191
- ?hideSearch=${this.hideSearch}
192
- tabindex="${this.userMenuTabIndex}"
193
- @menuToggled=${this.menuToggled}
194
- @trackClick=${this.trackClick}
195
- ></user-menu>
196
- `;
197
- }
198
-
199
- get signedOutDropdown() {
200
- return html`
201
- <signed-out-dropdown
202
- .baseHost=${this.baseHost}
203
- .config=${this.config}
204
- .open=${this.signedOutOpened}
205
- ?hideSearch=${this.hideSearch}
206
- tabindex="${this.signedOutTabIndex}"
207
- .menuItems=${this.signedOutMenuItems}
208
- ></signed-out-dropdown>
209
- `;
210
- }
211
-
212
- get signedOutMenuItems() {
213
- return this.menus.signedOut;
214
- }
215
-
216
- /**
217
- * Most users just get the basic menu items.
218
- * For users with `/items` priv, additional admin menu items are included too.
219
- * Having the `/flags` priv adds a further admin item for managing flags.
220
- */
221
- get userMenuItems() {
222
- const basicItems = this.menus.user;
223
-
224
- let adminItems = this.menus.userAdmin;
225
- if (this.canManageFlags) {
226
- adminItems = adminItems.concat(this.menus.userAdminFlags);
227
- }
228
-
229
- return this.itemIdentifier && this.admin
230
- ? [basicItems, adminItems]
231
- : basicItems;
232
- }
233
-
234
- get desktopSubnavMenuItems() {
235
- return this.menus.more;
236
- }
237
-
238
- get allowSecondaryIcon() {
239
- return this.secondIdentitySlotMode === 'allow';
240
- }
241
-
242
- get secondLogoSlot() {
243
- return this.allowSecondaryIcon
244
- ? html`
245
- <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
246
- <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
247
- `
248
- : nothing;
249
- }
250
-
251
- get separatorTemplate() {
252
- return html`<li class="divider" role="presentation"></li>`;
253
- }
254
-
255
- render() {
256
- return html`
257
- <div class="topnav">
258
- <primary-nav
259
- .baseHost=${this.baseHost}
260
- .mediaBaseHost=${this.mediaBaseHost}
261
- .config=${this.config}
262
- .openMenu=${this.openMenu}
263
- .screenName=${this.screenName}
264
- .searchIn=${this.searchIn}
265
- .searchQuery=${this.searchQuery}
266
- .secondIdentitySlotMode=${this.secondIdentitySlotMode}
267
- .selectedMenuOption=${this.selectedMenuOption}
268
- .username=${this.username}
269
- .userProfileImagePath=${this.userProfileImagePath}
270
- ?hideSearch=${this.hideSearch}
271
- @mediaTypeSelected=${this.mediaTypeSelected}
272
- @toggleSearchMenu=${this.toggleSearchMenu}
273
- @trackClick=${this.trackClick}
274
- @trackSubmit=${this.trackSubmit}
275
- @menuToggled=${this.menuToggled}
276
- >
277
- ${this.secondLogoSlot}
278
- </primary-nav>
279
- <media-slider
280
- .baseHost=${this.baseHost}
281
- .config=${this.config}
282
- .selectedMenuOption=${this.selectedMenuOption}
283
- .mediaSliderOpen=${this.mediaSliderOpen}
284
- .menus=${this.menus}
285
- ></media-slider>
286
- </div>
287
- ${this.username ? this.userMenu : this.signedOutDropdown}
288
- <search-menu
289
- .baseHost=${this.baseHost}
290
- .config=${this.config}
291
- .openMenu=${this.openMenu}
292
- tabindex="${this.searchMenuTabIndex}"
293
- ?hideSearch=${this.hideSearch}
294
- @searchInChanged=${this.searchInChanged}
295
- @trackClick=${this.trackClick}
296
- @trackSubmit=${this.trackSubmit}
297
- ></search-menu>
298
- <desktop-subnav
299
- .baseHost=${this.baseHost}
300
- .menuItems=${this.desktopSubnavMenuItems}
301
- ></desktop-subnav>
302
- <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
303
- `;
304
- }
305
- }
306
-
307
- 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
+ menuSetup() {
90
+ this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
91
+ this.username = this.getAttribute('username')
92
+ this.screenName = this.getAttribute('screenname');
93
+ this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
94
+
95
+ // ensure we update other components that use `baseHost`
96
+ this.baseHost = this.localLinks ? '' : 'https://archive.org';
97
+
98
+ // re/build the nav
99
+ this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived, this.itemIdentifier);
100
+ }
101
+
102
+ menuToggled({ detail }) {
103
+ const currentMenu = this.openMenu;
104
+ this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
105
+ // Keeps media slider open if media menu is open
106
+ if (this.openMenu === 'media') {
107
+ return;
108
+ }
109
+ this.closeMediaSlider();
110
+ }
111
+
112
+ openMediaSlider() {
113
+ this.mediaSliderOpen = true;
114
+ }
115
+
116
+ closeMediaSlider() {
117
+ this.mediaSliderOpen = false;
118
+ this.selectedMenuOption = '';
119
+ }
120
+
121
+ closeMenus() {
122
+ this.openMenu = '';
123
+ this.closeMediaSlider();
124
+ }
125
+
126
+ searchInChanged(e) {
127
+ this.searchIn = e.detail.searchIn;
128
+ }
129
+
130
+ trackClick({ detail }) {
131
+ this.dispatchEvent(new CustomEvent('analyticsClick', {
132
+ bubbles: true,
133
+ composed: true,
134
+ detail,
135
+ }));
136
+ }
137
+
138
+ trackSubmit({ detail }) {
139
+ this.dispatchEvent(new CustomEvent('analyticsSubmit', {
140
+ bubbles: true,
141
+ composed: true,
142
+ detail,
143
+ }));
144
+ }
145
+
146
+ mediaTypeSelected({ detail }) {
147
+ if (this.selectedMenuOption === detail.mediatype) {
148
+ this.closeMediaSlider();
149
+ return;
150
+ }
151
+ this.selectedMenuOption = detail.mediatype;
152
+ this.openMediaSlider();
153
+ }
154
+
155
+ get searchMenuOpened() {
156
+ return this.openMenu === 'search';
157
+ }
158
+
159
+ get signedOutOpened() {
160
+ return this.openMenu === 'login';
161
+ }
162
+
163
+ get userMenuOpened() {
164
+ return this.openMenu === 'user';
165
+ }
166
+
167
+ get searchMenuTabIndex() {
168
+ return this.searchMenuOpened ? '' : '-1';
169
+ }
170
+
171
+ get userMenuTabIndex() {
172
+ return this.userMenuOpened ? '' : '-1';
173
+ }
174
+
175
+ get signedOutTabIndex() {
176
+ return this.signedOutOpened ? '' : '-1';
177
+ }
178
+
179
+ get closeLayerClass() {
180
+ return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
181
+ }
182
+
183
+ get userMenu() {
184
+ return html`
185
+ <user-menu
186
+ .baseHost=${this.baseHost}
187
+ .config=${this.config}
188
+ .menuItems=${this.userMenuItems}
189
+ ?open=${this.openMenu === 'user'}
190
+ .username=${this.username}
191
+ ?hideSearch=${this.hideSearch}
192
+ tabindex="${this.userMenuTabIndex}"
193
+ @menuToggled=${this.menuToggled}
194
+ @trackClick=${this.trackClick}
195
+ ></user-menu>
196
+ `;
197
+ }
198
+
199
+ get signedOutDropdown() {
200
+ return html`
201
+ <signed-out-dropdown
202
+ .baseHost=${this.baseHost}
203
+ .config=${this.config}
204
+ .open=${this.signedOutOpened}
205
+ ?hideSearch=${this.hideSearch}
206
+ tabindex="${this.signedOutTabIndex}"
207
+ .menuItems=${this.signedOutMenuItems}
208
+ ></signed-out-dropdown>
209
+ `;
210
+ }
211
+
212
+ get signedOutMenuItems() {
213
+ return this.menus.signedOut;
214
+ }
215
+
216
+ /**
217
+ * Most users just get the basic menu items.
218
+ * For users with `/items` priv, additional admin menu items are included too.
219
+ * Having the `/flags` priv adds a further admin item for managing flags.
220
+ */
221
+ get userMenuItems() {
222
+ const basicItems = this.menus.user;
223
+
224
+ let adminItems = this.menus.userAdmin;
225
+ if (this.canManageFlags) {
226
+ adminItems = adminItems.concat(this.menus.userAdminFlags);
227
+ }
228
+
229
+ return this.itemIdentifier && this.admin
230
+ ? [basicItems, adminItems]
231
+ : basicItems;
232
+ }
233
+
234
+ get desktopSubnavMenuItems() {
235
+ return this.menus.more;
236
+ }
237
+
238
+ get allowSecondaryIcon() {
239
+ return this.secondIdentitySlotMode === 'allow';
240
+ }
241
+
242
+ get secondLogoSlot() {
243
+ return this.allowSecondaryIcon
244
+ ? html`
245
+ <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
246
+ <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
247
+ `
248
+ : nothing;
249
+ }
250
+
251
+ get separatorTemplate() {
252
+ return html`<li class="divider" role="presentation"></li>`;
253
+ }
254
+
255
+ render() {
256
+ return html`
257
+ <div class="topnav">
258
+ <primary-nav
259
+ .baseHost=${this.baseHost}
260
+ .mediaBaseHost=${this.mediaBaseHost}
261
+ .config=${this.config}
262
+ .openMenu=${this.openMenu}
263
+ .screenName=${this.screenName}
264
+ .searchIn=${this.searchIn}
265
+ .searchQuery=${this.searchQuery}
266
+ .secondIdentitySlotMode=${this.secondIdentitySlotMode}
267
+ .selectedMenuOption=${this.selectedMenuOption}
268
+ .username=${this.username}
269
+ .userProfileImagePath=${this.userProfileImagePath}
270
+ ?hideSearch=${this.hideSearch}
271
+ @mediaTypeSelected=${this.mediaTypeSelected}
272
+ @toggleSearchMenu=${this.toggleSearchMenu}
273
+ @trackClick=${this.trackClick}
274
+ @trackSubmit=${this.trackSubmit}
275
+ @menuToggled=${this.menuToggled}
276
+ >
277
+ ${this.secondLogoSlot}
278
+ </primary-nav>
279
+ <media-slider
280
+ .baseHost=${this.baseHost}
281
+ .config=${this.config}
282
+ .selectedMenuOption=${this.selectedMenuOption}
283
+ .mediaSliderOpen=${this.mediaSliderOpen}
284
+ .menus=${this.menus}
285
+ ></media-slider>
286
+ </div>
287
+ ${this.username ? this.userMenu : this.signedOutDropdown}
288
+ <search-menu
289
+ .baseHost=${this.baseHost}
290
+ .config=${this.config}
291
+ .openMenu=${this.openMenu}
292
+ tabindex="${this.searchMenuTabIndex}"
293
+ ?hideSearch=${this.hideSearch}
294
+ @searchInChanged=${this.searchInChanged}
295
+ @trackClick=${this.trackClick}
296
+ @trackSubmit=${this.trackSubmit}
297
+ ></search-menu>
298
+ <desktop-subnav
299
+ .baseHost=${this.baseHost}
300
+ .menuItems=${this.desktopSubnavMenuItems}
301
+ ></desktop-subnav>
302
+ <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
303
+ `;
304
+ }
305
+ }
306
+
307
+ 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;