@internetarchive/ia-topnav 1.1.30 → 1.1.31-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 (83) hide show
  1. package/.eslintrc +16 -16
  2. package/LICENSE +661 -661
  3. package/README.md +147 -147
  4. package/index.d.ts +104 -104
  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 -659
  27. package/src/desktop-subnav.js +45 -45
  28. package/src/dropdown-menu.js +102 -98
  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 -203
  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 +149 -139
  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 -258
  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/nav-search.js CHANGED
@@ -1,125 +1,125 @@
1
- import { nothing, html } from 'https://offshoot.prod.archive.org/lit.js';
2
-
3
- import TrackedElement from './tracked-element.js';
4
- import navSearchCSS from './styles/nav-search.js';
5
- import icons from './assets/img/icons.js';
6
- import formatUrl from './lib/formatUrl.js';
7
-
8
- class NavSearch extends TrackedElement {
9
- static get styles() {
10
- return navSearchCSS;
11
- }
12
-
13
- static get properties() {
14
- return {
15
- baseHost: { type: String },
16
- config: { type: Object },
17
- locationHandler: { type: Object },
18
- open: { type: Boolean },
19
- openMenu: { type: String },
20
- searchIn: { type: String },
21
- searchQuery: { type: String },
22
- };
23
- }
24
-
25
- constructor() {
26
- super();
27
- this.config = {};
28
- this.locationHandler = () => {};
29
- this.open = false;
30
- this.openMenu = '';
31
- this.searchIn = '';
32
- this.inSearchBeta = false;
33
-
34
- this.initSearchBetaOptIn();
35
- }
36
-
37
- updated() {
38
- if (this.open) {
39
- this.shadowRoot.querySelector('[name=query]').focus();
40
- }
41
- return true;
42
- }
43
-
44
- initSearchBetaOptIn() {
45
- this.inSearchBeta = !!window.localStorage?.getItem('SearchBeta-opt-in') ||
46
- !!window.localStorage?.getItem('SearchBeta-launched');
47
- }
48
-
49
- search(e) {
50
- const query = this.shadowRoot.querySelector('[name=query]').value;
51
-
52
- if (!query) {
53
- e.preventDefault();
54
- return false;
55
- }
56
-
57
- // TV search points to a detail page with a q param instead
58
- if (this.searchIn === 'TV') {
59
- this.locationHandler(formatUrl(`/details/tv?q=${query}`, this.baseHost));
60
- e.preventDefault();
61
- return false;
62
- }
63
-
64
- this.trackSubmit(e);
65
- return true;
66
- }
67
-
68
- toggleSearchMenu() {
69
- if (this.openMenu === 'search') {
70
- return;
71
- }
72
- this.dispatchEvent(new CustomEvent('menuToggled', {
73
- detail: {
74
- menuName: 'search'
75
- },
76
- composed: true,
77
- bubbles: true,
78
- }));
79
- }
80
-
81
- get searchInsideInput() {
82
- return this.searchIn ? html`<input type='hidden' name='sin' value='${this.searchIn}' />` : nothing;
83
- }
84
-
85
- get searchEndpoint() {
86
- return this.inSearchBeta ? '/search' : '/search.php';
87
- }
88
-
89
- render() {
90
- const searchMenuClass = this.open ? 'flex' : 'search-inactive';
91
-
92
- return html`
93
- <div class="search-activated fade-in ${searchMenuClass}">
94
- <form
95
- id="nav-search"
96
- class="highlight"
97
- action=${formatUrl(this.searchEndpoint, this.baseHost)}
98
- method="get"
99
- @submit=${this.search}
100
- data-event-submit-tracking="${this.config.eventCategory}|NavSearchSubmit"
101
- >
102
- <input
103
- type="text"
104
- name="query"
105
- class="search-field"
106
- placeholder="Search"
107
- autocomplete="off"
108
- @focus=${this.toggleSearchMenu}
109
- value=${this.searchQuery || ''}
110
- />
111
- ${this.searchInsideInput}
112
- <button
113
- type="submit"
114
- class="search"
115
- data-event-click-tracking="${this.config.eventCategory}|NavSearchClose"
116
- >
117
- ${icons.search}
118
- </button>
119
- </form>
120
- </div>
121
- `;
122
- }
123
- }
124
-
125
- customElements.define('nav-search', NavSearch);
1
+ import { nothing, html } from 'https://offshoot.prod.archive.org/lit.js';
2
+
3
+ import TrackedElement from './tracked-element.js';
4
+ import navSearchCSS from './styles/nav-search.js';
5
+ import icons from './assets/img/icons.js';
6
+ import formatUrl from './lib/formatUrl.js';
7
+
8
+ class NavSearch extends TrackedElement {
9
+ static get styles() {
10
+ return navSearchCSS;
11
+ }
12
+
13
+ static get properties() {
14
+ return {
15
+ baseHost: { type: String },
16
+ config: { type: Object },
17
+ locationHandler: { type: Object },
18
+ open: { type: Boolean },
19
+ openMenu: { type: String },
20
+ searchIn: { type: String },
21
+ searchQuery: { type: String },
22
+ };
23
+ }
24
+
25
+ constructor() {
26
+ super();
27
+ this.config = {};
28
+ this.locationHandler = () => {};
29
+ this.open = false;
30
+ this.openMenu = '';
31
+ this.searchIn = '';
32
+ this.inSearchBeta = false;
33
+
34
+ this.initSearchBetaOptIn();
35
+ }
36
+
37
+ updated() {
38
+ if (this.open) {
39
+ this.shadowRoot.querySelector('[name=query]').focus();
40
+ }
41
+ return true;
42
+ }
43
+
44
+ initSearchBetaOptIn() {
45
+ this.inSearchBeta = !!window.localStorage?.getItem('SearchBeta-opt-in') ||
46
+ !!window.localStorage?.getItem('SearchBeta-launched');
47
+ }
48
+
49
+ search(e) {
50
+ const query = this.shadowRoot.querySelector('[name=query]').value;
51
+
52
+ if (!query) {
53
+ e.preventDefault();
54
+ return false;
55
+ }
56
+
57
+ // TV search points to a detail page with a q param instead
58
+ if (this.searchIn === 'TV') {
59
+ this.locationHandler(formatUrl(`/details/tv?q=${query}`, this.baseHost));
60
+ e.preventDefault();
61
+ return false;
62
+ }
63
+
64
+ this.trackSubmit(e);
65
+ return true;
66
+ }
67
+
68
+ toggleSearchMenu() {
69
+ if (this.openMenu === 'search') {
70
+ return;
71
+ }
72
+ this.dispatchEvent(new CustomEvent('menuToggled', {
73
+ detail: {
74
+ menuName: 'search'
75
+ },
76
+ composed: true,
77
+ bubbles: true,
78
+ }));
79
+ }
80
+
81
+ get searchInsideInput() {
82
+ return this.searchIn ? html`<input type='hidden' name='sin' value='${this.searchIn}' />` : nothing;
83
+ }
84
+
85
+ get searchEndpoint() {
86
+ return this.inSearchBeta ? '/search' : '/search.php';
87
+ }
88
+
89
+ render() {
90
+ const searchMenuClass = this.open ? 'flex' : 'search-inactive';
91
+
92
+ return html`
93
+ <div class="search-activated fade-in ${searchMenuClass}">
94
+ <form
95
+ id="nav-search"
96
+ class="highlight"
97
+ action=${formatUrl(this.searchEndpoint, this.baseHost)}
98
+ method="get"
99
+ @submit=${this.search}
100
+ data-event-submit-tracking="${this.config.eventCategory}|NavSearchSubmit"
101
+ >
102
+ <input
103
+ type="text"
104
+ name="query"
105
+ class="search-field"
106
+ placeholder="Search"
107
+ autocomplete="off"
108
+ @focus=${this.toggleSearchMenu}
109
+ value=${this.searchQuery || ''}
110
+ />
111
+ ${this.searchInsideInput}
112
+ <button
113
+ type="submit"
114
+ class="search"
115
+ data-event-click-tracking="${this.config.eventCategory}|NavSearchClose"
116
+ >
117
+ ${icons.search}
118
+ </button>
119
+ </form>
120
+ </div>
121
+ `;
122
+ }
123
+ }
124
+
125
+ customElements.define('nav-search', NavSearch);
@@ -1,203 +1,215 @@
1
- import { html, nothing } from 'https://offshoot.prod.archive.org/lit.js';
2
- import TrackedElement from './tracked-element.js';
3
- import icons from './assets/img/icons.js';
4
- import './assets/img/hamburger.js';
5
- import './login-button.js';
6
- import './nav-search.js';
7
- import './media-menu.js';
8
- import logoWordmarkStacked from './assets/img/wordmark-stacked.js';
9
- import primaryNavCSS from './styles/primary-nav.js';
10
- import locationHandler from './lib/location-handler.js';
11
- import formatUrl from './lib/formatUrl.js';
12
-
13
- class PrimaryNav extends TrackedElement {
14
- static get styles() {
15
- return primaryNavCSS;
16
- }
17
-
18
- static get properties() {
19
- return {
20
- mediaBaseHost: { type: String },
21
- baseHost: { type: String },
22
- hideSearch: { type: Boolean },
23
- config: { type: Object },
24
- openMenu: { type: String },
25
- screenName: { type: String },
26
- searchIn: { type: String },
27
- searchQuery: { type: String },
28
- secondIdentitySlotMode: { type: String },
29
- selectedMenuOption: { type: String },
30
- signedOutMenuOpen: { type: Boolean },
31
- userMenuOpen: { type: Boolean },
32
- username: { type: String },
33
- userProfileImagePath: { type: String },
34
- };
35
- }
36
-
37
- constructor() {
38
- super();
39
- this.config = {};
40
- this.openMenu = '';
41
- this.searchIn = '';
42
- this.selectedMenuOption = '';
43
- this.signedOutMenuOpen = false;
44
- this.userMenuOpen = false;
45
- this.mediaBaseHost = 'https://archive.org';
46
- this.secondIdentitySlotMode = '';
47
- }
48
-
49
- toggleMediaMenu(e) {
50
- this.trackClick(e);
51
- this.dispatchEvent(
52
- new CustomEvent('menuToggled', {
53
- detail: {
54
- menuName: 'media',
55
- },
56
- }),
57
- );
58
- }
59
-
60
- toggleSearchMenu(e) {
61
- this.trackClick(e);
62
- this.dispatchEvent(
63
- new CustomEvent('menuToggled', {
64
- detail: {
65
- menuName: 'search',
66
- },
67
- }),
68
- );
69
- }
70
-
71
- toggleUserMenu(e) {
72
- this.trackClick(e);
73
- this.dispatchEvent(
74
- new CustomEvent('menuToggled', {
75
- detail: {
76
- menuName: 'user',
77
- },
78
- }),
79
- );
80
- }
81
-
82
- get userIcon() {
83
- const userMenuClass = this.openMenu === 'user' ? 'active' : '';
84
- const userMenuToolTip = this.openMenu === 'user' ? 'Close user menu' : 'Expand user menu';
85
-
86
- return html`
87
- <button
88
- class="user-menu ${userMenuClass}"
89
- title="${userMenuToolTip}"
90
- @click="${this.toggleUserMenu}"
91
- data-event-click-tracking="${this.config.eventCategory}|NavUserMenu"
92
- >
93
- <img
94
- src="${this.mediaBaseHost}${this.userProfileImagePath}"
95
- alt="${this.screenName}"
96
- />
97
- <span class="screen-name" dir="auto">${this.screenName}</span>
98
- </button>
99
- `;
100
- }
101
-
102
- get loginIcon() {
103
- return html`
104
- <login-button
105
- .baseHost=${this.baseHost}
106
- .config=${this.config}
107
- .dropdownOpen=${this.signedOutMenuOpen}
108
- .openMenu=${this.openMenu}
109
- @signedOutMenuToggled=${this.signedOutMenuToggled}
110
- ></login-button>
111
- `;
112
- }
113
-
114
- get searchMenuOpen() {
115
- return this.openMenu === 'search';
116
- }
117
-
118
- get allowSecondaryIcon() {
119
- return this.secondIdentitySlotMode === 'allow';
120
- }
121
-
122
- get searchMenu() {
123
- if (this.hideSearch) return nothing;
124
-
125
- return html`
126
- <button
127
- class="search-trigger"
128
- @click="${this.toggleSearchMenu}"
129
- data-event-click-tracking="${this.config.eventCategory}|NavSearchOpen"
130
- >
131
- ${icons.search}
132
- </button>
133
- <nav-search
134
- .baseHost=${this.baseHost}
135
- .config=${this.config}
136
- .locationHandler=${locationHandler}
137
- .open=${this.searchMenuOpen}
138
- .openMenu=${this.openMenu}
139
- .searchIn=${this.searchIn}
140
- .searchQuery=${this.searchQuery}
141
- ></nav-search>
142
- `;
143
- }
144
-
145
- get secondLogoSlot() {
146
- return this.allowSecondaryIcon
147
- ? html`
148
- <slot name="opt-sec-logo"></slot>
149
- <slot name="opt-sec-logo-mobile"></slot>
150
- `
151
- : nothing;
152
- }
153
-
154
- get secondLogoClass() {
155
- return this.allowSecondaryIcon ? 'second-logo' : '';
156
- }
157
-
158
- render() {
159
- const mediaMenuTabIndex = this.openMenu === 'media' ? '' : '-1';
160
- return html`
161
- <nav>
162
- <div class=${`branding ${this.secondLogoClass}`}>
163
- <a
164
- href=${formatUrl('/', this.baseHost)}
165
- @click=${this.trackClick}
166
- data-event-click-tracking="${this.config.eventCategory}|NavHome"
167
- title="Go home"
168
- class="link-home"
169
- >${icons.iaLogo}${logoWordmarkStacked}</a
170
- >
171
- ${this.secondLogoSlot}
172
- </div>
173
- ${this.searchMenu}
174
- <a href="${formatUrl('/create', this.baseHost)}" class="upload">
175
- ${icons.upload}
176
- <span>Upload</span>
177
- </a>
178
- <div class="user-info">
179
- ${this.username ? this.userIcon : this.loginIcon}
180
- </div>
181
- <media-menu
182
- .baseHost=${this.baseHost}
183
- .config=${this.config}
184
- ?mediaMenuAnimate="${this.mediaMenuAnimate}"
185
- tabindex="${mediaMenuTabIndex}"
186
- .selectedMenuOption=${this.selectedMenuOption}
187
- .openMenu=${this.openMenu}
188
- ></media-menu>
189
- <button
190
- class="hamburger"
191
- @click="${this.toggleMediaMenu}"
192
- tabindex="1"
193
- data-event-click-tracking="${this.config.eventCategory}|NavHamburger"
194
- title="Open main menu"
195
- >
196
- <icon-hamburger ?active=${this.openMenu === 'media'}></icon-hamburger>
197
- </button>
198
- </nav>
199
- `;
200
- }
201
- }
202
-
203
- customElements.define('primary-nav', PrimaryNav);
1
+ import { html, nothing } from 'https://offshoot.prod.archive.org/lit.js';
2
+ import TrackedElement from './tracked-element.js';
3
+ import icons from './assets/img/icons.js';
4
+ import './assets/img/hamburger.js';
5
+ import './login-button.js';
6
+ import './nav-search.js';
7
+ import './media-menu.js';
8
+ import logoWordmarkStacked from './assets/img/wordmark-stacked.js';
9
+ import primaryNavCSS from './styles/primary-nav.js';
10
+ import locationHandler from './lib/location-handler.js';
11
+ import formatUrl from './lib/formatUrl.js';
12
+
13
+ class PrimaryNav extends TrackedElement {
14
+ static get styles() {
15
+ return primaryNavCSS;
16
+ }
17
+
18
+ static get properties() {
19
+ return {
20
+ mediaBaseHost: { type: String },
21
+ baseHost: { type: String },
22
+ hideSearch: { type: Boolean },
23
+ config: { type: Object },
24
+ openMenu: { type: String },
25
+ screenName: { type: String },
26
+ searchIn: { type: String },
27
+ searchQuery: { type: String },
28
+ secondIdentitySlotMode: { type: String },
29
+ selectedMenuOption: { type: String },
30
+ signedOutMenuOpen: { type: Boolean },
31
+ userMenuOpen: { type: Boolean },
32
+ username: { type: String },
33
+ userProfileImagePath: { type: String },
34
+ };
35
+ }
36
+
37
+ constructor() {
38
+ super();
39
+ this.config = {};
40
+ this.openMenu = '';
41
+ this.searchIn = '';
42
+ this.selectedMenuOption = '';
43
+ this.signedOutMenuOpen = false;
44
+ this.userMenuOpen = false;
45
+ this.mediaBaseHost = 'https://archive.org';
46
+ this.secondIdentitySlotMode = '';
47
+ }
48
+
49
+ toggleMediaMenu(e) {
50
+ this.trackClick(e);
51
+ this.dispatchEvent(
52
+ new CustomEvent('menuToggled', {
53
+ detail: {
54
+ menuName: 'media',
55
+ },
56
+ }),
57
+ );
58
+ }
59
+
60
+ toggleSearchMenu(e) {
61
+ this.trackClick(e);
62
+ this.dispatchEvent(
63
+ new CustomEvent('menuToggled', {
64
+ detail: {
65
+ menuName: 'search',
66
+ },
67
+ }),
68
+ );
69
+ }
70
+
71
+ toggleUserMenu(e) {
72
+ this.trackClick(e);
73
+ this.dispatchEvent(
74
+ new CustomEvent('menuToggled', {
75
+ detail: {
76
+ menuName: 'user',
77
+ },
78
+ }),
79
+ );
80
+ }
81
+
82
+ get userIcon() {
83
+ const userMenuClass = this.openMenu === 'user' ? 'active' : '';
84
+ const userMenuToolTip = this.openMenu === 'user' ? 'Close user menu' : 'Expand user menu';
85
+
86
+ return html`
87
+ <button
88
+ class="user-menu ${userMenuClass}"
89
+ title="${userMenuToolTip}"
90
+ @click="${this.toggleUserMenu}"
91
+ data-event-click-tracking="${this.config.eventCategory}|NavUserMenu"
92
+ >
93
+ <img
94
+ src="${this.mediaBaseHost}${this.userProfileImagePath}"
95
+ alt="${this.screenName}"
96
+ />
97
+ <span class="screen-name" dir="auto">${this.screenName}</span>
98
+ </button>
99
+ `;
100
+ }
101
+
102
+ get loginIcon() {
103
+ return html`
104
+ <login-button
105
+ .baseHost=${this.baseHost}
106
+ .config=${this.config}
107
+ .dropdownOpen=${this.signedOutMenuOpen}
108
+ .openMenu=${this.openMenu}
109
+ @signedOutMenuToggled=${this.signedOutMenuToggled}
110
+ ></login-button>
111
+ `;
112
+ }
113
+
114
+ get searchMenuOpen() {
115
+ return this.openMenu === 'search';
116
+ }
117
+
118
+ get allowSecondaryIcon() {
119
+ return this.secondIdentitySlotMode === 'allow';
120
+ }
121
+
122
+ get searchMenu() {
123
+ if (this.hideSearch) return nothing;
124
+
125
+ return html`
126
+ <button
127
+ class="search-trigger"
128
+ @click="${this.toggleSearchMenu}"
129
+ data-event-click-tracking="${this.config.eventCategory}|NavSearchOpen"
130
+ >
131
+ ${icons.search}
132
+ </button>
133
+ <nav-search
134
+ .baseHost=${this.baseHost}
135
+ .config=${this.config}
136
+ .locationHandler=${locationHandler}
137
+ .open=${this.searchMenuOpen}
138
+ .openMenu=${this.openMenu}
139
+ .searchIn=${this.searchIn}
140
+ .searchQuery=${this.searchQuery}
141
+ ></nav-search>
142
+ `;
143
+ }
144
+
145
+ get mobileDonateHeart() {
146
+ return html`
147
+ <a class="mobile-donate-link" href=${formatUrl('/donate/?origin=iawww-mbhrt', this.baseHost)}>
148
+ <span class="icon">
149
+ ${icons.donate}
150
+ </span>
151
+ <span class="label">"Donate to the archive"</span>
152
+ </a>
153
+ `;
154
+ }
155
+
156
+ get secondLogoSlot() {
157
+ return this.allowSecondaryIcon
158
+ ? html`
159
+ <slot name="opt-sec-logo"></slot>
160
+ <slot name="opt-sec-logo-mobile"></slot>
161
+ `
162
+ : nothing;
163
+ }
164
+
165
+ get secondLogoClass() {
166
+ return this.allowSecondaryIcon ? 'second-logo' : '';
167
+ }
168
+
169
+ render() {
170
+ const mediaMenuTabIndex = this.openMenu === 'media' ? '' : '-1';
171
+ return html`
172
+ <nav class=${this.hideSearch ? 'hide-search' : nothing}>
173
+ <div class=${`branding ${this.secondLogoClass}`}>
174
+ <a
175
+ href=${formatUrl('/', this.baseHost)}
176
+ @click=${this.trackClick}
177
+ data-event-click-tracking="${this.config.eventCategory}|NavHome"
178
+ title="Go home"
179
+ class="link-home"
180
+ >${icons.iaLogo}${logoWordmarkStacked}</a
181
+ >
182
+ ${this.secondLogoSlot}
183
+ </div>
184
+ ${this.mobileDonateHeart}
185
+ ${this.searchMenu}
186
+ <a href="${formatUrl('/create', this.baseHost)}" class="upload">
187
+ ${icons.upload}
188
+ <span>Upload</span>
189
+ </a>
190
+ <div class="user-info">
191
+ ${this.username ? this.userIcon : this.loginIcon}
192
+ </div>
193
+ <media-menu
194
+ .baseHost=${this.baseHost}
195
+ .config=${this.config}
196
+ ?mediaMenuAnimate="${this.mediaMenuAnimate}"
197
+ tabindex="${mediaMenuTabIndex}"
198
+ .selectedMenuOption=${this.selectedMenuOption}
199
+ .openMenu=${this.openMenu}
200
+ ></media-menu>
201
+ <button
202
+ class="hamburger"
203
+ @click="${this.toggleMediaMenu}"
204
+ tabindex="1"
205
+ data-event-click-tracking="${this.config.eventCategory}|NavHamburger"
206
+ title="Open main menu"
207
+ >
208
+ <icon-hamburger ?active=${this.openMenu === 'media'}></icon-hamburger>
209
+ </button>
210
+ </nav>
211
+ `;
212
+ }
213
+ }
214
+
215
+ customElements.define('primary-nav', PrimaryNav);