@brillout/docpress 0.15.13-commit-39924f0 → 0.15.13-commit-5e3f8e9
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/EditLink.tsx +27 -5
- package/Layout.tsx +15 -10
- package/MenuModal.tsx +17 -1
- package/code-blocks/components/Pre.tsx +1 -1
- package/css/tooltip.css +3 -2
- package/package.json +1 -1
package/EditLink.tsx
CHANGED
|
@@ -5,16 +5,20 @@ import { usePageContext } from './renderer/usePageContext'
|
|
|
5
5
|
import { iconPencil } from './icons'
|
|
6
6
|
import { getRepoHref } from './components'
|
|
7
7
|
|
|
8
|
-
function EditLink({
|
|
8
|
+
function EditLink({
|
|
9
|
+
className,
|
|
10
|
+
style,
|
|
11
|
+
verbose,
|
|
12
|
+
}: { className?: string; style: React.CSSProperties; verbose?: boolean }) {
|
|
9
13
|
const pageContext = usePageContext()
|
|
10
|
-
const iconSize =
|
|
14
|
+
const iconSize = 13
|
|
11
15
|
const icon = (
|
|
12
16
|
<img
|
|
13
17
|
src={iconPencil}
|
|
14
18
|
width={iconSize}
|
|
15
19
|
height={iconSize}
|
|
16
20
|
style={{
|
|
17
|
-
marginRight:
|
|
21
|
+
marginRight: 6,
|
|
18
22
|
position: 'relative',
|
|
19
23
|
top: -1,
|
|
20
24
|
}}
|
|
@@ -25,8 +29,26 @@ function EditLink({ className, style }: { className?: string; style: React.CSSPr
|
|
|
25
29
|
const docsDir = pageContext.globalContext.config.docpress.docsDir ?? 'docs'
|
|
26
30
|
const editLink = getRepoHref(`/${docsDir}/pages${fsPath}`, true)
|
|
27
31
|
return (
|
|
28
|
-
<a
|
|
29
|
-
{
|
|
32
|
+
<a
|
|
33
|
+
href={editLink}
|
|
34
|
+
className={className}
|
|
35
|
+
style={{
|
|
36
|
+
display: 'inline-flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
paddingTop: 4,
|
|
39
|
+
paddingBottom: 2,
|
|
40
|
+
paddingLeft: 9,
|
|
41
|
+
paddingRight: 8,
|
|
42
|
+
border: '1px solid #e0e0e0',
|
|
43
|
+
borderRadius: 7,
|
|
44
|
+
fontSize: '0.91em',
|
|
45
|
+
color: '#6c6c6c',
|
|
46
|
+
background: '#f8f8f8',
|
|
47
|
+
letterSpacing: 0.4,
|
|
48
|
+
...style,
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{icon} Edit{verbose ? ' this page' : ''}
|
|
30
52
|
</a>
|
|
31
53
|
)
|
|
32
54
|
}
|
package/Layout.tsx
CHANGED
|
@@ -7,7 +7,9 @@ export { navLeftWidthMax }
|
|
|
7
7
|
export { unexpandNav }
|
|
8
8
|
export { blockMargin }
|
|
9
9
|
|
|
10
|
-
// -
|
|
10
|
+
// - @media VS @container
|
|
11
|
+
// - Using `@container container-viewport` instead of @media would be interesting because @media doesn't consider the scrollbar width.
|
|
12
|
+
// - But we still use @media because using @container is complicated(/buggy?) to use inside <MenuModal> because of `position: fixed`.
|
|
11
13
|
// - 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
14
|
|
|
13
15
|
import React from 'react'
|
|
@@ -39,7 +41,7 @@ const mainViewWidthMax = (mainViewWidthMaxInner + mainViewPadding * 2) as 840 //
|
|
|
39
41
|
const navLeftWidthMin = 300
|
|
40
42
|
const navLeftWidthMax = 370
|
|
41
43
|
const viewMobile = 450
|
|
42
|
-
const viewTablet =
|
|
44
|
+
const viewTablet = 1016
|
|
43
45
|
const viewDesktop = (mainViewWidthMax + navLeftWidthMin) as 1140 // 1140 = 840 + 300
|
|
44
46
|
const viewDesktopLarge = (mainViewWidthMax + navLeftWidthMax + blockMargin) as 1213 // 1213 = 840 + 370 + 3
|
|
45
47
|
|
|
@@ -159,7 +161,7 @@ function PageContent({ children }: { children: React.ReactNode }) {
|
|
|
159
161
|
{/* globalNote */}
|
|
160
162
|
{pageTitleParsed && !pageContext.resolved.pageDesign?.hideTitle && (
|
|
161
163
|
<div>
|
|
162
|
-
<EditLink className="show-only-on-desktop" style={{ float: 'right', marginTop:
|
|
164
|
+
<EditLink className="show-only-on-desktop" style={{ float: 'right', marginTop: 13 }} />
|
|
163
165
|
<h1 id={`${pageContext.urlPathname.replace('/', '')}`}>{pageTitleParsed}</h1>
|
|
164
166
|
</div>
|
|
165
167
|
)}
|
|
@@ -341,7 +343,7 @@ function getStyleNav() {
|
|
|
341
343
|
|
|
342
344
|
// Mobile
|
|
343
345
|
style += css`
|
|
344
|
-
@
|
|
346
|
+
@media(max-width: ${viewMobile}px) {
|
|
345
347
|
.nav-head:not(.is-nav-left) {
|
|
346
348
|
.nav-head-menu-toggle {
|
|
347
349
|
justify-content: flex-end !important;
|
|
@@ -358,7 +360,7 @@ function getStyleNav() {
|
|
|
358
360
|
|
|
359
361
|
// Mobile + tablet
|
|
360
362
|
style += css`
|
|
361
|
-
@
|
|
363
|
+
@media(max-width: ${viewTablet}px) {
|
|
362
364
|
.nav-head:not(.is-nav-left) {
|
|
363
365
|
.nav-head-secondary {
|
|
364
366
|
display: none !important;
|
|
@@ -368,7 +370,7 @@ function getStyleNav() {
|
|
|
368
370
|
|
|
369
371
|
// Tablet
|
|
370
372
|
style += css`
|
|
371
|
-
@
|
|
373
|
+
@media(max-width: ${viewTablet}px) and (min-width: ${viewMobile + 1}px) {
|
|
372
374
|
.nav-head:not(.is-nav-left) {
|
|
373
375
|
.nav-head-content {
|
|
374
376
|
--icon-text-padding: 8px;
|
|
@@ -379,7 +381,7 @@ function getStyleNav() {
|
|
|
379
381
|
|
|
380
382
|
// Desktop small + desktop
|
|
381
383
|
style += css`
|
|
382
|
-
@
|
|
384
|
+
@media(min-width: ${viewTablet + 1}px) {
|
|
383
385
|
.nav-head:not(.is-nav-left) {
|
|
384
386
|
.nav-head-content {
|
|
385
387
|
--icon-text-padding: min(8px, 0.5cqw);
|
|
@@ -547,7 +549,10 @@ function NavHeadLogo({ isNavLeft }: { isNavLeft?: true }) {
|
|
|
547
549
|
paddingLeft: 'var(--main-view-padding)',
|
|
548
550
|
paddingRight: 'var(--padding-side)',
|
|
549
551
|
}
|
|
550
|
-
: {
|
|
552
|
+
: {
|
|
553
|
+
paddingLeft: 15,
|
|
554
|
+
marginLeft: -10,
|
|
555
|
+
}),
|
|
551
556
|
}}
|
|
552
557
|
href="/"
|
|
553
558
|
onContextMenu={!navLogo ? undefined : onContextMenu}
|
|
@@ -578,12 +583,12 @@ function MenuToggleMain(props: PropsDiv) {
|
|
|
578
583
|
<MenuIcon /> Menu
|
|
579
584
|
</span>
|
|
580
585
|
<Style>{css`
|
|
581
|
-
@
|
|
586
|
+
@media(max-width: ${viewTablet}px) {
|
|
582
587
|
.text-docs, .caret-icon {
|
|
583
588
|
display: none !important;
|
|
584
589
|
}
|
|
585
590
|
}
|
|
586
|
-
@
|
|
591
|
+
@media(min-width: ${viewTablet + 1}px) {
|
|
587
592
|
.text-menu {
|
|
588
593
|
display: none;
|
|
589
594
|
}
|
package/MenuModal.tsx
CHANGED
|
@@ -50,7 +50,9 @@ function MenuModal({ isTopNav }: { isTopNav: boolean }) {
|
|
|
50
50
|
>
|
|
51
51
|
<ExternalLinks style={{ height: 50 }} />
|
|
52
52
|
</div>
|
|
53
|
-
<
|
|
53
|
+
<Center>
|
|
54
|
+
<EditLink style={{ justifyContent: 'center', marginTop: 8, marginBottom: 20 }} verbose />
|
|
55
|
+
</Center>
|
|
54
56
|
</div>
|
|
55
57
|
</div>
|
|
56
58
|
<CloseButton className="show-only-on-mobile" />
|
|
@@ -176,3 +178,17 @@ function CloseButton({ className }: { className: string }) {
|
|
|
176
178
|
</div>
|
|
177
179
|
)
|
|
178
180
|
}
|
|
181
|
+
|
|
182
|
+
function Center({ style, ...props }: any) {
|
|
183
|
+
return (
|
|
184
|
+
<div
|
|
185
|
+
style={{
|
|
186
|
+
display: 'flex',
|
|
187
|
+
justifyContent: 'center',
|
|
188
|
+
alignItems: 'center',
|
|
189
|
+
...style,
|
|
190
|
+
}}
|
|
191
|
+
{...props}
|
|
192
|
+
></div>
|
|
193
|
+
)
|
|
194
|
+
}
|
package/css/tooltip.css
CHANGED
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
top: 100%;
|
|
38
38
|
margin-top: 5px;
|
|
39
39
|
}
|
|
40
|
-
/* Show above */
|
|
41
|
-
[aria-label][data-label-position='top']::before {
|
|
40
|
+
/* Show above-left */
|
|
41
|
+
[aria-label][data-label-position='top-left']::before {
|
|
42
42
|
bottom: 100%;
|
|
43
43
|
margin-bottom: 7px;
|
|
44
|
+
transform: translate(calc(-100% + 25px), 0);
|
|
44
45
|
}
|
|
45
46
|
}
|