@docusaurus/theme-classic 0.0.0-4735 → 0.0.0-4738
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 +63 -33
- package/lib-next/theme/BlogArchivePage/index.js +13 -9
- package/lib-next/theme/BlogListPage/index.js +34 -13
- package/lib-next/theme/BlogPostPage/index.js +56 -45
- package/lib-next/theme/BlogTagsListPage/index.js +16 -12
- package/lib-next/theme/BlogTagsPostsPage/index.js +40 -33
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +27 -6
- package/lib-next/theme/DocItem/index.js +78 -63
- package/lib-next/theme/DocPage/index.js +85 -77
- package/lib-next/theme/DocPage/styles.module.css +0 -4
- package/lib-next/theme/DocSidebar/Mobile/index.js +24 -20
- package/lib-next/theme/DocTagDocListPage/index.js +38 -31
- package/lib-next/theme/DocTagsListPage/index.js +21 -16
- package/lib-next/theme/Layout/index.js +15 -10
- package/lib-next/theme/LayoutProviders/index.js +4 -6
- package/lib-next/theme/MDXPage/index.js +32 -26
- package/lib-next/theme/Navbar/ColorModeToggle/index.js +25 -0
- package/lib-next/theme/Navbar/Content/index.js +70 -0
- package/lib-next/theme/Navbar/Content/styles.module.css +15 -0
- package/lib-next/theme/Navbar/Layout/index.js +54 -0
- package/{src/theme/Navbar → lib-next/theme/Navbar/Layout}/styles.module.css +0 -13
- package/lib-next/theme/Navbar/Logo/index.js +17 -0
- package/lib-next/theme/Navbar/MobileSidebar/Header/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/Layout/index.js +28 -0
- package/lib-next/theme/Navbar/MobileSidebar/PrimaryMenu/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/SecondaryMenu/index.js +36 -0
- package/lib-next/theme/Navbar/MobileSidebar/Toggle/index.js +23 -0
- package/lib-next/theme/Navbar/MobileSidebar/index.js +31 -0
- package/lib-next/theme/Navbar/index.js +6 -273
- package/lib-next/theme/NotFound.js +38 -33
- package/lib-next/theme/{LayoutHead → SiteMetadata}/index.js +11 -26
- package/package.json +13 -13
- package/src/theme/BlogArchivePage/index.tsx +13 -9
- package/src/theme/BlogListPage/index.tsx +32 -13
- package/src/theme/BlogPostPage/index.tsx +55 -48
- package/src/theme/BlogTagsListPage/index.tsx +16 -12
- package/src/theme/BlogTagsPostsPage/index.tsx +39 -32
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +31 -4
- package/src/theme/DocItem/index.tsx +65 -52
- package/src/theme/DocPage/index.tsx +85 -77
- package/src/theme/DocPage/styles.module.css +0 -4
- package/src/theme/DocSidebar/Mobile/index.tsx +26 -23
- package/src/theme/DocTagDocListPage/index.tsx +38 -30
- package/src/theme/DocTagsListPage/index.tsx +21 -16
- package/src/theme/Layout/index.tsx +15 -10
- package/src/theme/LayoutProviders/index.tsx +4 -6
- package/src/theme/MDXPage/index.tsx +32 -26
- package/src/theme/Navbar/ColorModeToggle/index.tsx +30 -0
- package/src/theme/Navbar/Content/index.tsx +81 -0
- package/src/theme/Navbar/Content/styles.module.css +15 -0
- package/src/theme/Navbar/Layout/index.tsx +57 -0
- package/{lib-next/theme/Navbar → src/theme/Navbar/Layout}/styles.module.css +0 -13
- package/src/theme/Navbar/Logo/index.tsx +19 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +34 -0
- package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +31 -0
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +25 -0
- package/src/theme/Navbar/MobileSidebar/index.tsx +33 -0
- package/src/theme/Navbar/index.tsx +6 -292
- package/src/theme/NotFound.tsx +38 -33
- package/src/theme/{LayoutHead → SiteMetadata}/index.tsx +11 -25
- package/src/theme-classic.d.ts +63 -33
- package/lib-next/theme/Seo/index.js +0 -40
- package/src/theme/Seo/index.tsx +0 -49
|
@@ -6,40 +6,63 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import Seo from '@theme/Seo';
|
|
10
9
|
import BlogLayout from '@theme/BlogLayout';
|
|
11
10
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
12
11
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
13
12
|
import type {Props} from '@theme/BlogPostPage';
|
|
14
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
PageMetadata,
|
|
15
|
+
HtmlClassNameProvider,
|
|
16
|
+
ThemeClassNames,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
15
18
|
import TOC from '@theme/TOC';
|
|
19
|
+
import clsx from 'clsx';
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
function BlogPostPageMetadata(props: Props): JSX.Element {
|
|
22
|
+
const {content: BlogPostContents} = props;
|
|
23
|
+
const {assets, metadata} = BlogPostContents;
|
|
24
|
+
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
25
|
+
const {keywords} = frontMatter;
|
|
26
|
+
const image = assets.image ?? frontMatter.image;
|
|
27
|
+
return (
|
|
28
|
+
<PageMetadata
|
|
29
|
+
title={title}
|
|
30
|
+
description={description}
|
|
31
|
+
keywords={keywords}
|
|
32
|
+
image={image}>
|
|
33
|
+
<meta property="og:type" content="article" />
|
|
34
|
+
<meta property="article:published_time" content={date} />
|
|
35
|
+
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
36
|
+
{authors.some((author) => author.url) && (
|
|
37
|
+
<meta
|
|
38
|
+
property="article:author"
|
|
39
|
+
content={authors
|
|
40
|
+
.map((author) => author.url)
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(',')}
|
|
43
|
+
/>
|
|
44
|
+
)}
|
|
45
|
+
{tags.length > 0 && (
|
|
46
|
+
<meta
|
|
47
|
+
property="article:tag"
|
|
48
|
+
content={tags.map((tag) => tag.label).join(',')}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
</PageMetadata>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function BlogPostPageContent(props: Props): JSX.Element {
|
|
18
56
|
const {content: BlogPostContents, sidebar} = props;
|
|
19
57
|
const {assets, metadata} = BlogPostContents;
|
|
20
|
-
const {
|
|
21
|
-
title,
|
|
22
|
-
description,
|
|
23
|
-
nextItem,
|
|
24
|
-
prevItem,
|
|
25
|
-
date,
|
|
26
|
-
tags,
|
|
27
|
-
authors,
|
|
28
|
-
frontMatter,
|
|
29
|
-
} = metadata;
|
|
58
|
+
const {nextItem, prevItem, frontMatter} = metadata;
|
|
30
59
|
const {
|
|
31
60
|
hide_table_of_contents: hideTableOfContents,
|
|
32
|
-
keywords,
|
|
33
61
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
34
62
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
35
63
|
} = frontMatter;
|
|
36
|
-
|
|
37
|
-
const image = assets.image ?? frontMatter.image;
|
|
38
|
-
|
|
39
64
|
return (
|
|
40
65
|
<BlogLayout
|
|
41
|
-
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
42
|
-
pageClassName={ThemeClassNames.page.blogPostPage}
|
|
43
66
|
sidebar={sidebar}
|
|
44
67
|
toc={
|
|
45
68
|
!hideTableOfContents &&
|
|
@@ -52,35 +75,6 @@ export default function BlogPostPage(props: Props): JSX.Element {
|
|
|
52
75
|
/>
|
|
53
76
|
) : undefined
|
|
54
77
|
}>
|
|
55
|
-
<Seo
|
|
56
|
-
// TODO refactor needed: it's a bit annoying but Seo MUST be inside
|
|
57
|
-
// BlogLayout, otherwise default image (set by BlogLayout) would shadow
|
|
58
|
-
// the custom blog post image
|
|
59
|
-
title={title}
|
|
60
|
-
description={description}
|
|
61
|
-
keywords={keywords}
|
|
62
|
-
image={image}>
|
|
63
|
-
<meta property="og:type" content="article" />
|
|
64
|
-
<meta property="article:published_time" content={date} />
|
|
65
|
-
|
|
66
|
-
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
67
|
-
{authors.some((author) => author.url) && (
|
|
68
|
-
<meta
|
|
69
|
-
property="article:author"
|
|
70
|
-
content={authors
|
|
71
|
-
.map((author) => author.url)
|
|
72
|
-
.filter(Boolean)
|
|
73
|
-
.join(',')}
|
|
74
|
-
/>
|
|
75
|
-
)}
|
|
76
|
-
{tags.length > 0 && (
|
|
77
|
-
<meta
|
|
78
|
-
property="article:tag"
|
|
79
|
-
content={tags.map((tag) => tag.label).join(',')}
|
|
80
|
-
/>
|
|
81
|
-
)}
|
|
82
|
-
</Seo>
|
|
83
|
-
|
|
84
78
|
<BlogPostItem
|
|
85
79
|
frontMatter={frontMatter}
|
|
86
80
|
assets={assets}
|
|
@@ -95,3 +89,16 @@ export default function BlogPostPage(props: Props): JSX.Element {
|
|
|
95
89
|
</BlogLayout>
|
|
96
90
|
);
|
|
97
91
|
}
|
|
92
|
+
|
|
93
|
+
export default function BlogPostPage(props: Props): JSX.Element {
|
|
94
|
+
return (
|
|
95
|
+
<HtmlClassNameProvider
|
|
96
|
+
className={clsx(
|
|
97
|
+
ThemeClassNames.wrapper.blogPages,
|
|
98
|
+
ThemeClassNames.page.blogPostPage,
|
|
99
|
+
)}>
|
|
100
|
+
<BlogPostPageMetadata {...props} />
|
|
101
|
+
<BlogPostPageContent {...props} />
|
|
102
|
+
</HtmlClassNameProvider>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -11,25 +11,29 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
11
11
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
12
12
|
import type {Props} from '@theme/BlogTagsListPage';
|
|
13
13
|
import {
|
|
14
|
+
PageMetadata,
|
|
15
|
+
HtmlClassNameProvider,
|
|
14
16
|
ThemeClassNames,
|
|
15
17
|
translateTagsPageTitle,
|
|
16
18
|
} from '@docusaurus/theme-common';
|
|
19
|
+
import SearchMetadata from '../SearchMetadata';
|
|
20
|
+
import clsx from 'clsx';
|
|
17
21
|
|
|
18
22
|
export default function BlogTagsListPage(props: Props): JSX.Element {
|
|
19
23
|
const {tags, sidebar} = props;
|
|
20
24
|
const title = translateTagsPageTitle();
|
|
21
25
|
return (
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
26
|
+
<HtmlClassNameProvider
|
|
27
|
+
className={clsx(
|
|
28
|
+
ThemeClassNames.wrapper.blogPages,
|
|
29
|
+
ThemeClassNames.page.blogTagsListPage,
|
|
30
|
+
)}>
|
|
31
|
+
<PageMetadata title={title} />
|
|
32
|
+
<SearchMetadata tag="blog_tags_list" />
|
|
33
|
+
<BlogLayout sidebar={sidebar}>
|
|
34
|
+
<h1>{title}</h1>
|
|
35
|
+
<TagsListByLetter tags={Object.values(tags)} />
|
|
36
|
+
</BlogLayout>
|
|
37
|
+
</HtmlClassNameProvider>
|
|
34
38
|
);
|
|
35
39
|
}
|
|
@@ -12,8 +12,15 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
12
12
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
13
13
|
import type {Props} from '@theme/BlogTagsPostsPage';
|
|
14
14
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
PageMetadata,
|
|
17
|
+
HtmlClassNameProvider,
|
|
18
|
+
ThemeClassNames,
|
|
19
|
+
usePluralForm,
|
|
20
|
+
} from '@docusaurus/theme-common';
|
|
16
21
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
22
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
23
|
+
import clsx from 'clsx';
|
|
17
24
|
|
|
18
25
|
// Very simple pluralization: probably good enough for now
|
|
19
26
|
function useBlogPostsPlural() {
|
|
@@ -47,38 +54,38 @@ export default function BlogTagsPostsPage(props: Props): JSX.Element {
|
|
|
47
54
|
);
|
|
48
55
|
|
|
49
56
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<h1>{title}</h1>
|
|
57
|
+
<HtmlClassNameProvider
|
|
58
|
+
className={clsx(
|
|
59
|
+
ThemeClassNames.wrapper.blogPages,
|
|
60
|
+
ThemeClassNames.page.blogTagPostListPage,
|
|
61
|
+
)}>
|
|
62
|
+
<PageMetadata title={title} />
|
|
63
|
+
<SearchMetadata tag="blog_tags_posts" />
|
|
64
|
+
<BlogLayout sidebar={sidebar}>
|
|
65
|
+
<header className="margin-bottom--xl">
|
|
66
|
+
<h1>{title}</h1>
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
<Link href={allTagsPath}>
|
|
69
|
+
<Translate
|
|
70
|
+
id="theme.tags.tagsPageLink"
|
|
71
|
+
description="The label of the link targeting the tag list page">
|
|
72
|
+
View All Tags
|
|
73
|
+
</Translate>
|
|
74
|
+
</Link>
|
|
75
|
+
</header>
|
|
70
76
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
{items.map(({content: BlogPostContent}) => (
|
|
78
|
+
<BlogPostItem
|
|
79
|
+
key={BlogPostContent.metadata.permalink}
|
|
80
|
+
frontMatter={BlogPostContent.frontMatter}
|
|
81
|
+
assets={BlogPostContent.assets}
|
|
82
|
+
metadata={BlogPostContent.metadata}
|
|
83
|
+
truncated>
|
|
84
|
+
<BlogPostContent />
|
|
85
|
+
</BlogPostItem>
|
|
86
|
+
))}
|
|
87
|
+
<BlogListPaginator metadata={listMetadata} />
|
|
88
|
+
</BlogLayout>
|
|
89
|
+
</HtmlClassNameProvider>
|
|
83
90
|
);
|
|
84
91
|
}
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
PageMetadata,
|
|
11
|
+
useCurrentSidebarCategory,
|
|
12
|
+
} from '@docusaurus/theme-common';
|
|
10
13
|
import type {Props} from '@theme/DocCategoryGeneratedIndexPage';
|
|
11
14
|
import DocCardList from '@theme/DocCardList';
|
|
12
15
|
import DocPaginator from '@theme/DocPaginator';
|
|
13
|
-
import Seo from '@theme/Seo';
|
|
14
16
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
15
17
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
16
18
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
@@ -19,13 +21,27 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
|
19
21
|
|
|
20
22
|
import styles from './styles.module.css';
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
function DocCategoryGeneratedIndexPageMetadata({
|
|
25
|
+
categoryGeneratedIndex,
|
|
26
|
+
}: Props): JSX.Element {
|
|
27
|
+
return (
|
|
28
|
+
<PageMetadata
|
|
29
|
+
title={categoryGeneratedIndex.title}
|
|
30
|
+
description={categoryGeneratedIndex.description}
|
|
31
|
+
keywords={categoryGeneratedIndex.keywords}
|
|
32
|
+
// TODO `require` this?
|
|
33
|
+
image={useBaseUrl(categoryGeneratedIndex.image)}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function DocCategoryGeneratedIndexPageContent({
|
|
23
39
|
categoryGeneratedIndex,
|
|
24
40
|
}: Props): JSX.Element {
|
|
25
41
|
const category = useCurrentSidebarCategory();
|
|
26
42
|
return (
|
|
27
43
|
<>
|
|
28
|
-
<
|
|
44
|
+
<PageMetadata
|
|
29
45
|
title={categoryGeneratedIndex.title}
|
|
30
46
|
description={categoryGeneratedIndex.description}
|
|
31
47
|
keywords={categoryGeneratedIndex.keywords}
|
|
@@ -57,3 +73,14 @@ export default function DocCategoryGeneratedIndexPage({
|
|
|
57
73
|
</>
|
|
58
74
|
);
|
|
59
75
|
}
|
|
76
|
+
|
|
77
|
+
export default function DocCategoryGeneratedIndexPage(
|
|
78
|
+
props: Props,
|
|
79
|
+
): JSX.Element {
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<DocCategoryGeneratedIndexPageMetadata {...props} />
|
|
83
|
+
<DocCategoryGeneratedIndexPageContent {...props} />
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -10,7 +10,6 @@ import clsx from 'clsx';
|
|
|
10
10
|
import DocPaginator from '@theme/DocPaginator';
|
|
11
11
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
12
12
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
13
|
-
import Seo from '@theme/Seo';
|
|
14
13
|
import type {Props} from '@theme/DocItem';
|
|
15
14
|
import DocItemFooter from '@theme/DocItemFooter';
|
|
16
15
|
import TOC from '@theme/TOC';
|
|
@@ -18,6 +17,7 @@ import TOCCollapsible from '@theme/TOCCollapsible';
|
|
|
18
17
|
import Heading from '@theme/Heading';
|
|
19
18
|
import styles from './styles.module.css';
|
|
20
19
|
import {
|
|
20
|
+
PageMetadata,
|
|
21
21
|
HtmlClassNameProvider,
|
|
22
22
|
ThemeClassNames,
|
|
23
23
|
useWindowSize,
|
|
@@ -25,18 +25,26 @@ import {
|
|
|
25
25
|
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
26
26
|
import MDXContent from '@theme/MDXContent';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
function DocItemMetadata(props: Props): JSX.Element {
|
|
29
29
|
const {content: DocContent} = props;
|
|
30
30
|
const {metadata, frontMatter, assets} = DocContent;
|
|
31
|
+
const {keywords} = frontMatter;
|
|
32
|
+
const {description, title} = metadata;
|
|
33
|
+
const image = assets.image ?? frontMatter.image;
|
|
34
|
+
|
|
35
|
+
return <PageMetadata {...{title, description, keywords, image}} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function DocItemContent(props: Props): JSX.Element {
|
|
39
|
+
const {content: DocContent} = props;
|
|
40
|
+
const {metadata, frontMatter} = DocContent;
|
|
31
41
|
const {
|
|
32
|
-
keywords,
|
|
33
42
|
hide_title: hideTitle,
|
|
34
43
|
hide_table_of_contents: hideTableOfContents,
|
|
35
44
|
toc_min_heading_level: tocMinHeadingLevel,
|
|
36
45
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
37
46
|
} = frontMatter;
|
|
38
|
-
const {
|
|
39
|
-
const image = assets.image ?? frontMatter.image;
|
|
47
|
+
const {title} = metadata;
|
|
40
48
|
|
|
41
49
|
// We only add a title if:
|
|
42
50
|
// - user asks to hide it with front matter
|
|
@@ -53,64 +61,69 @@ export default function DocItem(props: Props): JSX.Element {
|
|
|
53
61
|
canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
|
|
54
62
|
|
|
55
63
|
return (
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<article>
|
|
64
|
-
<DocBreadcrumbs />
|
|
65
|
-
<DocVersionBadge />
|
|
64
|
+
<div className="row">
|
|
65
|
+
<div className={clsx('col', !hideTableOfContents && styles.docItemCol)}>
|
|
66
|
+
<DocVersionBanner />
|
|
67
|
+
<div className={styles.docItemContainer}>
|
|
68
|
+
<article>
|
|
69
|
+
<DocBreadcrumbs />
|
|
70
|
+
<DocVersionBadge />
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
{canRenderTOC && (
|
|
73
|
+
<TOCCollapsible
|
|
74
|
+
toc={DocContent.toc}
|
|
75
|
+
minHeadingLevel={tocMinHeadingLevel}
|
|
76
|
+
maxHeadingLevel={tocMaxHeadingLevel}
|
|
77
|
+
className={clsx(
|
|
78
|
+
ThemeClassNames.docs.docTocMobile,
|
|
79
|
+
styles.tocMobile,
|
|
80
|
+
)}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{/*
|
|
84
|
+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
85
|
+
{/*
|
|
82
86
|
Title can be declared inside md content or declared through
|
|
83
87
|
front matter and added manually. To make both cases consistent,
|
|
84
88
|
the added title is added under the same div.markdown block
|
|
85
89
|
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
86
90
|
*/}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
{shouldAddTitle && (
|
|
92
|
+
<header>
|
|
93
|
+
<Heading as="h1">{title}</Heading>
|
|
94
|
+
</header>
|
|
95
|
+
)}
|
|
96
|
+
<MDXContent>
|
|
97
|
+
<DocContent />
|
|
98
|
+
</MDXContent>
|
|
99
|
+
</div>
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
<DocItemFooter {...props} />
|
|
102
|
+
</article>
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
</div>
|
|
104
|
+
<DocPaginator previous={metadata.previous} next={metadata.next} />
|
|
102
105
|
</div>
|
|
103
|
-
{renderTocDesktop && (
|
|
104
|
-
<div className="col col--3">
|
|
105
|
-
<TOC
|
|
106
|
-
toc={DocContent.toc}
|
|
107
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
108
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
109
|
-
className={ThemeClassNames.docs.docTocDesktop}
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
)}
|
|
113
106
|
</div>
|
|
107
|
+
{renderTocDesktop && (
|
|
108
|
+
<div className="col col--3">
|
|
109
|
+
<TOC
|
|
110
|
+
toc={DocContent.toc}
|
|
111
|
+
minHeadingLevel={tocMinHeadingLevel}
|
|
112
|
+
maxHeadingLevel={tocMaxHeadingLevel}
|
|
113
|
+
className={ThemeClassNames.docs.docTocDesktop}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default function DocItem(props: Props): JSX.Element {
|
|
122
|
+
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
123
|
+
return (
|
|
124
|
+
<HtmlClassNameProvider className={docHtmlClassName}>
|
|
125
|
+
<DocItemMetadata {...props} />
|
|
126
|
+
<DocItemContent {...props} />
|
|
114
127
|
</HtmlClassNameProvider>
|
|
115
128
|
);
|
|
116
129
|
}
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
useDocsSidebar,
|
|
30
30
|
DocsVersionProvider,
|
|
31
31
|
} from '@docusaurus/theme-common';
|
|
32
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
32
33
|
|
|
33
34
|
type DocPageContentProps = {
|
|
34
35
|
readonly currentDocRoute: DocumentRoute;
|
|
@@ -56,87 +57,89 @@ function DocPageContent({
|
|
|
56
57
|
}, [hiddenSidebar]);
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<BackToTopButton />
|
|
60
|
+
<>
|
|
61
|
+
<SearchMetadata
|
|
62
|
+
version={version}
|
|
63
|
+
tag={docVersionSearchTag(pluginId, version)}
|
|
64
|
+
/>
|
|
65
|
+
<Layout>
|
|
66
|
+
<div className={styles.docPage}>
|
|
67
|
+
<BackToTopButton />
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
{sidebar && (
|
|
70
|
+
<aside
|
|
71
|
+
className={clsx(
|
|
72
|
+
ThemeClassNames.docs.docSidebarContainer,
|
|
73
|
+
styles.docSidebarContainer,
|
|
74
|
+
hiddenSidebarContainer && styles.docSidebarContainerHidden,
|
|
75
|
+
)}
|
|
76
|
+
onTransitionEnd={(e) => {
|
|
77
|
+
if (
|
|
78
|
+
!e.currentTarget.classList.contains(
|
|
79
|
+
styles.docSidebarContainer!,
|
|
80
|
+
)
|
|
81
|
+
) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
if (hiddenSidebarContainer) {
|
|
86
|
+
setHiddenSidebar(true);
|
|
87
|
+
}
|
|
88
|
+
}}>
|
|
89
|
+
<DocSidebar
|
|
90
|
+
key={
|
|
91
|
+
// Reset sidebar state on sidebar changes
|
|
92
|
+
// See https://github.com/facebook/docusaurus/issues/3414
|
|
93
|
+
sidebarName
|
|
94
|
+
}
|
|
95
|
+
sidebar={sidebar}
|
|
96
|
+
path={currentDocRoute.path}
|
|
97
|
+
onCollapse={toggleSidebar}
|
|
98
|
+
isHidden={hiddenSidebar}
|
|
99
|
+
/>
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
className={clsx(
|
|
125
|
-
styles.docMainContainer,
|
|
126
|
-
(hiddenSidebarContainer || !sidebar) &&
|
|
127
|
-
styles.docMainContainerEnhanced,
|
|
128
|
-
)}>
|
|
129
|
-
<div
|
|
101
|
+
{hiddenSidebar && (
|
|
102
|
+
<div
|
|
103
|
+
className={styles.collapsedDocSidebar}
|
|
104
|
+
title={translate({
|
|
105
|
+
id: 'theme.docs.sidebar.expandButtonTitle',
|
|
106
|
+
message: 'Expand sidebar',
|
|
107
|
+
description:
|
|
108
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
109
|
+
})}
|
|
110
|
+
aria-label={translate({
|
|
111
|
+
id: 'theme.docs.sidebar.expandButtonAriaLabel',
|
|
112
|
+
message: 'Expand sidebar',
|
|
113
|
+
description:
|
|
114
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
115
|
+
})}
|
|
116
|
+
tabIndex={0}
|
|
117
|
+
role="button"
|
|
118
|
+
onKeyDown={toggleSidebar}
|
|
119
|
+
onClick={toggleSidebar}>
|
|
120
|
+
<IconArrow className={styles.expandSidebarButtonIcon} />
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
123
|
+
</aside>
|
|
124
|
+
)}
|
|
125
|
+
<main
|
|
130
126
|
className={clsx(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
styles.docMainContainer,
|
|
128
|
+
(hiddenSidebarContainer || !sidebar) &&
|
|
129
|
+
styles.docMainContainerEnhanced,
|
|
134
130
|
)}>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
<div
|
|
132
|
+
className={clsx(
|
|
133
|
+
'container padding-top--md padding-bottom--lg',
|
|
134
|
+
styles.docItemWrapper,
|
|
135
|
+
hiddenSidebarContainer && styles.docItemWrapperEnhanced,
|
|
136
|
+
)}>
|
|
137
|
+
{children}
|
|
138
|
+
</div>
|
|
139
|
+
</main>
|
|
140
|
+
</div>
|
|
141
|
+
</Layout>
|
|
142
|
+
</>
|
|
140
143
|
);
|
|
141
144
|
}
|
|
142
145
|
|
|
@@ -161,7 +164,12 @@ export default function DocPage(props: Props): JSX.Element {
|
|
|
161
164
|
: null;
|
|
162
165
|
|
|
163
166
|
return (
|
|
164
|
-
<HtmlClassNameProvider
|
|
167
|
+
<HtmlClassNameProvider
|
|
168
|
+
className={clsx(
|
|
169
|
+
ThemeClassNames.wrapper.docsPages,
|
|
170
|
+
ThemeClassNames.page.docsDocPage,
|
|
171
|
+
versionMetadata.className,
|
|
172
|
+
)}>
|
|
165
173
|
<DocsVersionProvider version={versionMetadata}>
|
|
166
174
|
<DocsSidebarProvider sidebar={sidebar ?? null}>
|
|
167
175
|
<DocPageContent
|