@brillout/docpress 0.15.12 → 0.15.13-commit-03246ec

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.
package/ExternalLinks.tsx CHANGED
@@ -13,7 +13,7 @@ import '@docsearch/css'
13
13
 
14
14
  function ExternalLinks(props: { style?: React.CSSProperties }) {
15
15
  const pageContext = usePageContext()
16
- const { github, discord, bluesky, linkedin, i18n, twitter } = pageContext.globalContext.config.docpress
16
+ const { github, discord, bluesky, linkedin, i18n, twitter, changelog } = pageContext.globalContext.config.docpress
17
17
  const iconI18n = !i18n ? null : (
18
18
  <LinkIcon
19
19
  className="decolorize-4"
@@ -31,6 +31,7 @@ function ExternalLinks(props: { style?: React.CSSProperties }) {
31
31
  ...props.style,
32
32
  }}
33
33
  >
34
+ <LinkIcon className="decolorize-4" icon={iconGithub} href={github} iconSizeBoost={1} />
34
35
  {iconI18n}
35
36
  {discord && <LinkIcon className="decolorize-6" icon={iconDiscord} href={discord} />}
36
37
  {twitter && <LinkIcon className="decolorize-4" icon={iconTwitter} href={`https://x.com/${twitter.slice(1)}`} />}
@@ -38,8 +39,7 @@ function ExternalLinks(props: { style?: React.CSSProperties }) {
38
39
  {linkedin && (
39
40
  <LinkIcon className="decolorize-6" icon={iconLinkedin} href={`https://www.linkedin.com/company/${linkedin}`} />
40
41
  )}
41
- <LinkIcon className="decolorize-4" icon={iconGithub} href={github} />
42
- <ChangelogButton />
42
+ {changelog !== false && <ChangelogButton />}
43
43
  </div>
44
44
  )
45
45
  }
@@ -54,7 +54,7 @@ function ChangelogButton() {
54
54
  style={{
55
55
  display: 'flex',
56
56
  alignItems: 'center',
57
- padding: '0 5px',
57
+ padding: '0 3px',
58
58
  height: '100%',
59
59
  }}
60
60
  >
@@ -63,28 +63,50 @@ function ChangelogButton() {
63
63
  style={{
64
64
  display: 'flex',
65
65
  alignItems: 'center',
66
- padding: '2px 10px',
66
+ paddingLeft: 8,
67
+ paddingRight: 8,
68
+ paddingTop: 4,
69
+ paddingBottom: 5,
67
70
  fontSize: '0.97em',
71
+ lineHeight: 0,
68
72
  }}
69
73
  >
70
- <span id="version-number" className="decolorize-7">
74
+ <span
75
+ id="version-number"
76
+ className="decolorize-7"
77
+ style={{
78
+ position: 'relative',
79
+ top: 1,
80
+ }}
81
+ >
71
82
  v{version}
72
83
  </span>
73
- <img className="decolorize-6" src={iconChangelog} height={16} style={{ marginLeft: 6 }} />
84
+ <img
85
+ className="decolorize-6"
86
+ src={iconChangelog}
87
+ height={16}
88
+ style={{ marginLeft: 6, position: 'relative', top: 1 }}
89
+ />
74
90
  </div>
75
91
  </a>
76
92
  )
77
93
  }
78
94
 
79
- function LinkIcon({ className, icon, href, style }: { className: string; icon: string; href: string; style?: any }) {
95
+ function LinkIcon({
96
+ className,
97
+ icon,
98
+ href,
99
+ style,
100
+ iconSizeBoost = 0,
101
+ }: { className: string; icon: string; href: string; style?: any; iconSizeBoost?: number }) {
80
102
  return (
81
103
  <>
82
104
  <a
83
105
  className="colorize-on-hover"
84
106
  href={href}
85
- style={{ padding: 5, display: 'inline-flex', lineHeight: 0, height: '100%', alignItems: 'center' }}
107
+ style={{ padding: 3, display: 'inline-flex', lineHeight: 0, height: '100%', alignItems: 'center' }}
86
108
  >
87
- <img className={className} src={icon} height="20" style={style} />
109
+ <img className={className} src={icon} height={18 + iconSizeBoost} style={style} />
88
110
  </a>
89
111
  </>
90
112
  )
package/Layout.tsx CHANGED
@@ -1,12 +1,15 @@
1
1
  export { Layout }
2
2
  export { MenuToggle }
3
- export { containerQueryMobileLayout }
4
- export { containerQueryMobileNav as containerQueryMobileMenu }
3
+ export { viewDesktop }
4
+ export { viewTablet }
5
5
  export { navLeftWidthMin }
6
6
  export { navLeftWidthMax }
7
7
  export { unexpandNav }
8
8
  export { blockMargin }
9
9
 
10
+ // - We use `@container container-viewport` instead of @media because @media doesn't consider the scrollbar width.
11
+ // - We use --padding-side because we cannot set a fixed max-width on the <NavHead> container .nav-head-content — DocPress doesn't know how many extra <NavHead> elements the user adds using the +docpress.topNavigation setting.
12
+
10
13
  import React from 'react'
11
14
  import { getNavItemsWithComputed, NavItem, NavItemComponent } from './NavItemComponent'
12
15
  import { parseMarkdownMini } from './parseMarkdownMini'
@@ -23,17 +26,18 @@ import { Style } from './utils/Style'
23
26
  import { cls } from './utils/cls'
24
27
  import { iconBooks } from './icons'
25
28
  import { EditLink } from './EditLink'
29
+ import type { PageContext } from 'vike/types'
26
30
 
27
31
  const blockMargin = 3
28
32
  const mainViewPadding = 20
29
- const mainViewWidthMax = 800
30
- const mainViewMax = (mainViewWidthMax + mainViewPadding * 2) as 840 // 840 = 800 + 20 * 2
33
+ const mainViewWidthMaxInner = 800
34
+ const mainViewWidthMax = (mainViewWidthMaxInner + mainViewPadding * 2) as 840 // 840 = 800 + 20 * 2
31
35
  const navLeftWidthMin = 300
32
36
  const navLeftWidthMax = 370
33
- const containerQuerySmallNav = 550
34
- const containerQueryMobileNav = 1000
35
- const containerQueryMobileLayout = (mainViewMax + navLeftWidthMin) as 1140 // 1140 = 840 + 300
36
- const containerQueryExtraSpace = (mainViewMax + navLeftWidthMax + blockMargin) as 1213 // 1213 = 840 + 370 + 3
37
+ const viewMobile = 450
38
+ const viewTablet = 1000
39
+ const viewDesktop = (mainViewWidthMax + navLeftWidthMin) as 1140 // 1140 = 840 + 300
40
+ const viewDesktopLarge = (mainViewWidthMax + navLeftWidthMax + blockMargin) as 1213 // 1213 = 840 + 370 + 3
37
41
 
38
42
  // Avoid whitespace at the bottom of pages with almost no content
39
43
  const whitespaceBuster1: React.CSSProperties = {
@@ -61,38 +65,29 @@ function Layout({ children }: { children: React.ReactNode }) {
61
65
  style={{
62
66
  ['--bg-color']: '#f5f5f5',
63
67
  ['--block-margin']: `${blockMargin}px`,
64
- ['--icon-text-padding']: '8px',
65
68
  // ['--nav-head-height']: `${isLandingPage ? 70 : 63}px`,
66
69
  ['--nav-head-height']: `63px`,
70
+ ['--main-view-padding']: `${mainViewPadding}px`,
71
+ // We don't add `container` to `body` nor `html` beacuse in Firefox it breaks the `position: fixed` of <MenuModal>
72
+ // https://stackoverflow.com/questions/74601420/css-container-inline-size-and-fixed-child
73
+ container: 'container-viewport / inline-size',
67
74
  }}
68
75
  >
69
76
  <MenuModal isTopNav={isLandingPage} />
70
- <div
71
- className={isLandingPage ? '' : 'doc-page'}
72
- style={{
73
- // We don't add `container` to `body` nor `html` beacuse in Firefox it breaks the `position: fixed` of <MenuModal>
74
- // https://stackoverflow.com/questions/74601420/css-container-inline-size-and-fixed-child
75
- container: 'container-viewport / inline-size',
76
- ...whitespaceBuster1,
77
- }}
78
- >
77
+ <div className={isLandingPage ? '' : 'doc-page'} style={whitespaceBuster1}>
79
78
  <NavHead />
80
79
  {content}
81
80
  </div>
82
81
  {/* Early toggling, to avoid layout jumps */}
83
82
  <script dangerouslySetInnerHTML={{ __html: initializeJsToggle_SSR }}></script>
83
+ <Style>{getStyleNav()}</Style>
84
84
  </div>
85
85
  )
86
86
  }
87
87
 
88
88
  function LayoutDocsPage({ children }: { children: React.ReactNode }) {
89
- const pageContext = usePageContext()
90
- const hideNavLeftAlways =
91
- pageContext.resolved.pageDesign?.hideMenuLeft ||
92
- (pageContext.resolved.navItemsDetached && pageContext.resolved.navItemsDetached.length <= 1)
93
89
  return (
94
90
  <>
95
- <Style>{getStyle()}</Style>
96
91
  <div style={{ display: 'flex', ...whitespaceBuster2 }}>
97
92
  <NavLeft />
98
93
  <div
@@ -102,52 +97,18 @@ function LayoutDocsPage({ children }: { children: React.ReactNode }) {
102
97
  />
103
98
  <PageContent>{children}</PageContent>
104
99
  </div>
105
- </>
106
- )
107
- function getStyle() {
108
- let style = css`
109
- @container container-viewport (min-width: ${containerQueryExtraSpace}px) {
100
+ <Style>{css`
101
+ @container container-viewport (min-width: ${viewDesktopLarge}px) {
110
102
  .low-prio-grow {
111
103
  flex-grow: 1;
112
104
  }
113
105
  #navigation-container {
114
106
  width: ${navLeftWidthMax}px !important;
115
107
  }
116
- }`
117
- let navLeftHidden = css`
118
- #nav-left, #nav-left-margin {
119
- display: none;
120
- }
121
- .page-wrapper {
122
- --main-view-padding: 10px !important;
123
- flex-grow: 1;
124
- align-items: center;
125
- }
126
- .page-content {
127
- margin: auto;
128
- }
129
- #menu-modal-wrapper {
130
- position: absolute !important;
131
- }
132
- `
133
- if (!hideNavLeftAlways) {
134
- navLeftHidden = css`
135
- @container container-viewport (max-width: ${containerQueryMobileLayout - 1}px) {
136
- ${navLeftHidden}
137
- }
138
- @container container-viewport (min-width: ${containerQueryMobileLayout}px) {
139
- .nav-head-full-width {
140
- display: none !important;
141
- }
142
- }
143
- `
144
- }
145
- style += navLeftHidden
146
-
147
- return style
148
- }
108
+ }`}</Style>
109
+ </>
110
+ )
149
111
  }
150
-
151
112
  function LayoutLandingPage({ children }: { children: React.ReactNode }) {
152
113
  return (
153
114
  <>
@@ -164,7 +125,7 @@ function PageContent({ children }: { children: React.ReactNode }) {
164
125
  const { globalNote } = pageContext.globalContext.config.docpress
165
126
  */
166
127
  const ifDocPage = (style: React.CSSProperties) => (isLandingPage ? {} : style)
167
- const contentMaxWidth = pageContext.resolved.pageDesign?.contentMaxWidth ?? mainViewWidthMax
128
+ const contentMaxWidth = pageContext.resolved.pageDesign?.contentMaxWidth ?? mainViewWidthMaxInner
168
129
  return (
169
130
  <div
170
131
  className="page-wrapper low-prio-grow"
@@ -180,8 +141,6 @@ function PageContent({ children }: { children: React.ReactNode }) {
180
141
  <div
181
142
  className="page-content"
182
143
  style={{
183
- // Also define --main-view-padding for landing page because it's used by <Contributors> and <Sponsors>
184
- ['--main-view-padding']: `${mainViewPadding}px`,
185
144
  ...ifDocPage({
186
145
  width: `calc(${contentMaxWidth}px + 2 * var(--main-view-padding))`,
187
146
  maxWidth: '100%',
@@ -222,7 +181,7 @@ function NavLeft() {
222
181
  top: 0,
223
182
  }}
224
183
  >
225
- <NavHead isNavLeft={true} />
184
+ {!isNavLeftAlwaysHidden(pageContext) && <NavHead isNavLeft={true} />}
226
185
  <div
227
186
  style={{
228
187
  backgroundColor: 'var(--bg-color)',
@@ -275,37 +234,44 @@ function NavigationContent(props: {
275
234
  )
276
235
  }
277
236
 
237
+ function isNavLeftAlwaysHidden(pageContext: PageContext) {
238
+ const { isLandingPage, navItemsDetached, pageDesign } = pageContext.resolved
239
+ return isLandingPage || pageDesign?.hideMenuLeft || (navItemsDetached && navItemsDetached.length <= 1)
240
+ }
241
+
278
242
  const menuLinkStyle: React.CSSProperties = {
279
243
  height: '100%',
280
244
  padding: '0 var(--padding-side)',
281
245
  justifyContent: 'center',
282
246
  }
283
247
 
248
+ // Two <NavHead> instances are rendered:
249
+ // - The left-side <NavHead> shown on documentation pages on desktop
250
+ // - The top <NavHead> shown otherwise
284
251
  function NavHead({ isNavLeft }: { isNavLeft?: true }) {
285
252
  const pageContext = usePageContext()
286
- const { isLandingPage } = pageContext.resolved
287
253
  const { navMaxWidth, name, algolia } = pageContext.globalContext.config.docpress
254
+ const hideNavHeadLogo = pageContext.resolved.isLandingPage && !navMaxWidth
288
255
 
289
- const navSecondaryContent = (
256
+ const navHeadSecondary = (
290
257
  <div
291
- className={isNavLeft ? 'show-on-nav-hover add-transition' : 'hide-on-shrink desktop-grow'}
258
+ className={cls(['nav-head-secondary', isNavLeft && 'show-on-nav-hover add-transition'])}
292
259
  style={{
293
260
  padding: 0,
294
261
  display: 'flex',
295
262
  height: '100%',
296
- ...(!isNavLeft
297
- ? {}
298
- : {
263
+ ...(isNavLeft
264
+ ? {
299
265
  position: 'absolute',
300
266
  left: '100%',
301
267
  top: 0,
302
- '--padding-side': '20px',
303
- width: mainViewMax, // guaranteed real estate
304
- }),
268
+ width: mainViewWidthMax, // guaranteed real estate
269
+ }
270
+ : {}),
305
271
  }}
306
272
  >
307
273
  {pageContext.globalContext.config.docpress.topNavigation}
308
- {!isNavLeft && <div className="desktop-grow" />}
274
+ <div className="desktop-grow" style={{ display: 'none' }} />
309
275
  <ExternalLinks
310
276
  style={{
311
277
  display: 'inline-flex',
@@ -319,7 +285,7 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
319
285
 
320
286
  return (
321
287
  <div
322
- className={cls(['nav-head-top', !isNavLeft && 'nav-head-full-width', 'link-hover-animation'])}
288
+ className={cls(['nav-head link-hover-animation', isNavLeft && 'is-nav-left', !!navMaxWidth && 'has-max-width'])}
323
289
  style={{
324
290
  display: 'flex',
325
291
  justifyContent: isNavLeft ? 'flex-end' : 'center',
@@ -328,9 +294,10 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
328
294
  position: 'relative',
329
295
  }}
330
296
  >
331
- {isNavLeft && <NavHeaderLeftFullWidthBackground />}
297
+ {isNavLeft && <NavHeadLeftFullWidthBackground />}
332
298
  <div
333
299
  style={{
300
+ // DON'T REMOVE this container: it's needed for the `cqw` values
334
301
  container: 'container-nav-head / inline-size',
335
302
  width: '100%',
336
303
  minWidth: isNavLeft && navLeftWidthMin,
@@ -344,107 +311,160 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
344
311
  maxWidth: navMaxWidth,
345
312
  margin: 'auto',
346
313
  height: 'var(--nav-head-height)',
347
- fontSize: `min(15.2px, ${isProjectNameShort(name) ? '4.8cqw' : '4.5cqw'})`,
314
+ fontSize: `min(14.2px, ${isProjectNameShort(name) ? '4.8cqw' : '4.5cqw'})`,
348
315
  color: '#666',
349
- ['--icon-text-padding']: 'min(8px, 1.8cqw)',
350
316
  display: 'flex',
351
317
  justifyContent: 'center',
352
318
  }}
353
319
  >
354
- <NavLogo className="grow-half" />
355
- {!isNavLeft && <div className="desktop-grow" />}
356
- {algolia && <SearchLink className="grow-half" style={menuLinkStyle} />}
357
- <MenuToggleMain className="grow-full" style={menuLinkStyle} />
358
- {navSecondaryContent}
320
+ {!hideNavHeadLogo && <NavHeadLogo />}
321
+ <div className="desktop-grow" style={{ display: 'none' }} />
322
+ {algolia && <SearchLink className="always-shown" style={menuLinkStyle} />}
323
+ <MenuToggleMain className="always-shown nav-head-menu-toggle" style={menuLinkStyle} />
324
+ {navHeadSecondary}
359
325
  </div>
360
326
  </div>
361
- <Style>{getStyle()}</Style>
362
327
  </div>
363
328
  )
329
+ }
330
+ function getStyleNav() {
331
+ const pageContext = usePageContext()
364
332
 
365
- function getStyle() {
366
- let style = css`
367
- @container container-nav-head (max-width: ${containerQuerySmallNav}px) {
368
- .grow-full {
369
- flex-grow: 1;
333
+ let style = ''
334
+
335
+ // Mobile
336
+ style += css`
337
+ @container container-viewport (max-width: ${viewMobile}px) {
338
+ .nav-head:not(.is-nav-left) {
339
+ .nav-head-logo {
340
+ always-shown: flex-start !important;
341
+ padding-left: var(--main-view-padding);
342
+ }
343
+ .nav-head-menu-toggle {
344
+ justify-content: flex-end !important;
345
+ padding-right: var(--main-view-padding) !important;
346
+ }
347
+ .nav-head-content {
348
+ --icon-text-padding: min(8px, 1.3cqw);
349
+ & > * {
350
+ flex-grow: 1;
351
+ }
352
+ }
370
353
  }
371
- .grow-half {
372
- flex-grow: 0.5;
354
+ }`
355
+
356
+ // Mobile + tablet
357
+ style += css`
358
+ @container container-viewport (max-width: ${viewTablet}px) {
359
+ .nav-head:not(.is-nav-left) {
360
+ .nav-head-secondary {
361
+ display: none !important;
362
+ }
373
363
  }
374
- .nav-head-content {
375
- --padding-side: 0px;
364
+ }`
365
+
366
+ // Tablet
367
+ style += css`
368
+ @container container-viewport (max-width: ${viewTablet}px) and (min-width: ${viewMobile + 1}px) {
369
+ .nav-head:not(.is-nav-left) {
370
+ .nav-head-content {
371
+ --icon-text-padding: 8px;
372
+ --padding-side: 20px;
373
+ }
374
+ .nav-head-logo {
375
+ padding: 0 var(--padding-side);
376
+ }
376
377
  }
377
- .nav-logo {
378
- justify-content: flex-start;
379
- padding-left: 15px;
380
- margin-left: -10px;
378
+ }`
379
+
380
+ // Desktop small + desktop
381
+ style += css`
382
+ @container container-viewport (min-width: ${viewTablet + 1}px) {
383
+ .nav-head:not(.is-nav-left) {
384
+ .nav-head-content {
385
+ --icon-text-padding: min(8px, 0.5cqw);
386
+ --padding-side: min(20px, 1.3cqw);
387
+ }
388
+ .nav-head-logo {
389
+ padding: 0 var(--padding-side);
390
+ }
391
+ &.has-max-width {
392
+ .desktop-grow {
393
+ display: block !important;
394
+ }
395
+ .desktop-grow,
396
+ .nav-head-secondary {
397
+ flex-grow: 1;
398
+ }
399
+ }
381
400
  }
382
401
  }
383
- @container container-viewport (max-width: ${containerQuerySmallNav}px) {
384
- .grow-half {
385
- flex-grow: 1 !important;
402
+ `
403
+
404
+ // Desktop
405
+ if (!isNavLeftAlwaysHidden(pageContext)) {
406
+ style += css`
407
+ @container container-viewport (min-width: ${viewDesktop}px) {
408
+ .nav-head:not(.is-nav-left) {
409
+ display: none !important;
386
410
  }
387
- .nav-logo {
388
- justify-content: center;
389
- padding: 0;
390
- margin: 0;
411
+ .nav-head.is-nav-left {
412
+ .nav-head-content {
413
+ --icon-text-padding: min(8px, 7 * (1cqw - 2.5px));
414
+ & > :not(.always-shown) {
415
+ --padding-side: min(24px, 27 * (1cqw - 2.5px));
416
+ }
417
+ & > * {
418
+ flex-grow: 0.5;
419
+ }
420
+ & > .nav-head-menu-toggle {
421
+ flex-grow: 1;
422
+ }
423
+ }
424
+ .nav-head-logo {
425
+ padding-left: 15px;
426
+ margin-left: -15px;
427
+ }
391
428
  }
392
- }
393
- @container container-nav-head (min-width: 501px) {
394
- .nav-head-content {
395
- --padding-side: 24px;
429
+ .show-on-nav-hover {
430
+ opacity: 0;
431
+ transition-property: opacity;
432
+ pointer-events: none;
396
433
  }
397
- .nav-logo {
398
- padding: 0 var(--padding-side);
434
+ html:not(.unexpand-nav) {
435
+ & .nav-head.is-nav-left:hover .show-on-nav-hover,
436
+ &:has(.nav-head:hover) #menu-modal-wrapper.show-on-nav-hover,
437
+ &.menu-modal-show .nav-head.is-nav-left .show-on-nav-hover,
438
+ &.menu-modal-show #menu-modal-wrapper.show-on-nav-hover {
439
+ opacity: 1;
440
+ pointer-events: all;
441
+ }
399
442
  }
400
443
  }
401
- @container container-nav-head (min-width: ${containerQueryMobileNav + 150}px) {
402
- .nav-head-content {
403
- --padding-side: 25px;
444
+ @container container-viewport (max-width: ${viewDesktop - 1}px) {
445
+ #nav-left, #nav-left-margin {
446
+ display: none;
404
447
  }
405
- }
406
- @media(max-width: ${containerQueryMobileNav}px) {
407
- .hide-on-shrink {
408
- display: none !important;
448
+ body {
449
+ --main-view-padding: 10px !important;
409
450
  }
410
- }
411
- `
412
- if (navMaxWidth) {
413
- style += css`
414
- @media(min-width: ${containerQueryMobileNav + 1}px) {
415
- .desktop-grow {
451
+ .page-wrapper {
416
452
  flex-grow: 1;
453
+ align-items: center;
417
454
  }
418
- }
419
- `
420
- }
421
- if (isLandingPage && !navMaxWidth)
422
- style += css`
423
- @media(min-width: ${containerQueryMobileNav + 1}px) {
424
- .nav-logo {
425
- display: none !important;
455
+ .page-content {
456
+ margin: auto;
457
+ }
458
+ #menu-modal-wrapper {
459
+ position: absolute !important;
426
460
  }
427
461
  }
428
462
  `
429
- if (isNavLeft) {
430
- style += css`
431
-
432
- .show-on-nav-hover {
433
- opacity: 0;
434
- transition-property: opacity;
435
- pointer-events: none;
436
- }
437
- html:not(.unexpand-nav) :has(.nav-head-top:hover) .show-on-nav-hover,
438
- html:not(.unexpand-nav) :has(.show-on-nav-hover:hover) .show-on-nav-hover,
439
- html:not(.unexpand-nav).menu-modal-show .show-on-nav-hover {
440
- opacity: 1;
441
- pointer-events: all;
442
- }
443
- `
444
- }
445
- return style
446
463
  }
464
+
465
+ return style
447
466
  }
467
+
448
468
  function unexpandNav() {
449
469
  document.documentElement.classList.add('unexpand-nav')
450
470
  // Using setTimeout() because requestAnimationFrame() doesn't delay enough
@@ -453,11 +473,11 @@ function unexpandNav() {
453
473
  }, 1000)
454
474
  }
455
475
 
456
- function NavHeaderLeftFullWidthBackground() {
476
+ function NavHeadLeftFullWidthBackground() {
457
477
  return (
458
478
  <>
459
479
  <div
460
- className="nav-bg show-on-nav-hover add-transition"
480
+ className="nav-head-bg show-on-nav-hover add-transition"
461
481
  style={{
462
482
  height: '100%',
463
483
  zIndex: -1,
@@ -473,7 +493,7 @@ function NavHeaderLeftFullWidthBackground() {
473
493
  // (min-width: 0px) => trick to always apply => @container seems to always require a condition
474
494
  css`
475
495
  @container container-viewport (min-width: 0px) {
476
- .nav-bg {
496
+ .nav-head-bg {
477
497
  width: 100cqw;
478
498
  }
479
499
  }
@@ -483,7 +503,7 @@ function NavHeaderLeftFullWidthBackground() {
483
503
  )
484
504
  }
485
505
 
486
- function NavLogo({ className }: { className: string }) {
506
+ function NavHeadLogo({ className }: { className?: string }) {
487
507
  const pageContext = usePageContext()
488
508
 
489
509
  const { navLogo } = pageContext.globalContext.config.docpress
@@ -517,7 +537,7 @@ function NavLogo({ className }: { className: string }) {
517
537
 
518
538
  return (
519
539
  <a
520
- className={cls(['nav-logo', className])}
540
+ className={cls(['nav-head-logo', className])}
521
541
  style={{
522
542
  display: 'flex',
523
543
  alignItems: 'center',
@@ -554,12 +574,12 @@ function MenuToggleMain(props: PropsDiv) {
554
574
  <MenuIcon /> Menu
555
575
  </span>
556
576
  <Style>{css`
557
- @media(max-width: ${containerQueryMobileNav}px) {
577
+ @container container-viewport (max-width: ${viewTablet}px) {
558
578
  .text-docs, .caret-icon {
559
579
  display: none !important;
560
580
  }
561
581
  }
562
- @media(min-width: ${containerQueryMobileNav + 1}px) {
582
+ @container container-viewport (min-width: ${viewTablet + 1}px) {
563
583
  .text-menu {
564
584
  display: none;
565
585
  }
@@ -588,10 +608,12 @@ function MenuToggle({ menuId, ...props }: PropsDiv & { menuId: number }) {
588
608
  }}
589
609
  onMouseEnter={() => {
590
610
  if (onMouseIgnore) return
611
+ if (isMobileNav()) return
591
612
  openMenuModal(menuId)
592
613
  }}
593
614
  onMouseLeave={() => {
594
615
  if (onMouseIgnore) return
616
+ if (isMobileNav()) return
595
617
  coseMenuModalOnMouseLeave(menuId)
596
618
  }}
597
619
  onTouchStart={() => {
@@ -605,11 +627,11 @@ function MenuToggle({ menuId, ...props }: PropsDiv & { menuId: number }) {
605
627
  <CaretIcon
606
628
  style={{
607
629
  width: 11,
608
- marginLeft: 10,
630
+ marginLeft: 'calc(var(--icon-text-padding) - 1px)',
609
631
  flexShrink: 0,
610
632
  color: '#888',
611
633
  position: 'relative',
612
- top: -1,
634
+ top: 1,
613
635
  }}
614
636
  />
615
637
  </div>
@@ -687,7 +709,7 @@ function DocsIcon() {
687
709
  <img
688
710
  src={iconBooks}
689
711
  width={18}
690
- style={{ marginRight: 'calc(var(--icon-text-padding) + 2px)' }}
712
+ style={{ marginRight: 'calc(var(--icon-text-padding) + 2px)', position: 'relative', top: 2 }}
691
713
  className="decolorize-5"
692
714
  />
693
715
  )
@@ -706,3 +728,7 @@ function MenuIcon() {
706
728
  </svg>
707
729
  )
708
730
  }
731
+
732
+ function isMobileNav() {
733
+ return window.innerWidth <= viewTablet
734
+ }