@brillout/docpress 0.15.13-commit-03246ec → 0.15.13-commit-9b3f898
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/Layout.tsx +31 -22
- package/installSectionUrlHashs.ts +3 -1
- package/package.json +1 -1
package/Layout.tsx
CHANGED
|
@@ -26,7 +26,6 @@ import { Style } from './utils/Style'
|
|
|
26
26
|
import { cls } from './utils/cls'
|
|
27
27
|
import { iconBooks } from './icons'
|
|
28
28
|
import { EditLink } from './EditLink'
|
|
29
|
-
import type { PageContext } from 'vike/types'
|
|
30
29
|
|
|
31
30
|
const blockMargin = 3
|
|
32
31
|
const mainViewPadding = 20
|
|
@@ -89,12 +88,16 @@ function LayoutDocsPage({ children }: { children: React.ReactNode }) {
|
|
|
89
88
|
return (
|
|
90
89
|
<>
|
|
91
90
|
<div style={{ display: 'flex', ...whitespaceBuster2 }}>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
{!isNavLeftAlwaysHidden() && (
|
|
92
|
+
<>
|
|
93
|
+
<NavLeft />
|
|
94
|
+
<div
|
|
95
|
+
id="nav-left-margin"
|
|
96
|
+
className="low-prio-grow"
|
|
97
|
+
style={{ width: 0, maxWidth: 50, background: 'var(--bg-color)' }}
|
|
98
|
+
/>
|
|
99
|
+
</>
|
|
100
|
+
)}
|
|
98
101
|
<PageContent>{children}</PageContent>
|
|
99
102
|
</div>
|
|
100
103
|
<Style>{css`
|
|
@@ -181,7 +184,7 @@ function NavLeft() {
|
|
|
181
184
|
top: 0,
|
|
182
185
|
}}
|
|
183
186
|
>
|
|
184
|
-
|
|
187
|
+
<NavHead isNavLeft={true} />
|
|
185
188
|
<div
|
|
186
189
|
style={{
|
|
187
190
|
backgroundColor: 'var(--bg-color)',
|
|
@@ -234,7 +237,8 @@ function NavigationContent(props: {
|
|
|
234
237
|
)
|
|
235
238
|
}
|
|
236
239
|
|
|
237
|
-
function isNavLeftAlwaysHidden(
|
|
240
|
+
function isNavLeftAlwaysHidden() {
|
|
241
|
+
const pageContext = usePageContext()
|
|
238
242
|
const { isLandingPage, navItemsDetached, pageDesign } = pageContext.resolved
|
|
239
243
|
return isLandingPage || pageDesign?.hideMenuLeft || (navItemsDetached && navItemsDetached.length <= 1)
|
|
240
244
|
}
|
|
@@ -328,8 +332,6 @@ function NavHead({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
328
332
|
)
|
|
329
333
|
}
|
|
330
334
|
function getStyleNav() {
|
|
331
|
-
const pageContext = usePageContext()
|
|
332
|
-
|
|
333
335
|
let style = ''
|
|
334
336
|
|
|
335
337
|
// Mobile
|
|
@@ -402,7 +404,7 @@ function getStyleNav() {
|
|
|
402
404
|
`
|
|
403
405
|
|
|
404
406
|
// Desktop
|
|
405
|
-
if (!isNavLeftAlwaysHidden(
|
|
407
|
+
if (!isNavLeftAlwaysHidden()) {
|
|
406
408
|
style += css`
|
|
407
409
|
@container container-viewport (min-width: ${viewDesktop}px) {
|
|
408
410
|
.nav-head:not(.is-nav-left) {
|
|
@@ -448,22 +450,29 @@ function getStyleNav() {
|
|
|
448
450
|
body {
|
|
449
451
|
--main-view-padding: 10px !important;
|
|
450
452
|
}
|
|
451
|
-
|
|
452
|
-
flex-grow: 1;
|
|
453
|
-
align-items: center;
|
|
454
|
-
}
|
|
455
|
-
.page-content {
|
|
456
|
-
margin: auto;
|
|
457
|
-
}
|
|
458
|
-
#menu-modal-wrapper {
|
|
459
|
-
position: absolute !important;
|
|
460
|
-
}
|
|
453
|
+
${getStyleNavLeftHidden()}
|
|
461
454
|
}
|
|
462
455
|
`
|
|
456
|
+
} else {
|
|
457
|
+
style += getStyleNavLeftHidden()
|
|
463
458
|
}
|
|
464
459
|
|
|
465
460
|
return style
|
|
466
461
|
}
|
|
462
|
+
function getStyleNavLeftHidden() {
|
|
463
|
+
return css`
|
|
464
|
+
.page-wrapper {
|
|
465
|
+
flex-grow: 1;
|
|
466
|
+
align-items: center;
|
|
467
|
+
}
|
|
468
|
+
.page-content {
|
|
469
|
+
margin: auto;
|
|
470
|
+
}
|
|
471
|
+
#menu-modal-wrapper {
|
|
472
|
+
position: absolute !important;
|
|
473
|
+
}
|
|
474
|
+
`
|
|
475
|
+
}
|
|
467
476
|
|
|
468
477
|
function unexpandNav() {
|
|
469
478
|
document.documentElement.classList.add('unexpand-nav')
|
|
@@ -28,7 +28,9 @@ function installSectionUrlHashs() {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function assertNavLink(urlHash: string, heading: HTMLHeadingElement) {
|
|
31
|
-
const
|
|
31
|
+
const navigationContainerEl = document.querySelector('#nav-left')
|
|
32
|
+
if (!navigationContainerEl) return
|
|
33
|
+
const navigationEl = navigationContainerEl.querySelector('.navigation-content')!
|
|
32
34
|
{
|
|
33
35
|
const { pathname } = window.location
|
|
34
36
|
const parentNavLinkMatch = Array.from(navigationEl.querySelectorAll(`a[href="${pathname}"]`))
|