@docusaurus/theme-classic 0.0.0-4702 → 0.0.0-4708
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/MDXComponents/index.js +1 -1
- package/lib-next/theme/Navbar/index.js +13 -7
- package/lib-next/theme/TOCCollapsible/index.js +1 -3
- package/lib-next/theme/Tabs/index.js +2 -2
- 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/MDXComponents/index.tsx +2 -2
- package/src/theme/Navbar/index.tsx +13 -7
- package/src/theme/TOCCollapsible/index.tsx +1 -3
- package/src/theme/Tabs/index.tsx +1 -2
- 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/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-4708",
|
|
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-4708",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4708",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4708",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4708",
|
|
28
|
+
"@docusaurus/theme-common": "0.0.0-4708",
|
|
29
|
+
"@docusaurus/theme-translations": "0.0.0-4708",
|
|
30
|
+
"@docusaurus/utils": "0.0.0-4708",
|
|
31
|
+
"@docusaurus/utils-common": "0.0.0-4708",
|
|
32
|
+
"@docusaurus/utils-validation": "0.0.0-4708",
|
|
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-4708",
|
|
46
|
+
"@docusaurus/types": "0.0.0-4708",
|
|
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": "f73cf7ae74e29c8a8b00e7a053d5ad02c57a6382"
|
|
63
63
|
}
|
|
@@ -132,9 +132,7 @@ export default function BackToTopButton(): JSX.Element {
|
|
|
132
132
|
'clean-btn',
|
|
133
133
|
ThemeClassNames.common.backToTopButton,
|
|
134
134
|
styles.backToTopButton,
|
|
135
|
-
|
|
136
|
-
[styles.backToTopButtonShow!]: show,
|
|
137
|
-
},
|
|
135
|
+
show && styles.backToTopButtonShow,
|
|
138
136
|
)}
|
|
139
137
|
type="button"
|
|
140
138
|
onClick={() => smoothScrollTop()}
|
|
@@ -112,9 +112,10 @@ export default function BlogPostItem(props: Props): JSX.Element {
|
|
|
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 className={clsx('col', {'col--9': truncatedPost})}>
|
|
120
121
|
<TagsListInline tags={tags} />
|
|
@@ -31,11 +31,13 @@ function ColorModeToggle({
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<div
|
|
34
|
-
className={clsx(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
className={clsx(
|
|
35
|
+
styles.toggle,
|
|
36
|
+
className,
|
|
37
|
+
checked && styles.toggleChecked,
|
|
38
|
+
focused && styles.toggleFocused,
|
|
39
|
+
!isBrowser && styles.toggleDisabled,
|
|
40
|
+
)}>
|
|
39
41
|
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
|
|
40
42
|
<div
|
|
41
43
|
className={styles.toggleButton}
|
|
@@ -53,10 +53,7 @@ export default function DocItem(props: Props): JSX.Element {
|
|
|
53
53
|
<Seo {...{title, description, keywords, image}} />
|
|
54
54
|
|
|
55
55
|
<div className="row">
|
|
56
|
-
<div
|
|
57
|
-
className={clsx('col', {
|
|
58
|
-
[styles.docItemCol!]: !hideTableOfContents,
|
|
59
|
-
})}>
|
|
56
|
+
<div className={clsx('col', !hideTableOfContents && styles.docItemCol)}>
|
|
60
57
|
<DocVersionBanner />
|
|
61
58
|
<div className={styles.docItemContainer}>
|
|
62
59
|
<article>
|
|
@@ -70,9 +70,7 @@ function DocPageContent({
|
|
|
70
70
|
className={clsx(
|
|
71
71
|
ThemeClassNames.docs.docSidebarContainer,
|
|
72
72
|
styles.docSidebarContainer,
|
|
73
|
-
|
|
74
|
-
[styles.docSidebarContainerHidden!]: hiddenSidebarContainer,
|
|
75
|
-
},
|
|
73
|
+
hiddenSidebarContainer && styles.docSidebarContainerHidden,
|
|
76
74
|
)}
|
|
77
75
|
onTransitionEnd={(e) => {
|
|
78
76
|
if (
|
|
@@ -122,17 +120,16 @@ function DocPageContent({
|
|
|
122
120
|
</aside>
|
|
123
121
|
)}
|
|
124
122
|
<main
|
|
125
|
-
className={clsx(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
className={clsx(
|
|
124
|
+
styles.docMainContainer,
|
|
125
|
+
(hiddenSidebarContainer || !sidebar) &&
|
|
126
|
+
styles.docMainContainerEnhanced,
|
|
127
|
+
)}>
|
|
129
128
|
<div
|
|
130
129
|
className={clsx(
|
|
131
130
|
'container padding-top--md padding-bottom--lg',
|
|
132
131
|
styles.docItemWrapper,
|
|
133
|
-
|
|
134
|
-
[styles.docItemWrapperEnhanced!]: hiddenSidebarContainer,
|
|
135
|
-
},
|
|
132
|
+
hiddenSidebarContainer && styles.docItemWrapperEnhanced,
|
|
136
133
|
)}>
|
|
137
134
|
{children}
|
|
138
135
|
</div>
|
|
@@ -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
|
}
|
|
@@ -25,10 +25,12 @@ function AnchorHeading({as: As, id, ...props}: Props) {
|
|
|
25
25
|
return (
|
|
26
26
|
<As
|
|
27
27
|
{...props}
|
|
28
|
-
className={clsx(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
className={clsx(
|
|
29
|
+
'anchor',
|
|
30
|
+
hideOnScroll
|
|
31
|
+
? styles.anchorWithHideOnScrollNavbar
|
|
32
|
+
: styles.anchorWithStickyNavbar,
|
|
33
|
+
)}
|
|
32
34
|
id={id}>
|
|
33
35
|
{props.children}
|
|
34
36
|
<a
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React, {
|
|
9
|
-
type ComponentProps,
|
|
10
9
|
isValidElement,
|
|
10
|
+
type ComponentProps,
|
|
11
11
|
type ReactElement,
|
|
12
12
|
} from 'react';
|
|
13
13
|
import Head from '@docusaurus/Head';
|
|
@@ -52,7 +52,7 @@ const MDXComponents: MDXComponentsObject = {
|
|
|
52
52
|
const shouldBeInline = React.Children.toArray(props.children).every(
|
|
53
53
|
(el) =>
|
|
54
54
|
(typeof el === 'string' && !el.includes('\n')) ||
|
|
55
|
-
(
|
|
55
|
+
(isValidElement(el) && inlineElements.includes(el.props.mdxType)),
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
|
@@ -237,13 +237,19 @@ export default function Navbar(): JSX.Element {
|
|
|
237
237
|
return (
|
|
238
238
|
<nav
|
|
239
239
|
ref={navbarRef}
|
|
240
|
-
className={clsx(
|
|
241
|
-
'navbar
|
|
242
|
-
'navbar--
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
240
|
+
className={clsx(
|
|
241
|
+
'navbar',
|
|
242
|
+
'navbar--fixed-top',
|
|
243
|
+
hideOnScroll && [
|
|
244
|
+
styles.navbarHideable,
|
|
245
|
+
!isNavbarVisible && styles.navbarHidden,
|
|
246
|
+
],
|
|
247
|
+
{
|
|
248
|
+
'navbar--dark': style === 'dark',
|
|
249
|
+
'navbar--primary': style === 'primary',
|
|
250
|
+
'navbar-sidebar--show': mobileSidebar.shown,
|
|
251
|
+
},
|
|
252
|
+
)}>
|
|
247
253
|
<div className="navbar__inner">
|
|
248
254
|
<div className="navbar__items">
|
|
249
255
|
{(items?.length > 0 || activeDocPlugin) && (
|
package/src/theme/Tabs/index.tsx
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import React, {
|
|
9
9
|
useState,
|
|
10
10
|
cloneElement,
|
|
11
|
-
Children,
|
|
12
11
|
isValidElement,
|
|
13
12
|
type ReactElement,
|
|
14
13
|
} from 'react';
|
|
@@ -40,7 +39,7 @@ function TabsComponent(props: Props): JSX.Element {
|
|
|
40
39
|
groupId,
|
|
41
40
|
className,
|
|
42
41
|
} = props;
|
|
43
|
-
const children = Children.map(props.children, (child) => {
|
|
42
|
+
const children = React.Children.map(props.children, (child) => {
|
|
44
43
|
if (isValidElement(child) && isTabItem(child)) {
|
|
45
44
|
return child;
|
|
46
45
|
}
|