@docusaurus/theme-classic 0.0.0-4705 → 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/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/package.json +13 -13
- 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-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
|
|
|
@@ -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
|
}
|
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
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import IconArrow from '@theme/IconArrow';
|
|
11
|
+
import {translate} from '@docusaurus/Translate';
|
|
12
|
+
import type {Props} from '@theme/DocSidebar/Desktop/CollapseButton';
|
|
13
|
+
|
|
14
|
+
import styles from './styles.module.css';
|
|
15
|
+
|
|
16
|
+
export default function CollapseButton({onClick}: Props): JSX.Element {
|
|
17
|
+
return (
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
title={translate({
|
|
21
|
+
id: 'theme.docs.sidebar.collapseButtonTitle',
|
|
22
|
+
message: 'Collapse sidebar',
|
|
23
|
+
description: 'The title attribute for collapse button of doc sidebar',
|
|
24
|
+
})}
|
|
25
|
+
aria-label={translate({
|
|
26
|
+
id: 'theme.docs.sidebar.collapseButtonAriaLabel',
|
|
27
|
+
message: 'Collapse sidebar',
|
|
28
|
+
description: 'The title attribute for collapse button of doc sidebar',
|
|
29
|
+
})}
|
|
30
|
+
className={clsx(
|
|
31
|
+
'button button--secondary button--outline',
|
|
32
|
+
styles.collapseSidebarButton,
|
|
33
|
+
)}
|
|
34
|
+
onClick={onClick}>
|
|
35
|
+
<IconArrow className={styles.collapseSidebarButtonIcon} />
|
|
36
|
+
</button>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -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,55 @@
|
|
|
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
|
+
import React, {useState} from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {
|
|
11
|
+
ThemeClassNames,
|
|
12
|
+
useAnnouncementBar,
|
|
13
|
+
useScrollPosition,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
15
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
16
|
+
import type {Props} from '@theme/DocSidebar/Desktop/Content';
|
|
17
|
+
|
|
18
|
+
import styles from './styles.module.css';
|
|
19
|
+
|
|
20
|
+
function useShowAnnouncementBar() {
|
|
21
|
+
const {isActive} = useAnnouncementBar();
|
|
22
|
+
const [showAnnouncementBar, setShowAnnouncementBar] = useState(isActive);
|
|
23
|
+
|
|
24
|
+
useScrollPosition(
|
|
25
|
+
({scrollY}) => {
|
|
26
|
+
if (isActive) {
|
|
27
|
+
setShowAnnouncementBar(scrollY === 0);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
[isActive],
|
|
31
|
+
);
|
|
32
|
+
return isActive && showAnnouncementBar;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default function DocSidebarDesktopContent({
|
|
36
|
+
path,
|
|
37
|
+
sidebar,
|
|
38
|
+
className,
|
|
39
|
+
}: Props): JSX.Element {
|
|
40
|
+
const showAnnouncementBar = useShowAnnouncementBar();
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<nav
|
|
44
|
+
className={clsx(
|
|
45
|
+
'menu thin-scrollbar',
|
|
46
|
+
styles.menu,
|
|
47
|
+
showAnnouncementBar && styles.menuWithAnnouncementBar,
|
|
48
|
+
className,
|
|
49
|
+
)}>
|
|
50
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
51
|
+
<DocSidebarItems items={sidebar} activePath={path} level={1} />
|
|
52
|
+
</ul>
|
|
53
|
+
</nav>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -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,38 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
11
|
+
import Logo from '@theme/Logo';
|
|
12
|
+
import CollapseButton from '@theme/DocSidebar/Desktop/CollapseButton';
|
|
13
|
+
import Content from '@theme/DocSidebar/Desktop/Content';
|
|
14
|
+
import type {Props} from '@theme/DocSidebar/Desktop';
|
|
15
|
+
|
|
16
|
+
import styles from './styles.module.css';
|
|
17
|
+
|
|
18
|
+
function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}: Props) {
|
|
19
|
+
const {
|
|
20
|
+
navbar: {hideOnScroll},
|
|
21
|
+
hideableSidebar,
|
|
22
|
+
} = useThemeConfig();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
className={clsx(
|
|
27
|
+
styles.sidebar,
|
|
28
|
+
hideOnScroll && styles.sidebarWithHideableNavbar,
|
|
29
|
+
isHidden && styles.sidebarHidden,
|
|
30
|
+
)}>
|
|
31
|
+
{hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
|
|
32
|
+
<Content path={path} sidebar={sidebar} />
|
|
33
|
+
{hideableSidebar && <CollapseButton onClick={onCollapse} />}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
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,51 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {
|
|
11
|
+
MobileSecondaryMenuFiller,
|
|
12
|
+
type MobileSecondaryMenuComponent,
|
|
13
|
+
ThemeClassNames,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
15
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
16
|
+
import type {Props} from '@theme/DocSidebar/Mobile';
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line react/function-component-definition
|
|
19
|
+
const DocSidebarMobileSecondaryMenu: MobileSecondaryMenuComponent<Props> = ({
|
|
20
|
+
toggleSidebar,
|
|
21
|
+
sidebar,
|
|
22
|
+
path,
|
|
23
|
+
}) => (
|
|
24
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
25
|
+
<DocSidebarItems
|
|
26
|
+
items={sidebar}
|
|
27
|
+
activePath={path}
|
|
28
|
+
onItemClick={(item) => {
|
|
29
|
+
// Mobile sidebar should only be closed if the category has a link
|
|
30
|
+
if (item.type === 'category' && item.href) {
|
|
31
|
+
toggleSidebar();
|
|
32
|
+
}
|
|
33
|
+
if (item.type === 'link') {
|
|
34
|
+
toggleSidebar();
|
|
35
|
+
}
|
|
36
|
+
}}
|
|
37
|
+
level={1}
|
|
38
|
+
/>
|
|
39
|
+
</ul>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
function DocSidebarMobile(props: Props) {
|
|
43
|
+
return (
|
|
44
|
+
<MobileSecondaryMenuFiller
|
|
45
|
+
component={DocSidebarMobileSecondaryMenu}
|
|
46
|
+
props={props}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default React.memo(DocSidebarMobile);
|
|
@@ -5,126 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
useThemeConfig,
|
|
12
|
-
useAnnouncementBar,
|
|
13
|
-
MobileSecondaryMenuFiller,
|
|
14
|
-
type MobileSecondaryMenuComponent,
|
|
15
|
-
ThemeClassNames,
|
|
16
|
-
useScrollPosition,
|
|
17
|
-
useWindowSize,
|
|
18
|
-
} from '@docusaurus/theme-common';
|
|
19
|
-
import Logo from '@theme/Logo';
|
|
20
|
-
import IconArrow from '@theme/IconArrow';
|
|
21
|
-
import {translate} from '@docusaurus/Translate';
|
|
22
|
-
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import {useWindowSize} from '@docusaurus/theme-common';
|
|
23
10
|
import type {Props} from '@theme/DocSidebar';
|
|
24
|
-
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
function useShowAnnouncementBar() {
|
|
28
|
-
const {isActive} = useAnnouncementBar();
|
|
29
|
-
const [showAnnouncementBar, setShowAnnouncementBar] = useState(isActive);
|
|
30
|
-
|
|
31
|
-
useScrollPosition(
|
|
32
|
-
({scrollY}) => {
|
|
33
|
-
if (isActive) {
|
|
34
|
-
setShowAnnouncementBar(scrollY === 0);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
[isActive],
|
|
38
|
-
);
|
|
39
|
-
return isActive && showAnnouncementBar;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function HideableSidebarButton({onClick}: {onClick: React.MouseEventHandler}) {
|
|
43
|
-
return (
|
|
44
|
-
<button
|
|
45
|
-
type="button"
|
|
46
|
-
title={translate({
|
|
47
|
-
id: 'theme.docs.sidebar.collapseButtonTitle',
|
|
48
|
-
message: 'Collapse sidebar',
|
|
49
|
-
description: 'The title attribute for collapse button of doc sidebar',
|
|
50
|
-
})}
|
|
51
|
-
aria-label={translate({
|
|
52
|
-
id: 'theme.docs.sidebar.collapseButtonAriaLabel',
|
|
53
|
-
message: 'Collapse sidebar',
|
|
54
|
-
description: 'The title attribute for collapse button of doc sidebar',
|
|
55
|
-
})}
|
|
56
|
-
className={clsx(
|
|
57
|
-
'button button--secondary button--outline',
|
|
58
|
-
styles.collapseSidebarButton,
|
|
59
|
-
)}
|
|
60
|
-
onClick={onClick}>
|
|
61
|
-
<IconArrow className={styles.collapseSidebarButtonIcon} />
|
|
62
|
-
</button>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}: Props) {
|
|
67
|
-
const showAnnouncementBar = useShowAnnouncementBar();
|
|
68
|
-
const {
|
|
69
|
-
navbar: {hideOnScroll},
|
|
70
|
-
hideableSidebar,
|
|
71
|
-
} = useThemeConfig();
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
className={clsx(styles.sidebar, {
|
|
76
|
-
[styles.sidebarWithHideableNavbar!]: hideOnScroll,
|
|
77
|
-
[styles.sidebarHidden!]: isHidden,
|
|
78
|
-
})}>
|
|
79
|
-
{hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
|
|
80
|
-
<nav
|
|
81
|
-
className={clsx('menu thin-scrollbar', styles.menu, {
|
|
82
|
-
[styles.menuWithAnnouncementBar!]: showAnnouncementBar,
|
|
83
|
-
})}>
|
|
84
|
-
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
85
|
-
<DocSidebarItems items={sidebar} activePath={path} level={1} />
|
|
86
|
-
</ul>
|
|
87
|
-
</nav>
|
|
88
|
-
{hideableSidebar && <HideableSidebarButton onClick={onCollapse} />}
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// eslint-disable-next-line react/function-component-definition
|
|
94
|
-
const DocSidebarMobileSecondaryMenu: MobileSecondaryMenuComponent<Props> = ({
|
|
95
|
-
toggleSidebar,
|
|
96
|
-
sidebar,
|
|
97
|
-
path,
|
|
98
|
-
}) => (
|
|
99
|
-
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
100
|
-
<DocSidebarItems
|
|
101
|
-
items={sidebar}
|
|
102
|
-
activePath={path}
|
|
103
|
-
onItemClick={(item) => {
|
|
104
|
-
// Mobile sidebar should only be closed if the category has a link
|
|
105
|
-
if (item.type === 'category' && item.href) {
|
|
106
|
-
toggleSidebar();
|
|
107
|
-
}
|
|
108
|
-
if (item.type === 'link') {
|
|
109
|
-
toggleSidebar();
|
|
110
|
-
}
|
|
111
|
-
}}
|
|
112
|
-
level={1}
|
|
113
|
-
/>
|
|
114
|
-
</ul>
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
function DocSidebarMobile(props: Props) {
|
|
118
|
-
return (
|
|
119
|
-
<MobileSecondaryMenuFiller
|
|
120
|
-
component={DocSidebarMobileSecondaryMenu}
|
|
121
|
-
props={props}
|
|
122
|
-
/>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const DocSidebarDesktopMemo = React.memo(DocSidebarDesktop);
|
|
127
|
-
const DocSidebarMobileMemo = React.memo(DocSidebarMobile);
|
|
11
|
+
import DocSidebarDesktop from '@theme/DocSidebar/Desktop';
|
|
12
|
+
import DocSidebarMobile from '@theme/DocSidebar/Mobile';
|
|
128
13
|
|
|
129
14
|
export default function DocSidebar(props: Props): JSX.Element {
|
|
130
15
|
const windowSize = useWindowSize();
|
|
@@ -138,8 +23,8 @@ export default function DocSidebar(props: Props): JSX.Element {
|
|
|
138
23
|
|
|
139
24
|
return (
|
|
140
25
|
<>
|
|
141
|
-
{shouldRenderSidebarDesktop && <
|
|
142
|
-
{shouldRenderSidebarMobile && <
|
|
26
|
+
{shouldRenderSidebarDesktop && <DocSidebarDesktop {...props} />}
|
|
27
|
+
{shouldRenderSidebarMobile && <DocSidebarMobile {...props} />}
|
|
143
28
|
</>
|
|
144
29
|
);
|
|
145
30
|
}
|
package/src/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
|
|
|
@@ -1,107 +0,0 @@
|
|
|
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
|
-
.sidebar {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
max-height: 100vh;
|
|
17
|
-
height: 100%;
|
|
18
|
-
position: sticky;
|
|
19
|
-
top: 0;
|
|
20
|
-
padding-top: var(--ifm-navbar-height);
|
|
21
|
-
width: var(--doc-sidebar-width);
|
|
22
|
-
transition: opacity 50ms ease;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.sidebarWithHideableNavbar {
|
|
26
|
-
padding-top: 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.sidebarHidden {
|
|
30
|
-
opacity: 0;
|
|
31
|
-
height: 0;
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
visibility: hidden;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.sidebarLogo {
|
|
37
|
-
display: flex !important;
|
|
38
|
-
align-items: center;
|
|
39
|
-
margin: 0 var(--ifm-navbar-padding-horizontal);
|
|
40
|
-
min-height: var(--ifm-navbar-height);
|
|
41
|
-
max-height: var(--ifm-navbar-height);
|
|
42
|
-
color: inherit !important;
|
|
43
|
-
text-decoration: none !important;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.sidebarLogo img {
|
|
47
|
-
margin-right: 0.5rem;
|
|
48
|
-
height: 2rem;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.menu {
|
|
52
|
-
flex-grow: 1;
|
|
53
|
-
padding: 0.5rem;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.menuWithAnnouncementBar {
|
|
57
|
-
margin-bottom: var(--docusaurus-announcement-bar-height);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.collapseSidebarButton {
|
|
61
|
-
display: block !important;
|
|
62
|
-
background-color: var(--ifm-button-background-color);
|
|
63
|
-
height: 40px;
|
|
64
|
-
position: sticky;
|
|
65
|
-
bottom: 0;
|
|
66
|
-
border-radius: 0;
|
|
67
|
-
border: 1px solid var(--ifm-toc-border-color);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.collapseSidebarButtonIcon {
|
|
71
|
-
transform: rotate(180deg);
|
|
72
|
-
margin-top: 4px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
[dir='rtl'] .collapseSidebarButtonIcon {
|
|
76
|
-
transform: rotate(0);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
[data-theme='dark'] .collapseSidebarButton {
|
|
80
|
-
background-color: var(--collapse-button-bg-color-dark);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[data-theme='dark'] .collapseSidebarButton:hover,
|
|
84
|
-
[data-theme='dark'] .collapseSidebarButton:focus {
|
|
85
|
-
background-color: var(--ifm-color-emphasis-200);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.sidebarLogo,
|
|
90
|
-
.collapseSidebarButton {
|
|
91
|
-
display: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.sidebarMenuIcon {
|
|
95
|
-
vertical-align: middle;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.sidebarMenuCloseIcon {
|
|
99
|
-
display: inline-flex;
|
|
100
|
-
justify-content: center;
|
|
101
|
-
align-items: center;
|
|
102
|
-
height: 24px;
|
|
103
|
-
font-size: 1.5rem;
|
|
104
|
-
font-weight: var(--ifm-font-weight-bold);
|
|
105
|
-
line-height: 0.9;
|
|
106
|
-
width: 24px;
|
|
107
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
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
|
-
.sidebar {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
max-height: 100vh;
|
|
17
|
-
height: 100%;
|
|
18
|
-
position: sticky;
|
|
19
|
-
top: 0;
|
|
20
|
-
padding-top: var(--ifm-navbar-height);
|
|
21
|
-
width: var(--doc-sidebar-width);
|
|
22
|
-
transition: opacity 50ms ease;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.sidebarWithHideableNavbar {
|
|
26
|
-
padding-top: 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.sidebarHidden {
|
|
30
|
-
opacity: 0;
|
|
31
|
-
height: 0;
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
visibility: hidden;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.sidebarLogo {
|
|
37
|
-
display: flex !important;
|
|
38
|
-
align-items: center;
|
|
39
|
-
margin: 0 var(--ifm-navbar-padding-horizontal);
|
|
40
|
-
min-height: var(--ifm-navbar-height);
|
|
41
|
-
max-height: var(--ifm-navbar-height);
|
|
42
|
-
color: inherit !important;
|
|
43
|
-
text-decoration: none !important;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.sidebarLogo img {
|
|
47
|
-
margin-right: 0.5rem;
|
|
48
|
-
height: 2rem;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.menu {
|
|
52
|
-
flex-grow: 1;
|
|
53
|
-
padding: 0.5rem;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.menuWithAnnouncementBar {
|
|
57
|
-
margin-bottom: var(--docusaurus-announcement-bar-height);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.collapseSidebarButton {
|
|
61
|
-
display: block !important;
|
|
62
|
-
background-color: var(--ifm-button-background-color);
|
|
63
|
-
height: 40px;
|
|
64
|
-
position: sticky;
|
|
65
|
-
bottom: 0;
|
|
66
|
-
border-radius: 0;
|
|
67
|
-
border: 1px solid var(--ifm-toc-border-color);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.collapseSidebarButtonIcon {
|
|
71
|
-
transform: rotate(180deg);
|
|
72
|
-
margin-top: 4px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
[dir='rtl'] .collapseSidebarButtonIcon {
|
|
76
|
-
transform: rotate(0);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
[data-theme='dark'] .collapseSidebarButton {
|
|
80
|
-
background-color: var(--collapse-button-bg-color-dark);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[data-theme='dark'] .collapseSidebarButton:hover,
|
|
84
|
-
[data-theme='dark'] .collapseSidebarButton:focus {
|
|
85
|
-
background-color: var(--ifm-color-emphasis-200);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.sidebarLogo,
|
|
90
|
-
.collapseSidebarButton {
|
|
91
|
-
display: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.sidebarMenuIcon {
|
|
95
|
-
vertical-align: middle;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.sidebarMenuCloseIcon {
|
|
99
|
-
display: inline-flex;
|
|
100
|
-
justify-content: center;
|
|
101
|
-
align-items: center;
|
|
102
|
-
height: 24px;
|
|
103
|
-
font-size: 1.5rem;
|
|
104
|
-
font-weight: var(--ifm-font-weight-bold);
|
|
105
|
-
line-height: 0.9;
|
|
106
|
-
width: 24px;
|
|
107
|
-
}
|