@docusaurus/theme-classic 0.0.0-4701 → 0.0.0-4707
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/lib/theme-classic.d.ts +36 -0
- package/lib-next/theme/BackToTopButton/index.js +1 -3
- package/lib-next/theme/BlogPostItem/index.js +4 -3
- package/lib-next/theme/ColorModeToggle/index.js +7 -5
- package/lib-next/theme/DocItem/index.js +1 -4
- package/lib-next/theme/DocPage/index.js +7 -10
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/lib-next/theme/DocSidebar/Desktop/Content/index.js +46 -0
- package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
- package/lib-next/theme/DocSidebar/Desktop/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/lib-next/theme/DocSidebar/Mobile/index.js +45 -0
- package/lib-next/theme/DocSidebar/index.js +6 -113
- package/lib-next/theme/Heading/index.js +6 -4
- package/lib-next/theme/Navbar/index.js +13 -7
- package/lib-next/theme/TOCCollapsible/index.js +1 -3
- package/lib-next/theme/Tag/index.js +4 -4
- package/package.json +13 -13
- package/src/theme/BackToTopButton/index.tsx +1 -3
- package/src/theme/BlogPostItem/index.tsx +4 -3
- package/src/theme/ColorModeToggle/index.tsx +7 -5
- package/src/theme/DocItem/index.tsx +1 -4
- package/src/theme/DocPage/index.tsx +7 -10
- package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/src/theme/DocSidebar/Desktop/Content/index.tsx +55 -0
- package/src/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
- package/src/theme/DocSidebar/Desktop/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/src/theme/DocSidebar/Mobile/index.tsx +51 -0
- package/src/theme/DocSidebar/index.tsx +6 -121
- package/src/theme/Heading/index.tsx +6 -4
- package/src/theme/Navbar/index.tsx +13 -7
- package/src/theme/TOCCollapsible/index.tsx +1 -3
- package/src/theme/Tag/index.tsx +4 -4
- package/src/theme-classic.d.ts +36 -0
- package/lib-next/theme/DocSidebar/styles.module.css +0 -107
- package/src/theme/DocSidebar/styles.module.css +0 -107
package/lib/theme-classic.d.ts
CHANGED
|
@@ -180,6 +180,42 @@ declare module '@theme/DocSidebar' {
|
|
|
180
180
|
export default function DocSidebar(props: Props): JSX.Element;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
declare module '@theme/DocSidebar/Mobile' {
|
|
184
|
+
import type {Props as DocSidebarProps} from '@theme/DocSidebar';
|
|
185
|
+
|
|
186
|
+
export interface Props extends DocSidebarProps {}
|
|
187
|
+
|
|
188
|
+
export default function DocSidebarMobile(props: Props): JSX.Element;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
declare module '@theme/DocSidebar/Desktop' {
|
|
192
|
+
import type {Props as DocSidebarProps} from '@theme/DocSidebar';
|
|
193
|
+
|
|
194
|
+
export interface Props extends DocSidebarProps {}
|
|
195
|
+
|
|
196
|
+
export default function DocSidebarDesktop(props: Props): JSX.Element;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare module '@theme/DocSidebar/Desktop/Content' {
|
|
200
|
+
import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
|
|
201
|
+
|
|
202
|
+
export interface Props {
|
|
203
|
+
readonly className?: string;
|
|
204
|
+
readonly path: string;
|
|
205
|
+
readonly sidebar: readonly PropSidebarItem[];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export default function CollapseButton(props: Props): JSX.Element;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare module '@theme/DocSidebar/Desktop/CollapseButton' {
|
|
212
|
+
export interface Props {
|
|
213
|
+
onClick: React.MouseEventHandler;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export default function CollapseButton(props: Props): JSX.Element;
|
|
217
|
+
}
|
|
218
|
+
|
|
183
219
|
declare module '@theme/DocSidebarItem' {
|
|
184
220
|
import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
|
|
185
221
|
|
|
@@ -120,9 +120,7 @@ export default function BackToTopButton() {
|
|
|
120
120
|
'clean-btn',
|
|
121
121
|
ThemeClassNames.common.backToTopButton,
|
|
122
122
|
styles.backToTopButton,
|
|
123
|
-
|
|
124
|
-
[styles.backToTopButtonShow]: show,
|
|
125
|
-
},
|
|
123
|
+
show && styles.backToTopButtonShow,
|
|
126
124
|
)}
|
|
127
125
|
type="button"
|
|
128
126
|
onClick={() => smoothScrollTop()}
|
|
@@ -112,9 +112,10 @@ export default function BlogPostItem(props) {
|
|
|
112
112
|
|
|
113
113
|
{(tagsExists || truncated) && (
|
|
114
114
|
<footer
|
|
115
|
-
className={clsx(
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
className={clsx(
|
|
116
|
+
'row docusaurus-mt-lg',
|
|
117
|
+
isBlogPostPage && styles.blogPostDetailsFull,
|
|
118
|
+
)}>
|
|
118
119
|
{tagsExists && (
|
|
119
120
|
<div
|
|
120
121
|
className={clsx('col', {
|
|
@@ -22,11 +22,13 @@ function ColorModeToggle({className, checked: defaultChecked, onChange}) {
|
|
|
22
22
|
}, [defaultChecked]);
|
|
23
23
|
return (
|
|
24
24
|
<div
|
|
25
|
-
className={clsx(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
className={clsx(
|
|
26
|
+
styles.toggle,
|
|
27
|
+
className,
|
|
28
|
+
checked && styles.toggleChecked,
|
|
29
|
+
focused && styles.toggleFocused,
|
|
30
|
+
!isBrowser && styles.toggleDisabled,
|
|
31
|
+
)}>
|
|
30
32
|
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
|
|
31
33
|
<div
|
|
32
34
|
className={styles.toggleButton}
|
|
@@ -52,10 +52,7 @@ export default function DocItem(props) {
|
|
|
52
52
|
/>
|
|
53
53
|
|
|
54
54
|
<div className="row">
|
|
55
|
-
<div
|
|
56
|
-
className={clsx('col', {
|
|
57
|
-
[styles.docItemCol]: !hideTableOfContents,
|
|
58
|
-
})}>
|
|
55
|
+
<div className={clsx('col', !hideTableOfContents && styles.docItemCol)}>
|
|
59
56
|
<DocVersionBanner />
|
|
60
57
|
<div className={styles.docItemContainer}>
|
|
61
58
|
<article>
|
|
@@ -57,9 +57,7 @@ function DocPageContent({
|
|
|
57
57
|
className={clsx(
|
|
58
58
|
ThemeClassNames.docs.docSidebarContainer,
|
|
59
59
|
styles.docSidebarContainer,
|
|
60
|
-
|
|
61
|
-
[styles.docSidebarContainerHidden]: hiddenSidebarContainer,
|
|
62
|
-
},
|
|
60
|
+
hiddenSidebarContainer && styles.docSidebarContainerHidden,
|
|
63
61
|
)}
|
|
64
62
|
onTransitionEnd={(e) => {
|
|
65
63
|
if (
|
|
@@ -109,17 +107,16 @@ function DocPageContent({
|
|
|
109
107
|
</aside>
|
|
110
108
|
)}
|
|
111
109
|
<main
|
|
112
|
-
className={clsx(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
className={clsx(
|
|
111
|
+
styles.docMainContainer,
|
|
112
|
+
(hiddenSidebarContainer || !sidebar) &&
|
|
113
|
+
styles.docMainContainerEnhanced,
|
|
114
|
+
)}>
|
|
116
115
|
<div
|
|
117
116
|
className={clsx(
|
|
118
117
|
'container padding-top--md padding-bottom--lg',
|
|
119
118
|
styles.docItemWrapper,
|
|
120
|
-
|
|
121
|
-
[styles.docItemWrapperEnhanced]: hiddenSidebarContainer,
|
|
122
|
-
},
|
|
119
|
+
hiddenSidebarContainer && styles.docItemWrapperEnhanced,
|
|
123
120
|
)}>
|
|
124
121
|
{children}
|
|
125
122
|
</div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import IconArrow from '@theme/IconArrow';
|
|
10
|
+
import {translate} from '@docusaurus/Translate';
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
|
+
export default function CollapseButton({onClick}) {
|
|
13
|
+
return (
|
|
14
|
+
<button
|
|
15
|
+
type="button"
|
|
16
|
+
title={translate({
|
|
17
|
+
id: 'theme.docs.sidebar.collapseButtonTitle',
|
|
18
|
+
message: 'Collapse sidebar',
|
|
19
|
+
description: 'The title attribute for collapse button of doc sidebar',
|
|
20
|
+
})}
|
|
21
|
+
aria-label={translate({
|
|
22
|
+
id: 'theme.docs.sidebar.collapseButtonAriaLabel',
|
|
23
|
+
message: 'Collapse sidebar',
|
|
24
|
+
description: 'The title attribute for collapse button of doc sidebar',
|
|
25
|
+
})}
|
|
26
|
+
className={clsx(
|
|
27
|
+
'button button--secondary button--outline',
|
|
28
|
+
styles.collapseSidebarButton,
|
|
29
|
+
)}
|
|
30
|
+
onClick={onClick}>
|
|
31
|
+
<IconArrow className={styles.collapseSidebarButtonIcon} />
|
|
32
|
+
</button>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
:root {
|
|
9
|
+
--collapse-button-bg-color-dark: #2e333a;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@media (min-width: 997px) {
|
|
13
|
+
.collapseSidebarButton {
|
|
14
|
+
display: block !important;
|
|
15
|
+
background-color: var(--ifm-button-background-color);
|
|
16
|
+
height: 40px;
|
|
17
|
+
position: sticky;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
border-radius: 0;
|
|
20
|
+
border: 1px solid var(--ifm-toc-border-color);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.collapseSidebarButtonIcon {
|
|
24
|
+
transform: rotate(180deg);
|
|
25
|
+
margin-top: 4px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[dir='rtl'] .collapseSidebarButtonIcon {
|
|
29
|
+
transform: rotate(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[data-theme='dark'] .collapseSidebarButton {
|
|
33
|
+
background-color: var(--collapse-button-bg-color-dark);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-theme='dark'] .collapseSidebarButton:hover,
|
|
37
|
+
[data-theme='dark'] .collapseSidebarButton:focus {
|
|
38
|
+
background-color: var(--ifm-color-emphasis-200);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.collapseSidebarButton {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, {useState} from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import {
|
|
10
|
+
ThemeClassNames,
|
|
11
|
+
useAnnouncementBar,
|
|
12
|
+
useScrollPosition,
|
|
13
|
+
} from '@docusaurus/theme-common';
|
|
14
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
15
|
+
import styles from './styles.module.css';
|
|
16
|
+
|
|
17
|
+
function useShowAnnouncementBar() {
|
|
18
|
+
const {isActive} = useAnnouncementBar();
|
|
19
|
+
const [showAnnouncementBar, setShowAnnouncementBar] = useState(isActive);
|
|
20
|
+
useScrollPosition(
|
|
21
|
+
({scrollY}) => {
|
|
22
|
+
if (isActive) {
|
|
23
|
+
setShowAnnouncementBar(scrollY === 0);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
[isActive],
|
|
27
|
+
);
|
|
28
|
+
return isActive && showAnnouncementBar;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default function DocSidebarDesktopContent({path, sidebar, className}) {
|
|
32
|
+
const showAnnouncementBar = useShowAnnouncementBar();
|
|
33
|
+
return (
|
|
34
|
+
<nav
|
|
35
|
+
className={clsx(
|
|
36
|
+
'menu thin-scrollbar',
|
|
37
|
+
styles.menu,
|
|
38
|
+
showAnnouncementBar && styles.menuWithAnnouncementBar,
|
|
39
|
+
className,
|
|
40
|
+
)}>
|
|
41
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
42
|
+
<DocSidebarItems items={sidebar} activePath={path} level={1} />
|
|
43
|
+
</ul>
|
|
44
|
+
</nav>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@media (min-width: 997px) {
|
|
9
|
+
.menu {
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
padding: 0.5rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.menuWithAnnouncementBar {
|
|
15
|
+
margin-bottom: var(--docusaurus-announcement-bar-height);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
10
|
+
import Logo from '@theme/Logo';
|
|
11
|
+
import CollapseButton from '@theme/DocSidebar/Desktop/CollapseButton';
|
|
12
|
+
import Content from '@theme/DocSidebar/Desktop/Content';
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
|
|
15
|
+
function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}) {
|
|
16
|
+
const {
|
|
17
|
+
navbar: {hideOnScroll},
|
|
18
|
+
hideableSidebar,
|
|
19
|
+
} = useThemeConfig();
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
className={clsx(
|
|
23
|
+
styles.sidebar,
|
|
24
|
+
hideOnScroll && styles.sidebarWithHideableNavbar,
|
|
25
|
+
isHidden && styles.sidebarHidden,
|
|
26
|
+
)}>
|
|
27
|
+
{hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
|
|
28
|
+
<Content path={path} sidebar={sidebar} />
|
|
29
|
+
{hideableSidebar && <CollapseButton onClick={onCollapse} />}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default React.memo(DocSidebarDesktop);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@media (min-width: 997px) {
|
|
9
|
+
.sidebar {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
max-height: 100vh;
|
|
13
|
+
height: 100%;
|
|
14
|
+
position: sticky;
|
|
15
|
+
top: 0;
|
|
16
|
+
padding-top: var(--ifm-navbar-height);
|
|
17
|
+
width: var(--doc-sidebar-width);
|
|
18
|
+
transition: opacity 50ms ease;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sidebarWithHideableNavbar {
|
|
22
|
+
padding-top: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.sidebarHidden {
|
|
26
|
+
opacity: 0;
|
|
27
|
+
height: 0;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
visibility: hidden;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sidebarLogo {
|
|
33
|
+
display: flex !important;
|
|
34
|
+
align-items: center;
|
|
35
|
+
margin: 0 var(--ifm-navbar-padding-horizontal);
|
|
36
|
+
min-height: var(--ifm-navbar-height);
|
|
37
|
+
max-height: var(--ifm-navbar-height);
|
|
38
|
+
color: inherit !important;
|
|
39
|
+
text-decoration: none !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.sidebarLogo img {
|
|
43
|
+
margin-right: 0.5rem;
|
|
44
|
+
height: 2rem;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sidebarLogo {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import {
|
|
10
|
+
MobileSecondaryMenuFiller,
|
|
11
|
+
ThemeClassNames,
|
|
12
|
+
} from '@docusaurus/theme-common';
|
|
13
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line react/function-component-definition
|
|
16
|
+
const DocSidebarMobileSecondaryMenu = ({toggleSidebar, sidebar, path}) => (
|
|
17
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
18
|
+
<DocSidebarItems
|
|
19
|
+
items={sidebar}
|
|
20
|
+
activePath={path}
|
|
21
|
+
onItemClick={(item) => {
|
|
22
|
+
// Mobile sidebar should only be closed if the category has a link
|
|
23
|
+
if (item.type === 'category' && item.href) {
|
|
24
|
+
toggleSidebar();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (item.type === 'link') {
|
|
28
|
+
toggleSidebar();
|
|
29
|
+
}
|
|
30
|
+
}}
|
|
31
|
+
level={1}
|
|
32
|
+
/>
|
|
33
|
+
</ul>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
function DocSidebarMobile(props) {
|
|
37
|
+
return (
|
|
38
|
+
<MobileSecondaryMenuFiller
|
|
39
|
+
component={DocSidebarMobileSecondaryMenu}
|
|
40
|
+
props={props}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default React.memo(DocSidebarMobile);
|
|
@@ -4,117 +4,10 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
useAnnouncementBar,
|
|
12
|
-
MobileSecondaryMenuFiller,
|
|
13
|
-
ThemeClassNames,
|
|
14
|
-
useScrollPosition,
|
|
15
|
-
useWindowSize,
|
|
16
|
-
} from '@docusaurus/theme-common';
|
|
17
|
-
import Logo from '@theme/Logo';
|
|
18
|
-
import IconArrow from '@theme/IconArrow';
|
|
19
|
-
import {translate} from '@docusaurus/Translate';
|
|
20
|
-
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
21
|
-
import styles from './styles.module.css';
|
|
22
|
-
|
|
23
|
-
function useShowAnnouncementBar() {
|
|
24
|
-
const {isActive} = useAnnouncementBar();
|
|
25
|
-
const [showAnnouncementBar, setShowAnnouncementBar] = useState(isActive);
|
|
26
|
-
useScrollPosition(
|
|
27
|
-
({scrollY}) => {
|
|
28
|
-
if (isActive) {
|
|
29
|
-
setShowAnnouncementBar(scrollY === 0);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
[isActive],
|
|
33
|
-
);
|
|
34
|
-
return isActive && showAnnouncementBar;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function HideableSidebarButton({onClick}) {
|
|
38
|
-
return (
|
|
39
|
-
<button
|
|
40
|
-
type="button"
|
|
41
|
-
title={translate({
|
|
42
|
-
id: 'theme.docs.sidebar.collapseButtonTitle',
|
|
43
|
-
message: 'Collapse sidebar',
|
|
44
|
-
description: 'The title attribute for collapse button of doc sidebar',
|
|
45
|
-
})}
|
|
46
|
-
aria-label={translate({
|
|
47
|
-
id: 'theme.docs.sidebar.collapseButtonAriaLabel',
|
|
48
|
-
message: 'Collapse sidebar',
|
|
49
|
-
description: 'The title attribute for collapse button of doc sidebar',
|
|
50
|
-
})}
|
|
51
|
-
className={clsx(
|
|
52
|
-
'button button--secondary button--outline',
|
|
53
|
-
styles.collapseSidebarButton,
|
|
54
|
-
)}
|
|
55
|
-
onClick={onClick}>
|
|
56
|
-
<IconArrow className={styles.collapseSidebarButtonIcon} />
|
|
57
|
-
</button>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}) {
|
|
62
|
-
const showAnnouncementBar = useShowAnnouncementBar();
|
|
63
|
-
const {
|
|
64
|
-
navbar: {hideOnScroll},
|
|
65
|
-
hideableSidebar,
|
|
66
|
-
} = useThemeConfig();
|
|
67
|
-
return (
|
|
68
|
-
<div
|
|
69
|
-
className={clsx(styles.sidebar, {
|
|
70
|
-
[styles.sidebarWithHideableNavbar]: hideOnScroll,
|
|
71
|
-
[styles.sidebarHidden]: isHidden,
|
|
72
|
-
})}>
|
|
73
|
-
{hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
|
|
74
|
-
<nav
|
|
75
|
-
className={clsx('menu thin-scrollbar', styles.menu, {
|
|
76
|
-
[styles.menuWithAnnouncementBar]: showAnnouncementBar,
|
|
77
|
-
})}>
|
|
78
|
-
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
79
|
-
<DocSidebarItems items={sidebar} activePath={path} level={1} />
|
|
80
|
-
</ul>
|
|
81
|
-
</nav>
|
|
82
|
-
{hideableSidebar && <HideableSidebarButton onClick={onCollapse} />}
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
} // eslint-disable-next-line react/function-component-definition
|
|
86
|
-
|
|
87
|
-
const DocSidebarMobileSecondaryMenu = ({toggleSidebar, sidebar, path}) => (
|
|
88
|
-
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
89
|
-
<DocSidebarItems
|
|
90
|
-
items={sidebar}
|
|
91
|
-
activePath={path}
|
|
92
|
-
onItemClick={(item) => {
|
|
93
|
-
// Mobile sidebar should only be closed if the category has a link
|
|
94
|
-
if (item.type === 'category' && item.href) {
|
|
95
|
-
toggleSidebar();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (item.type === 'link') {
|
|
99
|
-
toggleSidebar();
|
|
100
|
-
}
|
|
101
|
-
}}
|
|
102
|
-
level={1}
|
|
103
|
-
/>
|
|
104
|
-
</ul>
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
function DocSidebarMobile(props) {
|
|
108
|
-
return (
|
|
109
|
-
<MobileSecondaryMenuFiller
|
|
110
|
-
component={DocSidebarMobileSecondaryMenu}
|
|
111
|
-
props={props}
|
|
112
|
-
/>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const DocSidebarDesktopMemo = React.memo(DocSidebarDesktop);
|
|
117
|
-
const DocSidebarMobileMemo = React.memo(DocSidebarMobile);
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {useWindowSize} from '@docusaurus/theme-common';
|
|
9
|
+
import DocSidebarDesktop from '@theme/DocSidebar/Desktop';
|
|
10
|
+
import DocSidebarMobile from '@theme/DocSidebar/Mobile';
|
|
118
11
|
export default function DocSidebar(props) {
|
|
119
12
|
const windowSize = useWindowSize(); // Desktop sidebar visible on hydration: need SSR rendering
|
|
120
13
|
|
|
@@ -124,8 +17,8 @@ export default function DocSidebar(props) {
|
|
|
124
17
|
const shouldRenderSidebarMobile = windowSize === 'mobile';
|
|
125
18
|
return (
|
|
126
19
|
<>
|
|
127
|
-
{shouldRenderSidebarDesktop && <
|
|
128
|
-
{shouldRenderSidebarMobile && <
|
|
20
|
+
{shouldRenderSidebarDesktop && <DocSidebarDesktop {...props} />}
|
|
21
|
+
{shouldRenderSidebarMobile && <DocSidebarMobile {...props} />}
|
|
129
22
|
</>
|
|
130
23
|
);
|
|
131
24
|
}
|
|
@@ -22,10 +22,12 @@ function AnchorHeading({as: As, id, ...props}) {
|
|
|
22
22
|
return (
|
|
23
23
|
<As
|
|
24
24
|
{...props}
|
|
25
|
-
className={clsx(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
className={clsx(
|
|
26
|
+
'anchor',
|
|
27
|
+
hideOnScroll
|
|
28
|
+
? styles.anchorWithHideOnScrollNavbar
|
|
29
|
+
: styles.anchorWithStickyNavbar,
|
|
30
|
+
)}
|
|
29
31
|
id={id}>
|
|
30
32
|
{props.children}
|
|
31
33
|
<a
|
|
@@ -220,13 +220,19 @@ export default function Navbar() {
|
|
|
220
220
|
return (
|
|
221
221
|
<nav
|
|
222
222
|
ref={navbarRef}
|
|
223
|
-
className={clsx(
|
|
224
|
-
'navbar
|
|
225
|
-
'navbar--
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
223
|
+
className={clsx(
|
|
224
|
+
'navbar',
|
|
225
|
+
'navbar--fixed-top',
|
|
226
|
+
hideOnScroll && [
|
|
227
|
+
styles.navbarHideable,
|
|
228
|
+
!isNavbarVisible && styles.navbarHidden,
|
|
229
|
+
],
|
|
230
|
+
{
|
|
231
|
+
'navbar--dark': style === 'dark',
|
|
232
|
+
'navbar--primary': style === 'primary',
|
|
233
|
+
'navbar-sidebar--show': mobileSidebar.shown,
|
|
234
|
+
},
|
|
235
|
+
)}>
|
|
230
236
|
<div className="navbar__inner">
|
|
231
237
|
<div className="navbar__items">
|
|
232
238
|
{(items?.length > 0 || activeDocPlugin) && (
|
|
@@ -13,10 +13,10 @@ export default function Tag(props) {
|
|
|
13
13
|
return (
|
|
14
14
|
<Link
|
|
15
15
|
href={permalink}
|
|
16
|
-
className={clsx(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
className={clsx(
|
|
17
|
+
styles.tag,
|
|
18
|
+
count ? styles.tagWithCount : styles.tagRegular,
|
|
19
|
+
)}>
|
|
20
20
|
{name}
|
|
21
21
|
{count && <span>{count}</span>}
|
|
22
22
|
</Link>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4707",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "0.0.0-
|
|
25
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
28
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
30
|
-
"@docusaurus/utils": "0.0.0-
|
|
31
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
32
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
24
|
+
"@docusaurus/core": "0.0.0-4707",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4707",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4707",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4707",
|
|
28
|
+
"@docusaurus/theme-common": "0.0.0-4707",
|
|
29
|
+
"@docusaurus/theme-translations": "0.0.0-4707",
|
|
30
|
+
"@docusaurus/utils": "0.0.0-4707",
|
|
31
|
+
"@docusaurus/utils-common": "0.0.0-4707",
|
|
32
|
+
"@docusaurus/utils-validation": "0.0.0-4707",
|
|
33
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"clsx": "^1.1.1",
|
|
35
35
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"rtlcss": "^3.3.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
46
|
-
"@docusaurus/types": "0.0.0-
|
|
45
|
+
"@docusaurus/module-type-aliases": "0.0.0-4707",
|
|
46
|
+
"@docusaurus/types": "0.0.0-4707",
|
|
47
47
|
"@types/mdx-js__react": "^1.5.5",
|
|
48
48
|
"@types/prismjs": "^1.26.0",
|
|
49
49
|
"@types/rtlcss": "^3.1.2",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=14"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0092bf6871799bbc934553842aafd69768517768"
|
|
63
63
|
}
|