@docusaurus/theme-classic 0.0.0-4705 → 0.0.0-4709
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/getSwizzleConfig.js +50 -2
- package/lib/theme-classic.d.ts +107 -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/lib-next/theme/Footer/Copyright/index.js +18 -0
- package/lib-next/theme/Footer/Layout/index.js +26 -0
- package/lib-next/theme/Footer/LinkItem/index.js +35 -0
- package/lib-next/theme/Footer/Links/MultiColumn/index.js +47 -0
- package/lib-next/theme/Footer/Links/Simple/index.js +41 -0
- package/lib-next/theme/Footer/Links/index.js +17 -0
- package/lib-next/theme/Footer/Logo/index.js +38 -0
- package/lib-next/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
- package/lib-next/theme/Footer/index.js +11 -156
- package/lib-next/theme/MDXComponents/index.js +1 -1
- package/lib-next/theme/Tabs/index.js +2 -2
- package/package.json +13 -13
- package/src/getSwizzleConfig.ts +52 -1
- 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/Footer/Copyright/index.tsx +22 -0
- package/src/theme/Footer/Layout/index.tsx +34 -0
- package/src/theme/Footer/LinkItem/index.tsx +38 -0
- package/src/theme/Footer/Links/MultiColumn/index.tsx +53 -0
- package/src/theme/Footer/Links/Simple/index.tsx +44 -0
- package/src/theme/Footer/Links/index.tsx +21 -0
- package/src/theme/Footer/Logo/index.tsx +41 -0
- package/src/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
- package/src/theme/Footer/index.tsx +12 -170
- package/src/theme/MDXComponents/index.tsx +2 -2
- package/src/theme/Tabs/index.tsx +1 -2
- package/src/theme-classic.d.ts +107 -0
- package/lib-next/theme/DocSidebar/styles.module.css +0 -107
- package/src/theme/DocSidebar/styles.module.css +0 -107
package/lib/getSwizzleConfig.js
CHANGED
|
@@ -40,12 +40,60 @@ function getSwizzleConfig() {
|
|
|
40
40
|
},
|
|
41
41
|
Footer: {
|
|
42
42
|
actions: {
|
|
43
|
-
eject: '
|
|
44
|
-
// TODO split footer into smaller parts
|
|
43
|
+
eject: 'safe',
|
|
45
44
|
wrap: 'safe'
|
|
46
45
|
},
|
|
47
46
|
description: "The footer component of you site's layout"
|
|
48
47
|
},
|
|
48
|
+
'Footer/Copyright': {
|
|
49
|
+
actions: {
|
|
50
|
+
eject: 'safe',
|
|
51
|
+
wrap: 'safe'
|
|
52
|
+
},
|
|
53
|
+
description: 'The footer copyright'
|
|
54
|
+
},
|
|
55
|
+
'Footer/Layout': {
|
|
56
|
+
actions: {
|
|
57
|
+
eject: 'safe',
|
|
58
|
+
wrap: 'safe'
|
|
59
|
+
},
|
|
60
|
+
description: 'The footer main layout component'
|
|
61
|
+
},
|
|
62
|
+
'Footer/LinkItem': {
|
|
63
|
+
actions: {
|
|
64
|
+
eject: 'safe',
|
|
65
|
+
wrap: 'safe'
|
|
66
|
+
},
|
|
67
|
+
description: 'The footer link item component'
|
|
68
|
+
},
|
|
69
|
+
'Footer/Links': {
|
|
70
|
+
actions: {
|
|
71
|
+
eject: 'safe',
|
|
72
|
+
wrap: 'safe'
|
|
73
|
+
},
|
|
74
|
+
description: 'The footer component rendering the footer links'
|
|
75
|
+
},
|
|
76
|
+
'Footer/Links/MultiColumn': {
|
|
77
|
+
actions: {
|
|
78
|
+
eject: 'safe',
|
|
79
|
+
wrap: 'safe'
|
|
80
|
+
},
|
|
81
|
+
description: 'The footer component rendering the footer links with a multi-column layout'
|
|
82
|
+
},
|
|
83
|
+
'Footer/Links/Simple': {
|
|
84
|
+
actions: {
|
|
85
|
+
eject: 'safe',
|
|
86
|
+
wrap: 'safe'
|
|
87
|
+
},
|
|
88
|
+
description: 'The footer component rendering the footer links with a simple layout (single row)'
|
|
89
|
+
},
|
|
90
|
+
'Footer/Logo': {
|
|
91
|
+
actions: {
|
|
92
|
+
eject: 'safe',
|
|
93
|
+
wrap: 'safe'
|
|
94
|
+
},
|
|
95
|
+
description: 'The footer logo'
|
|
96
|
+
},
|
|
49
97
|
IconArrow: {
|
|
50
98
|
actions: {
|
|
51
99
|
eject: 'safe',
|
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 Content(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
|
|
|
@@ -244,6 +280,77 @@ declare module '@theme/Footer' {
|
|
|
244
280
|
export default function Footer(): JSX.Element | null;
|
|
245
281
|
}
|
|
246
282
|
|
|
283
|
+
declare module '@theme/Footer/Logo' {
|
|
284
|
+
import type {FooterLogo} from '@docusaurus/theme-common';
|
|
285
|
+
|
|
286
|
+
export interface Props {
|
|
287
|
+
logo: FooterLogo;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export default function FooterLogo(props: Props): JSX.Element;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
declare module '@theme/Footer/Copyright' {
|
|
294
|
+
export interface Props {
|
|
295
|
+
copyright: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export default function FooterCopyright(props: Props): JSX.Element;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
declare module '@theme/Footer/LinkItem' {
|
|
302
|
+
import type {FooterLinkItem} from '@docusaurus/theme-common';
|
|
303
|
+
|
|
304
|
+
export interface Props {
|
|
305
|
+
item: FooterLinkItem;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export default function FooterLinkItem(props: Props): JSX.Element;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare module '@theme/Footer/Layout' {
|
|
312
|
+
import type {ReactNode} from 'react';
|
|
313
|
+
|
|
314
|
+
export interface Props {
|
|
315
|
+
style: 'light' | 'dark';
|
|
316
|
+
links: ReactNode;
|
|
317
|
+
logo: ReactNode;
|
|
318
|
+
copyright: ReactNode;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export default function FooterLayout(props: Props): JSX.Element;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare module '@theme/Footer/Links' {
|
|
325
|
+
import type {Footer} from '@docusaurus/theme-common';
|
|
326
|
+
|
|
327
|
+
export interface Props {
|
|
328
|
+
links: Footer['links'];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export default function FooterLinks(props: Props): JSX.Element;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare module '@theme/Footer/Links/MultiColumn' {
|
|
335
|
+
import type {MultiColumnFooter} from '@docusaurus/theme-common';
|
|
336
|
+
|
|
337
|
+
export interface Props {
|
|
338
|
+
columns: MultiColumnFooter['links'];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export default function FooterLinksMultiColumn(props: Props): JSX.Element;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare module '@theme/Footer/Links/Simple' {
|
|
345
|
+
import type {SimpleFooter} from '@docusaurus/theme-common';
|
|
346
|
+
|
|
347
|
+
export interface Props {
|
|
348
|
+
links: SimpleFooter['links'];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export default function FooterLinksSimple(props: Props): JSX.Element;
|
|
352
|
+
}
|
|
353
|
+
|
|
247
354
|
declare module '@theme/Heading' {
|
|
248
355
|
import type {ComponentProps} from 'react';
|
|
249
356
|
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export default function FooterCopyright({copyright}) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
className="footer__copyright" // Developer provided the HTML, so assume it's safe.
|
|
12
|
+
// eslint-disable-next-line react/no-danger
|
|
13
|
+
dangerouslySetInnerHTML={{
|
|
14
|
+
__html: copyright,
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
export default function FooterLayout({style, links, logo, copyright}) {
|
|
10
|
+
return (
|
|
11
|
+
<footer
|
|
12
|
+
className={clsx('footer', {
|
|
13
|
+
'footer--dark': style === 'dark',
|
|
14
|
+
})}>
|
|
15
|
+
<div className="container container-fluid">
|
|
16
|
+
{links}
|
|
17
|
+
{(logo || copyright) && (
|
|
18
|
+
<div className="footer__bottom text--center">
|
|
19
|
+
{logo && <div className="margin-bottom--sm">{logo}</div>}
|
|
20
|
+
{copyright}
|
|
21
|
+
</div>
|
|
22
|
+
)}
|
|
23
|
+
</div>
|
|
24
|
+
</footer>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 Link from '@docusaurus/Link';
|
|
9
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
10
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
11
|
+
import IconExternalLink from '@theme/IconExternalLink';
|
|
12
|
+
export default function FooterLinkItem({item}) {
|
|
13
|
+
const {to, href, label, prependBaseUrlToHref, ...props} = item;
|
|
14
|
+
const toUrl = useBaseUrl(to);
|
|
15
|
+
const normalizedHref = useBaseUrl(href, {
|
|
16
|
+
forcePrependBaseUrl: true,
|
|
17
|
+
});
|
|
18
|
+
return (
|
|
19
|
+
<Link
|
|
20
|
+
className="footer__link-item"
|
|
21
|
+
{...(href
|
|
22
|
+
? {
|
|
23
|
+
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
24
|
+
}
|
|
25
|
+
: {
|
|
26
|
+
to: toUrl,
|
|
27
|
+
})}
|
|
28
|
+
{...props}>
|
|
29
|
+
<span>
|
|
30
|
+
{label}
|
|
31
|
+
{href && !isInternalUrl(href) && <IconExternalLink />}
|
|
32
|
+
</span>
|
|
33
|
+
</Link>
|
|
34
|
+
);
|
|
35
|
+
}
|