@docusaurus/theme-classic 0.0.0-4203 → 0.0.0-4207
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/index.js +7 -11
- package/lib/theme/BlogPostAuthors/index.js +1 -1
- package/lib/theme/BlogSidebar/index.js +5 -7
- package/lib/theme/DocItemFooter/index.js +1 -1
- package/lib/theme/DocSidebar/index.js +5 -6
- package/lib/theme/DocSidebarItem/index.js +5 -7
- package/lib/theme/DocVersionBanner/index.js +1 -1
- package/lib/theme/Footer/index.js +4 -2
- package/lib/theme/Heading/index.js +11 -14
- package/lib/theme/IconArrow/index.js +2 -2
- package/lib/theme/IconEdit/index.js +3 -3
- package/lib/theme/IconExternalLink/index.js +3 -3
- package/lib/theme/IconLanguage/index.js +3 -3
- package/lib/theme/IconMenu/index.js +3 -3
- package/lib/theme/LayoutHead/index.js +1 -1
- package/lib/theme/Logo/index.js +3 -3
- package/lib/theme/Navbar/index.js +4 -6
- package/lib/theme/ThemeProvider/index.js +8 -3
- package/lib/theme/ThemedImage/index.js +2 -2
- package/lib/theme/Toggle/index.js +12 -8
- package/lib/theme/UserPreferencesProvider/index.js +8 -3
- package/lib/theme/hooks/useTheme.js +1 -3
- package/lib/validateThemeConfig.js +1 -1
- package/lib-next/index.js +8 -8
- package/lib-next/theme/BlogPostAuthors/index.js +1 -1
- package/lib-next/theme/BlogSidebar/index.js +11 -13
- package/lib-next/theme/DocItemFooter/index.js +1 -1
- package/lib-next/theme/DocSidebar/index.js +11 -13
- package/lib-next/theme/DocSidebarItem/index.js +11 -16
- package/lib-next/theme/DocVersionBanner/index.js +1 -1
- package/lib-next/theme/Footer/index.js +11 -9
- package/lib-next/theme/Heading/index.js +16 -17
- package/lib-next/theme/IconArrow/index.js +2 -2
- package/lib-next/theme/IconEdit/index.js +2 -2
- package/lib-next/theme/IconExternalLink/index.js +2 -2
- package/lib-next/theme/IconLanguage/index.js +2 -2
- package/lib-next/theme/IconMenu/index.js +2 -2
- package/lib-next/theme/LayoutHead/index.js +1 -1
- package/lib-next/theme/Logo/index.js +3 -3
- package/lib-next/theme/Navbar/index.js +7 -6
- package/lib-next/theme/ThemeProvider/index.js +10 -7
- package/lib-next/theme/ThemedImage/index.js +2 -2
- package/lib-next/theme/Toggle/index.js +14 -10
- package/lib-next/theme/UserPreferencesProvider/index.js +9 -6
- package/lib-next/theme/hooks/useTheme.js +2 -3
- package/package.json +11 -11
- package/src/index.ts +4 -7
- package/src/theme/BlogPostAuthors/index.tsx +5 -2
- package/src/theme/BlogSidebar/index.tsx +11 -13
- package/src/theme/DocItemFooter/index.tsx +2 -2
- package/src/theme/DocSidebar/index.tsx +11 -12
- package/src/theme/DocSidebarItem/index.tsx +4 -7
- package/src/theme/DocVersionBanner/index.tsx +2 -2
- package/src/theme/Footer/index.tsx +12 -10
- package/src/theme/Heading/index.tsx +16 -19
- package/src/theme/IconArrow/index.tsx +2 -2
- package/src/theme/IconEdit/index.tsx +2 -2
- package/src/theme/IconExternalLink/index.tsx +2 -5
- package/src/theme/IconLanguage/index.tsx +2 -6
- package/src/theme/IconMenu/index.tsx +3 -3
- package/src/theme/LayoutHead/index.tsx +1 -1
- package/src/theme/Logo/index.tsx +3 -3
- package/src/theme/Navbar/index.tsx +7 -6
- package/src/theme/ThemeProvider/index.tsx +6 -2
- package/src/theme/ThemedImage/index.tsx +2 -2
- package/src/theme/Toggle/index.tsx +14 -10
- package/src/theme/UserPreferencesProvider/index.tsx +9 -6
- package/src/theme/hooks/useTheme.ts +2 -3
- package/update-code-translations.js +5 -6
|
@@ -34,22 +34,17 @@ const isActiveSidebarItem = (item, activePath) => {
|
|
|
34
34
|
// TODO this item should probably not receive the "activePath" props
|
|
35
35
|
// TODO this triggers whole sidebar re-renders on navigation
|
|
36
36
|
|
|
37
|
-
export const DocSidebarItems = memo(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/>
|
|
49
|
-
))}
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
});
|
|
37
|
+
export const DocSidebarItems = memo(({items, ...props}) => (
|
|
38
|
+
<>
|
|
39
|
+
{items.map((item, index) => (
|
|
40
|
+
<DocSidebarItem
|
|
41
|
+
key={index} // sidebar is static, the index does not change
|
|
42
|
+
item={item}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
))}
|
|
46
|
+
</>
|
|
47
|
+
));
|
|
53
48
|
export default function DocSidebarItem({item, ...props}) {
|
|
54
49
|
switch (item.type) {
|
|
55
50
|
case 'category':
|
|
@@ -42,15 +42,17 @@ function FooterLink({to, href, label, prependBaseUrlToHref, ...props}) {
|
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
function FooterLogo({sources, alt, width, height}) {
|
|
46
|
+
return (
|
|
47
|
+
<ThemedImage
|
|
48
|
+
className="footer__logo"
|
|
49
|
+
alt={alt}
|
|
50
|
+
sources={sources}
|
|
51
|
+
width={width}
|
|
52
|
+
height={height}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
54
56
|
|
|
55
57
|
function Footer() {
|
|
56
58
|
const {footer} = useThemeConfig();
|
|
@@ -10,21 +10,21 @@ import {translate} from '@docusaurus/Translate';
|
|
|
10
10
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
11
11
|
import './styles.css';
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
13
|
+
// eslint-disable-next-line react/function-component-definition
|
|
14
|
+
export const MainHeading = ({...props}) => (
|
|
15
|
+
<header>
|
|
16
|
+
<h1
|
|
17
|
+
{...props}
|
|
18
|
+
id={undefined} // h1 headings do not need an id because they don't appear in the TOC
|
|
19
|
+
>
|
|
20
|
+
{props.children}
|
|
21
|
+
</h1>
|
|
22
|
+
</header>
|
|
23
|
+
);
|
|
25
24
|
|
|
26
|
-
const createAnchorHeading =
|
|
27
|
-
|
|
25
|
+
const createAnchorHeading =
|
|
26
|
+
(Tag) =>
|
|
27
|
+
({id, ...props}) => {
|
|
28
28
|
const {
|
|
29
29
|
navbar: {hideOnScroll},
|
|
30
30
|
} = useThemeConfig();
|
|
@@ -57,8 +57,7 @@ const createAnchorHeading = (Tag) =>
|
|
|
57
57
|
);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const Heading = (headingType) =>
|
|
61
|
-
|
|
62
|
-
};
|
|
60
|
+
const Heading = (headingType) =>
|
|
61
|
+
headingType === 'h1' ? MainHeading : createAnchorHeading(headingType);
|
|
63
62
|
|
|
64
63
|
export default Heading;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function IconArrow(props) {
|
|
10
10
|
return (
|
|
11
11
|
<svg width="20" height="20" aria-hidden="true" {...props}>
|
|
12
12
|
<g fill="#7a7a7a">
|
|
@@ -15,6 +15,6 @@ const IconArrow = (props) => {
|
|
|
15
15
|
</g>
|
|
16
16
|
</svg>
|
|
17
17
|
);
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export default IconArrow;
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function IconEdit({className, ...restProps}) {
|
|
12
12
|
return (
|
|
13
13
|
<svg
|
|
14
14
|
fill="currentColor"
|
|
@@ -23,6 +23,6 @@ const IconEdit = ({className, ...restProps}) => {
|
|
|
23
23
|
</g>
|
|
24
24
|
</svg>
|
|
25
25
|
);
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
|
|
28
28
|
export default IconEdit;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import styles from './styles.module.css';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function IconExternalLink({width = 13.5, height = 13.5}) {
|
|
11
11
|
return (
|
|
12
12
|
<svg
|
|
13
13
|
width={width}
|
|
@@ -21,6 +21,6 @@ const IconExternalLink = ({width = 13.5, height = 13.5}) => {
|
|
|
21
21
|
/>
|
|
22
22
|
</svg>
|
|
23
23
|
);
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
25
|
|
|
26
26
|
export default IconExternalLink;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function IconLanguage({width = 20, height = 20, ...props}) {
|
|
10
10
|
return (
|
|
11
11
|
<svg
|
|
12
12
|
viewBox="0 0 20 20"
|
|
@@ -20,6 +20,6 @@ const IconLanguage = ({width = 20, height = 20, ...props}) => {
|
|
|
20
20
|
/>
|
|
21
21
|
</svg>
|
|
22
22
|
);
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
|
|
25
25
|
export default IconLanguage;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function IconMenu({width = 30, height = 30, className, ...restProps}) {
|
|
10
10
|
return (
|
|
11
11
|
<svg
|
|
12
12
|
className={className}
|
|
@@ -24,6 +24,6 @@ const IconMenu = ({width = 30, height = 30, className, ...restProps}) => {
|
|
|
24
24
|
/>
|
|
25
25
|
</svg>
|
|
26
26
|
);
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
export default IconMenu;
|
|
@@ -94,7 +94,7 @@ export default function LayoutHead(props) {
|
|
|
94
94
|
<>
|
|
95
95
|
<Head>
|
|
96
96
|
<html lang={htmlLang} dir={htmlDir} />
|
|
97
|
-
{favicon && <link rel="
|
|
97
|
+
{favicon && <link rel="icon" href={faviconUrl} />}
|
|
98
98
|
<title>{pageTitle}</title>
|
|
99
99
|
<meta property="og:title" content={pageTitle} />
|
|
100
100
|
<meta name="twitter:card" content="summary_large_image" />
|
|
@@ -11,7 +11,7 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
|
11
11
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
12
12
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
function Logo(props) {
|
|
15
15
|
const {
|
|
16
16
|
siteConfig: {title},
|
|
17
17
|
} = useDocusaurusContext();
|
|
@@ -48,11 +48,11 @@ const Logo = (props) => {
|
|
|
48
48
|
(imageClassName ? (
|
|
49
49
|
<div className={imageClassName}>{themedImage}</div>
|
|
50
50
|
) : (
|
|
51
|
-
|
|
51
|
+
themedImage
|
|
52
52
|
))}
|
|
53
53
|
{navbarTitle != null && <b className={titleClassName}>{navbarTitle}</b>}
|
|
54
54
|
</Link>
|
|
55
55
|
);
|
|
56
|
-
}
|
|
56
|
+
}
|
|
57
57
|
|
|
58
58
|
export default Logo;
|
|
@@ -101,12 +101,13 @@ function useSecondaryMenu({sidebarShown, toggleSidebar}) {
|
|
|
101
101
|
toggleSidebar,
|
|
102
102
|
});
|
|
103
103
|
const previousContent = usePrevious(content);
|
|
104
|
-
const [shown, setShown] = useState(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
const [shown, setShown] = useState(
|
|
105
|
+
() =>
|
|
106
|
+
// /!\ content is set with useEffect,
|
|
107
|
+
// so it's not available on mount anyway
|
|
108
|
+
// "return !!content" => always returns false
|
|
109
|
+
false,
|
|
110
|
+
); // When content is become available for the first time (set in useEffect)
|
|
110
111
|
// we set this content to be shown!
|
|
111
112
|
|
|
112
113
|
useEffect(() => {
|
|
@@ -4,19 +4,22 @@
|
|
|
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 from 'react';
|
|
7
|
+
import React, {useMemo} from 'react';
|
|
8
8
|
import useTheme from '@theme/hooks/useTheme';
|
|
9
9
|
import ThemeContext from '@theme/ThemeContext';
|
|
10
10
|
|
|
11
11
|
function ThemeProvider(props) {
|
|
12
12
|
const {isDarkTheme, setLightTheme, setDarkTheme} = useTheme();
|
|
13
|
+
const contextValue = useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
isDarkTheme,
|
|
16
|
+
setLightTheme,
|
|
17
|
+
setDarkTheme,
|
|
18
|
+
}),
|
|
19
|
+
[isDarkTheme, setLightTheme, setDarkTheme],
|
|
20
|
+
);
|
|
13
21
|
return (
|
|
14
|
-
<ThemeContext.Provider
|
|
15
|
-
value={{
|
|
16
|
-
isDarkTheme,
|
|
17
|
-
setLightTheme,
|
|
18
|
-
setDarkTheme,
|
|
19
|
-
}}>
|
|
22
|
+
<ThemeContext.Provider value={contextValue}>
|
|
20
23
|
{props.children}
|
|
21
24
|
</ThemeContext.Provider>
|
|
22
25
|
);
|
|
@@ -10,7 +10,7 @@ import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
|
10
10
|
import useThemeContext from '@theme/hooks/useThemeContext';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function ThemedImage(props) {
|
|
14
14
|
const isBrowser = useIsBrowser();
|
|
15
15
|
const {isDarkTheme} = useThemeContext();
|
|
16
16
|
const {sources, className, alt = '', ...propsRest} = props;
|
|
@@ -36,6 +36,6 @@ const ThemedImage = (props) => {
|
|
|
36
36
|
))}
|
|
37
37
|
</>
|
|
38
38
|
);
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
|
|
41
41
|
export default ThemedImage;
|
|
@@ -10,17 +10,21 @@ import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
function Dark({icon, style}) {
|
|
14
|
+
return (
|
|
15
|
+
<span className={clsx(styles.toggleIcon, styles.dark)} style={style}>
|
|
16
|
+
{icon}
|
|
17
|
+
</span>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
function Light({icon, style}) {
|
|
22
|
+
return (
|
|
23
|
+
<span className={clsx(styles.toggleIcon, styles.light)} style={style}>
|
|
24
|
+
{icon}
|
|
25
|
+
</span>
|
|
26
|
+
);
|
|
27
|
+
} // Based on react-toggle (https://github.com/aaronshaf/react-toggle/).
|
|
24
28
|
|
|
25
29
|
const Toggle = memo(
|
|
26
30
|
({className, icons, checked: defaultChecked, disabled, onChange}) => {
|
|
@@ -4,18 +4,21 @@
|
|
|
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 from 'react';
|
|
7
|
+
import React, {useMemo} from 'react';
|
|
8
8
|
import useTabGroupChoice from '@theme/hooks/useTabGroupChoice';
|
|
9
9
|
import UserPreferencesContext from '@theme/UserPreferencesContext';
|
|
10
10
|
|
|
11
11
|
function UserPreferencesProvider(props) {
|
|
12
12
|
const {tabGroupChoices, setTabGroupChoices} = useTabGroupChoice();
|
|
13
|
+
const contextValue = useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
tabGroupChoices,
|
|
16
|
+
setTabGroupChoices,
|
|
17
|
+
}),
|
|
18
|
+
[tabGroupChoices, setTabGroupChoices],
|
|
19
|
+
);
|
|
13
20
|
return (
|
|
14
|
-
<UserPreferencesContext.Provider
|
|
15
|
-
value={{
|
|
16
|
-
tabGroupChoices,
|
|
17
|
-
setTabGroupChoices,
|
|
18
|
-
}}>
|
|
21
|
+
<UserPreferencesContext.Provider value={contextValue}>
|
|
19
22
|
{props.children}
|
|
20
23
|
</UserPreferencesContext.Provider>
|
|
21
24
|
);
|
|
@@ -14,9 +14,8 @@ const themes = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
// Ensure to always return a valid theme even if input is invalid
|
|
17
|
-
const coerceToTheme = (theme) =>
|
|
18
|
-
|
|
19
|
-
};
|
|
17
|
+
const coerceToTheme = (theme) =>
|
|
18
|
+
theme === themes.dark ? themes.dark : themes.light;
|
|
20
19
|
|
|
21
20
|
const getInitialTheme = (defaultMode) => {
|
|
22
21
|
if (!ExecutionEnvironment.canUseDOM) {
|
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-4207",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
29
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
31
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4207",
|
|
27
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4207",
|
|
28
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4207",
|
|
29
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4207",
|
|
30
|
+
"@docusaurus/theme-common": "0.0.0-4207",
|
|
31
|
+
"@docusaurus/types": "0.0.0-4207",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-4207",
|
|
33
|
+
"@docusaurus/utils-validation": "0.0.0-4207",
|
|
34
34
|
"@mdx-js/mdx": "^1.6.21",
|
|
35
35
|
"@mdx-js/react": "^1.6.21",
|
|
36
36
|
"chalk": "^4.1.2",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"rtlcss": "^3.3.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
51
|
+
"@docusaurus/module-type-aliases": "0.0.0-4207",
|
|
52
52
|
"@types/mdx-js__react": "^1.5.4",
|
|
53
53
|
"@types/parse-numeric-range": "^0.0.1",
|
|
54
54
|
"@types/rtlcss": "^3.1.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=14"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "63059ec789f63c76514839ed417d2ef58456666e"
|
|
66
66
|
}
|
package/src/index.ts
CHANGED
|
@@ -27,8 +27,7 @@ const ThemeStorageKey = 'theme';
|
|
|
27
27
|
const noFlashColorMode = ({
|
|
28
28
|
defaultMode,
|
|
29
29
|
respectPrefersColorScheme,
|
|
30
|
-
}: ThemeConfig['colorMode']) => {
|
|
31
|
-
return `(function() {
|
|
30
|
+
}: ThemeConfig['colorMode']) => `(function() {
|
|
32
31
|
var defaultMode = '${defaultMode}';
|
|
33
32
|
var respectPrefersColorScheme = ${respectPrefersColorScheme};
|
|
34
33
|
|
|
@@ -63,7 +62,6 @@ const noFlashColorMode = ({
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
})();`;
|
|
66
|
-
};
|
|
67
65
|
|
|
68
66
|
// Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
|
|
69
67
|
// TODO: import from theme-common once we only support Node.js with ESM support
|
|
@@ -136,12 +134,11 @@ export default function docusaurusThemeClassic(
|
|
|
136
134
|
getTranslationFiles: async () => getTranslationFiles({themeConfig}),
|
|
137
135
|
translateThemeConfig,
|
|
138
136
|
|
|
139
|
-
getDefaultCodeTranslationMessages: () =>
|
|
140
|
-
|
|
137
|
+
getDefaultCodeTranslationMessages: () =>
|
|
138
|
+
readDefaultCodeTranslationMessages({
|
|
141
139
|
dirPath: path.resolve(__dirname, '..', 'codeTranslations'),
|
|
142
140
|
locale: currentLocale,
|
|
143
|
-
})
|
|
144
|
-
},
|
|
141
|
+
}),
|
|
145
142
|
|
|
146
143
|
getClientModules() {
|
|
147
144
|
const modules = [
|
|
@@ -13,10 +13,13 @@ import BlogPostAuthor from '@theme/BlogPostAuthor';
|
|
|
13
13
|
import styles from './styles.module.css';
|
|
14
14
|
|
|
15
15
|
// Component responsible for the authors layout
|
|
16
|
-
export default function BlogPostAuthors({
|
|
16
|
+
export default function BlogPostAuthors({
|
|
17
|
+
authors,
|
|
18
|
+
assets,
|
|
19
|
+
}: Props): JSX.Element | null {
|
|
17
20
|
const authorsCount = authors.length;
|
|
18
21
|
if (authorsCount === 0) {
|
|
19
|
-
return
|
|
22
|
+
return null;
|
|
20
23
|
}
|
|
21
24
|
return (
|
|
22
25
|
<div className="row margin-top--md margin-bottom--sm">
|
|
@@ -28,19 +28,17 @@ export default function BlogSidebar({sidebar}: Props): JSX.Element | null {
|
|
|
28
28
|
{sidebar.title}
|
|
29
29
|
</div>
|
|
30
30
|
<ul className={styles.sidebarItemList}>
|
|
31
|
-
{sidebar.items.map((item) =>
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
);
|
|
43
|
-
})}
|
|
31
|
+
{sidebar.items.map((item) => (
|
|
32
|
+
<li key={item.permalink} className={styles.sidebarItem}>
|
|
33
|
+
<Link
|
|
34
|
+
isNavLink
|
|
35
|
+
to={item.permalink}
|
|
36
|
+
className={styles.sidebarItemLink}
|
|
37
|
+
activeClassName={styles.sidebarItemLinkActive}>
|
|
38
|
+
{item.title}
|
|
39
|
+
</Link>
|
|
40
|
+
</li>
|
|
41
|
+
))}
|
|
44
42
|
</ul>
|
|
45
43
|
</nav>
|
|
46
44
|
);
|
|
@@ -59,7 +59,7 @@ function EditMetaRow({
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export default function DocItemFooter(props: Props): JSX.Element {
|
|
62
|
+
export default function DocItemFooter(props: Props): JSX.Element | null {
|
|
63
63
|
const {content: DocContent} = props;
|
|
64
64
|
const {metadata} = DocContent;
|
|
65
65
|
const {editUrl, lastUpdatedAt, formattedLastUpdatedAt, lastUpdatedBy, tags} =
|
|
@@ -71,7 +71,7 @@ export default function DocItemFooter(props: Props): JSX.Element {
|
|
|
71
71
|
const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow;
|
|
72
72
|
|
|
73
73
|
if (!canDisplayFooter) {
|
|
74
|
-
return
|
|
74
|
+
return null;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
return (
|
|
@@ -90,22 +90,21 @@ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}: Props) {
|
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
// eslint-disable-next-line react/function-component-definition
|
|
93
94
|
const DocSidebarMobileSecondaryMenu: MobileSecondaryMenuComponent<Props> = ({
|
|
94
95
|
toggleSidebar,
|
|
95
96
|
sidebar,
|
|
96
97
|
path,
|
|
97
|
-
}) =>
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
);
|
|
108
|
-
};
|
|
98
|
+
}) => (
|
|
99
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
100
|
+
<DocSidebarItems
|
|
101
|
+
items={sidebar}
|
|
102
|
+
activePath={path}
|
|
103
|
+
onItemClick={() => toggleSidebar()}
|
|
104
|
+
level={1}
|
|
105
|
+
/>
|
|
106
|
+
</ul>
|
|
107
|
+
);
|
|
109
108
|
|
|
110
109
|
function DocSidebarMobile(props: Props) {
|
|
111
110
|
return (
|
|
@@ -44,11 +44,8 @@ const isActiveSidebarItem = (
|
|
|
44
44
|
// Optimize sidebar at each "level"
|
|
45
45
|
// TODO this item should probably not receive the "activePath" props
|
|
46
46
|
// TODO this triggers whole sidebar re-renders on navigation
|
|
47
|
-
export const DocSidebarItems = memo(
|
|
48
|
-
items,
|
|
49
|
-
...props
|
|
50
|
-
}: DocSidebarItemsProps): JSX.Element {
|
|
51
|
-
return (
|
|
47
|
+
export const DocSidebarItems = memo(
|
|
48
|
+
({items, ...props}: DocSidebarItemsProps): JSX.Element => (
|
|
52
49
|
<>
|
|
53
50
|
{items.map((item, index) => (
|
|
54
51
|
<DocSidebarItem
|
|
@@ -58,8 +55,8 @@ export const DocSidebarItems = memo(function DocSidebarItems({
|
|
|
58
55
|
/>
|
|
59
56
|
))}
|
|
60
57
|
</>
|
|
61
|
-
)
|
|
62
|
-
|
|
58
|
+
),
|
|
59
|
+
);
|
|
63
60
|
|
|
64
61
|
export default function DocSidebarItem({
|
|
65
62
|
item,
|
|
@@ -154,11 +154,11 @@ function DocVersionBannerEnabled({versionMetadata}: Props): JSX.Element {
|
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
function DocVersionBanner({versionMetadata}: Props): JSX.Element {
|
|
157
|
+
function DocVersionBanner({versionMetadata}: Props): JSX.Element | null {
|
|
158
158
|
if (versionMetadata.banner) {
|
|
159
159
|
return <DocVersionBannerEnabled versionMetadata={versionMetadata} />;
|
|
160
160
|
}
|
|
161
|
-
return
|
|
161
|
+
return null;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
export default DocVersionBanner;
|
|
@@ -49,20 +49,22 @@ function FooterLink({
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
function FooterLogo({
|
|
53
53
|
sources,
|
|
54
54
|
alt,
|
|
55
55
|
width,
|
|
56
56
|
height,
|
|
57
|
-
}: Pick<ThemedImageProps, 'sources' | 'alt' | 'width' | 'height'>)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
}: Pick<ThemedImageProps, 'sources' | 'alt' | 'width' | 'height'>) {
|
|
58
|
+
return (
|
|
59
|
+
<ThemedImage
|
|
60
|
+
className="footer__logo"
|
|
61
|
+
alt={alt}
|
|
62
|
+
sources={sources}
|
|
63
|
+
width={width}
|
|
64
|
+
height={height}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
66
68
|
|
|
67
69
|
function Footer(): JSX.Element | null {
|
|
68
70
|
const {footer} = useThemeConfig();
|