-
Notifications
You must be signed in to change notification settings - Fork 93
/
header.scss
413 lines (394 loc) · 10.3 KB
/
header.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
@import "../pui-variables";
/*doc
---
title: Header
name: header
categories:
- css_base_header
- css_all
---
```html_example
<header class="logged-in">
<!-- logo -->
<div class="header-item brand-container">
<div class="logo-container" id="npm-logo">
<a href="/" class="active"><img src="/static/images/npm-logo.svg" alt="npm logo"></a>
</div>
</div>
<!-- /logo -->
<!-- search -->
<div class="header-item header-search-container">
<form class="site-search" id="npm-search" action="/search" method="get" itemprop="potentialAction" itemscope="" itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="https://www.npmjs.com/search?q={q}">
<div id="site-search-container">
<input name="q" value="" type="search" id="site-search" placeholder="find packages" tabindex="1" autocorrect="off" autocapitalize="off" itemprop="query-input" autocomplete="off">
</div>
<input type="submit">
</form>
</div>
<!-- menu 1 -->
<div class="header-item user-info-container">
<div class="user-info">
<div class="drop-down-menu-container" role="navigation">
<a id="user-info-drop-down-menu-toggle" class="drop-down-menu-toggle" href="#user-info-menu" role="button" aria-haspopup="true" aria-owns="user-info-menu"><span class="a11y-only">Toggle User Menu</span>
<span class="user-info-salutation" data-user-name="rockbot" data-is-paid="">Greetings, <span id="salutation-username">rockbot</span></span>
<img alt="" src="https://s.gravatar.com/avatar/583a0cfd3e0ec851166c5c6fa5e506a5?size=50&default=retro">
</a>
<div role="menu" id="user-info-menu" class="drop-down-menu" aria-labelledby="user-info-drop-down-menu-toggle">
<div class="drop-down-menu-section">
<ul>
<li><a href="/~rockbot">profile</a></li>
<li><a href="/profile-edit">personal info</a></li>
<li><a href="/settings/billing">billing</a></li>
<li><a href="/settings/tokens">tokens</a></li>
<li><form method="POST" action="/logout"> <input type="hidden" name="crumb" value="jSXg5k67i29hI9QD2ShPcL1Olq77qMooJV2OsN8yYKA">
<button type="submit" class="btn-link">logout</button></form></li>
</ul>
</div> <!-- .drop-down-menu-section -->
</div> <!-- .drop-down-menu -->
</div> <!-- .drop-down-menu-container -->
</div> <!-- .user-info -->
</div>
<!-- /menu 1 -->
<!-- menu 2 -->
<div class="header-item header-nav-menu-container">
<a href="#" id="npm-expansions" class="npm-expansions" data-event-trigger="click" data-event-name="npm-expansions">New Project, Monday</a>
<div class="nav-menu-container" role="navigation">
<a class="nav-toggle drop-down-menu-toggle" href="#product-navigation"><span class="a11y-only">Toggle Navigation</span>
<img alt="mobile navigation menu" src="/static/images/mobile-menu.png">
</a>
<div class="drop-down-menu-container" role="menu">
<nav id="product-navigation" class="product-navigation drop-down-menu">
<ul class="drop-down-menu-section products-list">
<li><a href="/npm/on-site" class="h6">npm On-Site</a></li>
<li><a href="/npm/private-packages" class="h6" data-event-trigger="click" data-event-name="private-modules-nav-link">npm Private Packages</a></li>
<li><a href="/npm/open-source" class="h6">npm Open Source</a></li>
<li><a href="https://docs.npmjs.com" class="h6">documentation</a></li>
<li><a href="/support" class="h6">support</a></li>
</ul>
</nav>
</div>
</div>
</div>
<!-- /menu 2 -->
</header>
```
*/
header {
font-size: 16px;
padding: 0.875em 20px 0.0625em;
border-bottom: 1px solid #d3d3d3;
max-height: $header-height-max-sm;
background: $header-color;
color: $header-text-color;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: center;
}
header.hero-transparent {
background: transparent;
border-bottom: 0;
}
header.hero-transparent + .pane {
margin-top: $header-height-max-sm;
padding-top: -($header-height-max-sm);
}
header > .header-item {
flex: 1 auto;
}
header > .brand-container {
order: 1;
width: 50%;
}
header > .header-search-container {
order: 4;
}
header > .user-info-container {
order: 2;
width: calc(50% - 60px);
text-align: right;
}
header > .header-nav-menu-container {
order: 3;
width: 60px;
text-align: right;
}
header ul,
header li,
header ul li {
list-style: none;
padding: 0;
margin: 0;
}
header a {
color: $header-subtle-text-color;
}
header a:hover {
color: $header-text-color;
text-decoration: none;
transition: color 0.1s ease, background 0.1s ease;
}
.logo-container {
padding: 0;
width: 80px;
vertical-align: middle;
}
.logo-container img {
max-width: 100%;
}
.logo-container .cobrand {
font-weight: bold;
}
.logo-container .cobrand::before {
content: "♥︎";
font-size: 150%;
color: $npmred;
vertical-align: middle;
padding: 0 0.5em;
}
.npm-expansions {
display: none;
text-align: left;
}
.nav-toggle {
width: 54px;
padding: 0 5px;
}
.nav-toggle img {
max-width: 100%;
}
.nav-toggle:after {
content: none;
}
.nav-toggle.toggle-is-open:after {
content: none;
}
.site-search {
position: relative;
}
.site-search input[type=search] {
background-color: transparent;
color: $header-text-color;
border: 1px solid rgba(255,255,255,0.2);
border-radius: 0;
margin: 0 0 20px;
padding: 5px;
padding-left: 15px;
font-size: 1em;
display: block;
width: 100%;
outline: 0;
}
.site-search input[type=submit] {
position: absolute;
top: 0;
right: 0;
height: 45px;
width: 45px;
margin: 0 0 4px;
margin-bottom: 0px;
border: 0;
text-indent: -9999em;
cursor: pointer;
outline: 0;
border-radius: 0 2px 2px 0;
background-image: url("static/images/ico-search.svg");
background-repeat: no-repeat;
background-position: 80% 43%;
background-size: 16px 16px;
display: block;
text-align: center;
padding: 0 35px;
line-height: 47px;
color: #fff;
font-size: 18px;
text-decoration: none !important;
clear: both;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background-color: transparent;
}
.user-info img {
border-radius: 100%;
display: inline-block;
vertical-align: middle;
width: 38px;
height: 38px;
}
.logged-in .user-info,
.logged-in .user-info-container {
text-align: right;
}
.logged-in .user-info-salutation {
display: none;
vertical-align: middle;
max-width: 200px;
margin-right: 10px;
overflow: hidden;
text-overflow: elilipsis;
color: $header-text-color;
}
.anonymous .brand-container {
width: 30%;
}
.anonymous .user-info-container {
width: calc(70% - 44px);
}
.anonymous .user-info-salutation {
display: flex;
align-items: center;
}
.anonymous .user-info-salutation > li {
flex: 1 auto;
}
.anonymous .user-info-salutation > li:first-child {
width: calc(100% - 45px);
}
.anonymous .user-info-salutation > li:last-child {
width: 45px;
}
.anonymous .header-nav-menu-container {
width: 44px;
}
.icon-wombat-head-login {
background-image: url("static/images/wombat-head-login.svg");
background-repeat: no-repeat;
width: 45px;
height: 45px;
display: inline-block;
}
@media (min-width: $desktopMinWidth) {
header {
max-height: $header-height-max-lg;
flex-direction: row;
flex-wrap: wrap-reverse;
padding: 0 20px;
align-items: stretch;
}
header > .header-item {
flex-basis: auto;
flex-shrink: 0;
padding: 1.25em 0;
}
header > .brand-container {
order: 1;
flex-grow: 1;
width: auto;
}
header > .header-search-container {
order: 2;
flex-grow: 10;
width: auto;
}
header > .user-info-container {
order: 3;
flex-grow: 0;
width: auto;
padding-left: 10px;
min-width: 212px;
text-align: left;
}
header > .header-nav-menu-container {
order: 4;
flex-grow: 1;
width: 100%;
padding: 0 20px;
margin: 0 -20px;
background-color: $npm-menu-red;
display: flex;
align-content: space-between;
}
header > .header-nav-menu-container .npm-expansions,
header > .header-nav-menu-container .nav-menu-container {
flex: 1 auto;
}
header > .header-nav-menu-container .nav-menu-container {
max-width: 550px;
}
header.hero-transparent + .pane {
margin-top: -6em;
padding-top: 6em;
}
header.anonymous .brand-container,
header.anonymous .user-info-container {
width: auto;
min-width: auto;
}
header.anonymous .user-info-container,
header.anonymous .user-info {
text-align: right;
}
header.anonymous .header-nav-menu-container {
width: 100%;
}
.header-nav-menu-container a {
font-size: 0.9em;
}
.drop-down-menu-container {
display: block;
text-align: center;
}
.nav-menu-container .drop-down-menu-container li a {
text-align: center;
}
.nav-menu-container .drop-down-menu-container li a:hover {
background: header-nav-highlight-bg;
}
.npm-expansions {
display: block;
}
.nav-toggle {
display: none;
}
.header-item .product-navigation,
.header-item .product-navigation.hidden {
display: block !important;
position: static;
background-color: transparent;
border-radius: 0;
width: auto;
}
.header-item .products-list {
display: flex;
flex-direction: row;
align-content: flex-end;
}
.header-item .products-list li {
padding: 0 0 0 0.9375em;
border-bottom: 0;
flex: 1 auto;
}
.header-item .products-list li a,
.npm-expansions {
padding: 0.625em 0;
color: $header-subtle-text-color;
}
.header-item .products-list li a:hover,
.npm-expansions:hover {
color: $header-text-color;
text-decoration: none;
}
.logo-container {
width: 125px;
}
.site-search input[type="search"] {
height: 3.125em;
margin: 0;
}
.site-search input[type="submit"] {
width: 70px;
height: 2.777em;
border-left: 1px solid rgba(255,255,255,0.2);
text-indent: -9999em;
background-position: 50% 50%;
background-size: 16px 16px;
}
.site-search input[type="submit"]:focus {
border: 1px solid rgba(255,255,255,0.8);
}
.logged-in .user-info-salutation {
display: inline-block;
}
}