@docusaurus/theme-classic 0.0.0-5183 → 0.0.0-5186
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 +5 -5
- package/lib/theme/AnnouncementBar/index.js +1 -1
- package/lib/theme/BlogListPage/index.js +2 -11
- package/lib/theme/BlogPostItem/Container/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Container/index.js +26 -0
- package/lib/theme/BlogPostItem/Content/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Content/index.js +23 -0
- package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.js +38 -0
- package/lib/theme/BlogPostItem/Footer/index.d.ts +8 -0
- package/lib/theme/BlogPostItem/Footer/index.js +52 -0
- package/lib/theme/BlogPostItem/Footer/styles.module.css +10 -0
- package/lib/theme/BlogPostItem/Header/Author/index.d.ts +9 -0
- package/lib/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.js +3 -2
- package/lib/theme/BlogPostItem/Header/Authors/index.d.ts +9 -0
- package/{src/theme/BlogPostAuthors/index.tsx → lib/theme/BlogPostItem/Header/Authors/index.js} +9 -10
- package/lib/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
- package/lib/theme/{BlogPostAuthor → BlogPostItem/Header/Info}/index.d.ts +2 -2
- package/lib/theme/BlogPostItem/Header/Info/index.js +60 -0
- package/lib/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
- package/lib/theme/{BlogPostAuthors → BlogPostItem/Header/Title}/index.d.ts +2 -2
- package/lib/theme/BlogPostItem/Header/Title/index.js +27 -0
- package/{src/theme/BlogPostItem → lib/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
- package/lib/theme/BlogPostItem/Header/index.d.ts +8 -0
- package/lib/theme/BlogPostItem/Header/index.js +19 -0
- package/lib/theme/BlogPostItem/index.d.ts +1 -1
- package/lib/theme/BlogPostItem/index.js +16 -142
- package/lib/theme/BlogPostItems/index.d.ts +9 -0
- package/lib/theme/BlogPostItems/index.js +27 -0
- package/lib/theme/BlogPostPage/Metadata/index.d.ts +8 -0
- package/lib/theme/BlogPostPage/Metadata/index.js +41 -0
- package/lib/theme/BlogPostPage/index.js +21 -58
- package/lib/theme/BlogTagsPostsPage/index.d.ts +1 -1
- package/lib/theme/BlogTagsPostsPage/index.js +36 -30
- package/lib/theme/ColorModeToggle/index.js +2 -2
- package/lib/theme/DocBreadcrumbs/index.js +1 -1
- package/lib/theme/DocPage/Layout/Sidebar/ExpandButton/index.js +1 -1
- package/lib/theme/DocSidebar/Desktop/CollapseButton/index.js +1 -1
- package/lib/theme/DocSidebarItem/Link/index.js +1 -1
- package/lib/theme/EditThisPage/index.js +1 -1
- package/lib/theme/Footer/LinkItem/index.js +1 -1
- package/lib/theme/{IconArrow → Icon/Arrow}/index.d.ts +1 -1
- package/lib/theme/{IconArrow → Icon/Arrow}/index.js +0 -0
- package/lib/theme/{IconClose → Icon/Close}/index.d.ts +1 -1
- package/lib/theme/{IconClose → Icon/Close}/index.js +0 -0
- package/lib/theme/{IconDarkMode → Icon/DarkMode}/index.d.ts +1 -1
- package/lib/theme/{IconDarkMode → Icon/DarkMode}/index.js +0 -0
- package/lib/theme/{IconEdit → Icon/Edit}/index.d.ts +1 -1
- package/lib/theme/{IconEdit → Icon/Edit}/index.js +0 -0
- package/lib/theme/{IconEdit → Icon/Edit}/styles.module.css +0 -0
- package/lib/theme/{IconExternalLink → Icon/ExternalLink}/index.d.ts +1 -1
- package/lib/theme/{IconExternalLink → Icon/ExternalLink}/index.js +0 -0
- package/lib/theme/{IconExternalLink → Icon/ExternalLink}/styles.module.css +0 -0
- package/lib/theme/{IconHome → Icon/Home}/index.d.ts +1 -1
- package/lib/theme/{IconHome → Icon/Home}/index.js +0 -0
- package/lib/theme/{IconLanguage → Icon/Language}/index.d.ts +1 -1
- package/lib/theme/{IconLanguage → Icon/Language}/index.js +0 -0
- package/lib/theme/{IconLightMode → Icon/LightMode}/index.d.ts +1 -1
- package/lib/theme/{IconLightMode → Icon/LightMode}/index.js +0 -0
- package/lib/theme/{IconMenu → Icon/Menu}/index.d.ts +1 -1
- package/lib/theme/{IconMenu → Icon/Menu}/index.js +0 -0
- package/lib/theme/Navbar/MobileSidebar/Header/index.js +1 -1
- package/lib/theme/Navbar/MobileSidebar/Toggle/index.js +1 -1
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +1 -1
- package/lib/theme/NavbarItem/NavbarNavLink.js +1 -1
- package/package.json +15 -15
- package/src/getSwizzleConfig.ts +5 -5
- package/src/theme/AnnouncementBar/index.tsx +1 -1
- package/src/theme/BlogListPage/index.tsx +2 -11
- package/src/theme/BlogPostItem/Container/index.tsx +32 -0
- package/src/theme/BlogPostItem/Content/index.tsx +29 -0
- package/src/theme/BlogPostItem/Footer/ReadMoreLink/index.tsx +44 -0
- package/src/theme/BlogPostItem/Footer/index.tsx +60 -0
- package/src/theme/BlogPostItem/Footer/styles.module.css +10 -0
- package/src/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.tsx +8 -3
- package/{lib/theme/BlogPostAuthors/index.js → src/theme/BlogPostItem/Header/Authors/index.tsx} +14 -3
- package/src/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
- package/src/theme/BlogPostItem/Header/Info/index.tsx +71 -0
- package/src/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
- package/src/theme/BlogPostItem/Header/Title/index.tsx +33 -0
- package/{lib/theme/BlogPostItem → src/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
- package/src/theme/BlogPostItem/Header/index.tsx +21 -0
- package/src/theme/BlogPostItem/index.tsx +19 -145
- package/src/theme/BlogPostItems/index.tsx +30 -0
- package/src/theme/BlogPostPage/Metadata/index.tsx +44 -0
- package/src/theme/BlogPostPage/index.tsx +29 -60
- package/src/theme/BlogTagsPostsPage/index.tsx +42 -35
- package/src/theme/ColorModeToggle/index.tsx +2 -2
- package/src/theme/DocBreadcrumbs/index.tsx +1 -1
- package/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx +1 -1
- package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +1 -1
- package/src/theme/DocSidebarItem/Link/index.tsx +1 -1
- package/src/theme/EditThisPage/index.tsx +1 -1
- package/src/theme/Footer/LinkItem/index.tsx +1 -1
- package/src/theme/{IconArrow → Icon/Arrow}/index.tsx +1 -1
- package/src/theme/{IconClose → Icon/Close}/index.tsx +1 -1
- package/src/theme/{IconDarkMode → Icon/DarkMode}/index.tsx +1 -1
- package/src/theme/{IconEdit → Icon/Edit}/index.tsx +1 -1
- package/src/theme/{IconEdit → Icon/Edit}/styles.module.css +0 -0
- package/src/theme/{IconExternalLink → Icon/ExternalLink}/index.tsx +1 -1
- package/src/theme/{IconExternalLink → Icon/ExternalLink}/styles.module.css +0 -0
- package/src/theme/{IconHome → Icon/Home}/index.tsx +1 -1
- package/src/theme/{IconLanguage → Icon/Language}/index.tsx +1 -1
- package/src/theme/{IconLightMode → Icon/LightMode}/index.tsx +1 -1
- package/src/theme/{IconMenu → Icon/Menu}/index.tsx +1 -1
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +1 -1
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +1 -1
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +1 -1
- package/src/theme/NavbarItem/NavbarNavLink.tsx +1 -1
- package/src/theme-classic.d.ts +89 -27
|
@@ -6,149 +6,23 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import styles from './styles.module.css';
|
|
19
|
-
// Very simple pluralization: probably good enough for now
|
|
20
|
-
function useReadingTimePlural() {
|
|
21
|
-
const {selectMessage} = usePluralForm();
|
|
22
|
-
return (readingTimeFloat) => {
|
|
23
|
-
const readingTime = Math.ceil(readingTimeFloat);
|
|
24
|
-
return selectMessage(
|
|
25
|
-
readingTime,
|
|
26
|
-
translate(
|
|
27
|
-
{
|
|
28
|
-
id: 'theme.blog.post.readingTime.plurals',
|
|
29
|
-
description:
|
|
30
|
-
'Pluralized label for "{readingTime} min read". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',
|
|
31
|
-
message: 'One min read|{readingTime} min read',
|
|
32
|
-
},
|
|
33
|
-
{readingTime},
|
|
34
|
-
),
|
|
35
|
-
);
|
|
36
|
-
};
|
|
9
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
10
|
+
import BlogPostItemContainer from '@theme/BlogPostItem/Container';
|
|
11
|
+
import BlogPostItemHeader from '@theme/BlogPostItem/Header';
|
|
12
|
+
import BlogPostItemContent from '@theme/BlogPostItem/Content';
|
|
13
|
+
import BlogPostItemFooter from '@theme/BlogPostItem/Footer';
|
|
14
|
+
// apply a bottom margin in list view
|
|
15
|
+
function useContainerClassName() {
|
|
16
|
+
const {isBlogPostPage} = useBlogPost();
|
|
17
|
+
return !isBlogPostPage ? 'margin-bottom--xl' : undefined;
|
|
37
18
|
}
|
|
38
|
-
export default function BlogPostItem(
|
|
39
|
-
const
|
|
40
|
-
const {withBaseUrl} = useBaseUrlUtils();
|
|
41
|
-
const {
|
|
42
|
-
children,
|
|
43
|
-
frontMatter,
|
|
44
|
-
assets,
|
|
45
|
-
metadata,
|
|
46
|
-
truncated,
|
|
47
|
-
isBlogPostPage = false,
|
|
48
|
-
} = props;
|
|
49
|
-
const {
|
|
50
|
-
date,
|
|
51
|
-
formattedDate,
|
|
52
|
-
permalink,
|
|
53
|
-
tags,
|
|
54
|
-
readingTime,
|
|
55
|
-
title,
|
|
56
|
-
editUrl,
|
|
57
|
-
authors,
|
|
58
|
-
} = metadata;
|
|
59
|
-
const image = assets.image ?? frontMatter.image;
|
|
60
|
-
const truncatedPost = !isBlogPostPage && truncated;
|
|
61
|
-
const tagsExists = tags.length > 0;
|
|
62
|
-
const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
|
|
19
|
+
export default function BlogPostItem({children, className}) {
|
|
20
|
+
const containerClassName = useContainerClassName();
|
|
63
21
|
return (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<header>
|
|
70
|
-
<TitleHeading className={styles.blogPostTitle} itemProp="headline">
|
|
71
|
-
{isBlogPostPage ? (
|
|
72
|
-
title
|
|
73
|
-
) : (
|
|
74
|
-
<Link itemProp="url" to={permalink}>
|
|
75
|
-
{title}
|
|
76
|
-
</Link>
|
|
77
|
-
)}
|
|
78
|
-
</TitleHeading>
|
|
79
|
-
<div className={clsx(styles.blogPostData, 'margin-vert--md')}>
|
|
80
|
-
<time dateTime={date} itemProp="datePublished">
|
|
81
|
-
{formattedDate}
|
|
82
|
-
</time>
|
|
83
|
-
|
|
84
|
-
{typeof readingTime !== 'undefined' && (
|
|
85
|
-
<>
|
|
86
|
-
{' · '}
|
|
87
|
-
{readingTimePlural(readingTime)}
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</div>
|
|
91
|
-
<BlogPostAuthors authors={authors} assets={assets} />
|
|
92
|
-
</header>
|
|
93
|
-
|
|
94
|
-
{image && (
|
|
95
|
-
<meta itemProp="image" content={withBaseUrl(image, {absolute: true})} />
|
|
96
|
-
)}
|
|
97
|
-
|
|
98
|
-
<div
|
|
99
|
-
// This ID is used for the feed generation to locate the main content
|
|
100
|
-
id={isBlogPostPage ? blogPostContainerID : undefined}
|
|
101
|
-
className="markdown"
|
|
102
|
-
itemProp="articleBody">
|
|
103
|
-
<MDXContent>{children}</MDXContent>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
{(tagsExists || truncated || editUrl) && (
|
|
107
|
-
<footer
|
|
108
|
-
className={clsx(
|
|
109
|
-
'row docusaurus-mt-lg',
|
|
110
|
-
isBlogPostPage && styles.blogPostDetailsFull,
|
|
111
|
-
)}>
|
|
112
|
-
{tagsExists && (
|
|
113
|
-
<div className={clsx('col', {'col--9': truncatedPost})}>
|
|
114
|
-
<TagsListInline tags={tags} />
|
|
115
|
-
</div>
|
|
116
|
-
)}
|
|
117
|
-
|
|
118
|
-
{isBlogPostPage && editUrl && (
|
|
119
|
-
<div className="col margin-top--sm">
|
|
120
|
-
<EditThisPage editUrl={editUrl} />
|
|
121
|
-
</div>
|
|
122
|
-
)}
|
|
123
|
-
|
|
124
|
-
{truncatedPost && (
|
|
125
|
-
<div
|
|
126
|
-
className={clsx('col text--right', {
|
|
127
|
-
'col--3': tagsExists,
|
|
128
|
-
})}>
|
|
129
|
-
<Link
|
|
130
|
-
to={metadata.permalink}
|
|
131
|
-
aria-label={translate(
|
|
132
|
-
{
|
|
133
|
-
message: 'Read more about {title}',
|
|
134
|
-
id: 'theme.blog.post.readMoreLabel',
|
|
135
|
-
description:
|
|
136
|
-
'The ARIA label for the link to full blog posts from excerpts',
|
|
137
|
-
},
|
|
138
|
-
{title},
|
|
139
|
-
)}>
|
|
140
|
-
<b>
|
|
141
|
-
<Translate
|
|
142
|
-
id="theme.blog.post.readMore"
|
|
143
|
-
description="The label used in blog post item excerpts to link to full blog posts">
|
|
144
|
-
Read More
|
|
145
|
-
</Translate>
|
|
146
|
-
</b>
|
|
147
|
-
</Link>
|
|
148
|
-
</div>
|
|
149
|
-
)}
|
|
150
|
-
</footer>
|
|
151
|
-
)}
|
|
152
|
-
</article>
|
|
22
|
+
<BlogPostItemContainer className={clsx(containerClassName, className)}>
|
|
23
|
+
<BlogPostItemHeader />
|
|
24
|
+
<BlogPostItemContent>{children}</BlogPostItemContent>
|
|
25
|
+
<BlogPostItemFooter />
|
|
26
|
+
</BlogPostItemContainer>
|
|
153
27
|
);
|
|
154
28
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
import type { Props } from '@theme/BlogPostItems';
|
|
9
|
+
export default function BlogPostItems({ items, component: BlogPostItemComponent, }: Props): JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 {BlogPostProvider} from '@docusaurus/theme-common/internal';
|
|
9
|
+
import BlogPostItem from '@theme/BlogPostItem';
|
|
10
|
+
export default function BlogPostItems({
|
|
11
|
+
items,
|
|
12
|
+
component: BlogPostItemComponent = BlogPostItem,
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
{items.map(({content: BlogPostContent}) => (
|
|
17
|
+
<BlogPostProvider
|
|
18
|
+
key={BlogPostContent.metadata.permalink}
|
|
19
|
+
content={BlogPostContent}>
|
|
20
|
+
<BlogPostItemComponent>
|
|
21
|
+
<BlogPostContent />
|
|
22
|
+
</BlogPostItemComponent>
|
|
23
|
+
</BlogPostProvider>
|
|
24
|
+
))}
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
export default function BlogPostPageMetadata(): JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 {PageMetadata} from '@docusaurus/theme-common';
|
|
9
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
10
|
+
export default function BlogPostPageMetadata() {
|
|
11
|
+
const {assets, metadata} = useBlogPost();
|
|
12
|
+
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
13
|
+
const {keywords} = frontMatter;
|
|
14
|
+
const image = assets.image ?? frontMatter.image;
|
|
15
|
+
return (
|
|
16
|
+
<PageMetadata
|
|
17
|
+
title={title}
|
|
18
|
+
description={description}
|
|
19
|
+
keywords={keywords}
|
|
20
|
+
image={image}>
|
|
21
|
+
<meta property="og:type" content="article" />
|
|
22
|
+
<meta property="article:published_time" content={date} />
|
|
23
|
+
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
24
|
+
{authors.some((author) => author.url) && (
|
|
25
|
+
<meta
|
|
26
|
+
property="article:author"
|
|
27
|
+
content={authors
|
|
28
|
+
.map((author) => author.url)
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(',')}
|
|
31
|
+
/>
|
|
32
|
+
)}
|
|
33
|
+
{tags.length > 0 && (
|
|
34
|
+
<meta
|
|
35
|
+
property="article:tag"
|
|
36
|
+
content={tags.map((tag) => tag.label).join(',')}
|
|
37
|
+
/>
|
|
38
|
+
)}
|
|
39
|
+
</PageMetadata>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -6,51 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
HtmlClassNameProvider,
|
|
12
|
-
ThemeClassNames,
|
|
13
|
-
} from '@docusaurus/theme-common';
|
|
9
|
+
import {HtmlClassNameProvider, ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
|
+
import {BlogPostProvider, useBlogPost} from '@docusaurus/theme-common/internal';
|
|
14
11
|
import BlogLayout from '@theme/BlogLayout';
|
|
15
12
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
16
13
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
14
|
+
import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
|
|
17
15
|
import TOC from '@theme/TOC';
|
|
18
|
-
function
|
|
19
|
-
const {
|
|
20
|
-
const {assets, metadata} = BlogPostContents;
|
|
21
|
-
const {title, description, date, tags, authors, frontMatter} = metadata;
|
|
22
|
-
const {keywords} = frontMatter;
|
|
23
|
-
const image = assets.image ?? frontMatter.image;
|
|
24
|
-
return (
|
|
25
|
-
<PageMetadata
|
|
26
|
-
title={title}
|
|
27
|
-
description={description}
|
|
28
|
-
keywords={keywords}
|
|
29
|
-
image={image}>
|
|
30
|
-
<meta property="og:type" content="article" />
|
|
31
|
-
<meta property="article:published_time" content={date} />
|
|
32
|
-
{/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
|
|
33
|
-
{authors.some((author) => author.url) && (
|
|
34
|
-
<meta
|
|
35
|
-
property="article:author"
|
|
36
|
-
content={authors
|
|
37
|
-
.map((author) => author.url)
|
|
38
|
-
.filter(Boolean)
|
|
39
|
-
.join(',')}
|
|
40
|
-
/>
|
|
41
|
-
)}
|
|
42
|
-
{tags.length > 0 && (
|
|
43
|
-
<meta
|
|
44
|
-
property="article:tag"
|
|
45
|
-
content={tags.map((tag) => tag.label).join(',')}
|
|
46
|
-
/>
|
|
47
|
-
)}
|
|
48
|
-
</PageMetadata>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
function BlogPostPageContent(props) {
|
|
52
|
-
const {content: BlogPostContents, sidebar} = props;
|
|
53
|
-
const {assets, metadata} = BlogPostContents;
|
|
16
|
+
function BlogPostPageContent({sidebar, children}) {
|
|
17
|
+
const {metadata, toc} = useBlogPost();
|
|
54
18
|
const {nextItem, prevItem, frontMatter} = metadata;
|
|
55
19
|
const {
|
|
56
20
|
hide_table_of_contents: hideTableOfContents,
|
|
@@ -61,21 +25,15 @@ function BlogPostPageContent(props) {
|
|
|
61
25
|
<BlogLayout
|
|
62
26
|
sidebar={sidebar}
|
|
63
27
|
toc={
|
|
64
|
-
!hideTableOfContents &&
|
|
28
|
+
!hideTableOfContents && toc.length > 0 ? (
|
|
65
29
|
<TOC
|
|
66
|
-
toc={
|
|
30
|
+
toc={toc}
|
|
67
31
|
minHeadingLevel={tocMinHeadingLevel}
|
|
68
32
|
maxHeadingLevel={tocMaxHeadingLevel}
|
|
69
33
|
/>
|
|
70
34
|
) : undefined
|
|
71
35
|
}>
|
|
72
|
-
<BlogPostItem
|
|
73
|
-
frontMatter={frontMatter}
|
|
74
|
-
assets={assets}
|
|
75
|
-
metadata={metadata}
|
|
76
|
-
isBlogPostPage>
|
|
77
|
-
<BlogPostContents />
|
|
78
|
-
</BlogPostItem>
|
|
36
|
+
<BlogPostItem>{children}</BlogPostItem>
|
|
79
37
|
|
|
80
38
|
{(nextItem || prevItem) && (
|
|
81
39
|
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
@@ -84,14 +42,19 @@ function BlogPostPageContent(props) {
|
|
|
84
42
|
);
|
|
85
43
|
}
|
|
86
44
|
export default function BlogPostPage(props) {
|
|
45
|
+
const BlogPostContent = props.content;
|
|
87
46
|
return (
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
47
|
+
<BlogPostProvider content={props.content} isBlogPostPage>
|
|
48
|
+
<HtmlClassNameProvider
|
|
49
|
+
className={clsx(
|
|
50
|
+
ThemeClassNames.wrapper.blogPages,
|
|
51
|
+
ThemeClassNames.page.blogPostPage,
|
|
52
|
+
)}>
|
|
53
|
+
<BlogPostPageMetadata />
|
|
54
|
+
<BlogPostPageContent sidebar={props.sidebar}>
|
|
55
|
+
<BlogPostContent />
|
|
56
|
+
</BlogPostPageContent>
|
|
57
|
+
</HtmlClassNameProvider>
|
|
58
|
+
</BlogPostProvider>
|
|
96
59
|
);
|
|
97
60
|
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
/// <reference types="@docusaurus/plugin-content-blog" />
|
|
8
8
|
/// <reference types="react" />
|
|
9
9
|
import type { Props } from '@theme/BlogTagsPostsPage';
|
|
10
|
-
export default function BlogTagsPostsPage(
|
|
10
|
+
export default function BlogTagsPostsPage(props: Props): JSX.Element;
|
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
16
|
import Link from '@docusaurus/Link';
|
|
17
17
|
import BlogLayout from '@theme/BlogLayout';
|
|
18
|
-
import BlogPostItem from '@theme/BlogPostItem';
|
|
19
18
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
20
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
|
+
import BlogPostItems from '@theme/BlogPostItems';
|
|
21
21
|
// Very simple pluralization: probably good enough for now
|
|
22
22
|
function useBlogPostsPlural() {
|
|
23
23
|
const {selectMessage} = usePluralForm();
|
|
@@ -35,9 +35,9 @@ function useBlogPostsPlural() {
|
|
|
35
35
|
),
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
function useBlogTagsPostsPageTitle(tag) {
|
|
39
39
|
const blogPostsPlural = useBlogPostsPlural();
|
|
40
|
-
|
|
40
|
+
return translate(
|
|
41
41
|
{
|
|
42
42
|
id: 'theme.blog.tagTitle',
|
|
43
43
|
description: 'The title of the page for a blog tag',
|
|
@@ -45,39 +45,45 @@ export default function BlogTagsPostsPage({tag, items, sidebar, listMetadata}) {
|
|
|
45
45
|
},
|
|
46
46
|
{nPosts: blogPostsPlural(tag.count), tagName: tag.label},
|
|
47
47
|
);
|
|
48
|
+
}
|
|
49
|
+
function BlogTagsPostsPageMetadata({tag}) {
|
|
50
|
+
const title = useBlogTagsPostsPageTitle(tag);
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<PageMetadata title={title} />
|
|
54
|
+
<SearchMetadata tag="blog_tags_posts" />
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function BlogTagsPostsPageContent({tag, items, sidebar, listMetadata}) {
|
|
59
|
+
const title = useBlogTagsPostsPageTitle(tag);
|
|
60
|
+
return (
|
|
61
|
+
<BlogLayout sidebar={sidebar}>
|
|
62
|
+
<header className="margin-bottom--xl">
|
|
63
|
+
<h1>{title}</h1>
|
|
64
|
+
|
|
65
|
+
<Link href={tag.allTagsPath}>
|
|
66
|
+
<Translate
|
|
67
|
+
id="theme.tags.tagsPageLink"
|
|
68
|
+
description="The label of the link targeting the tag list page">
|
|
69
|
+
View All Tags
|
|
70
|
+
</Translate>
|
|
71
|
+
</Link>
|
|
72
|
+
</header>
|
|
73
|
+
<BlogPostItems items={items} />
|
|
74
|
+
<BlogListPaginator metadata={listMetadata} />
|
|
75
|
+
</BlogLayout>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
export default function BlogTagsPostsPage(props) {
|
|
48
79
|
return (
|
|
49
80
|
<HtmlClassNameProvider
|
|
50
81
|
className={clsx(
|
|
51
82
|
ThemeClassNames.wrapper.blogPages,
|
|
52
83
|
ThemeClassNames.page.blogTagPostListPage,
|
|
53
84
|
)}>
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
<BlogLayout sidebar={sidebar}>
|
|
57
|
-
<header className="margin-bottom--xl">
|
|
58
|
-
<h1>{title}</h1>
|
|
59
|
-
|
|
60
|
-
<Link href={tag.allTagsPath}>
|
|
61
|
-
<Translate
|
|
62
|
-
id="theme.tags.tagsPageLink"
|
|
63
|
-
description="The label of the link targeting the tag list page">
|
|
64
|
-
View All Tags
|
|
65
|
-
</Translate>
|
|
66
|
-
</Link>
|
|
67
|
-
</header>
|
|
68
|
-
|
|
69
|
-
{items.map(({content: BlogPostContent}) => (
|
|
70
|
-
<BlogPostItem
|
|
71
|
-
key={BlogPostContent.metadata.permalink}
|
|
72
|
-
frontMatter={BlogPostContent.frontMatter}
|
|
73
|
-
assets={BlogPostContent.assets}
|
|
74
|
-
metadata={BlogPostContent.metadata}
|
|
75
|
-
truncated>
|
|
76
|
-
<BlogPostContent />
|
|
77
|
-
</BlogPostItem>
|
|
78
|
-
))}
|
|
79
|
-
<BlogListPaginator metadata={listMetadata} />
|
|
80
|
-
</BlogLayout>
|
|
85
|
+
<BlogTagsPostsPageMetadata {...props} />
|
|
86
|
+
<BlogTagsPostsPageContent {...props} />
|
|
81
87
|
</HtmlClassNameProvider>
|
|
82
88
|
);
|
|
83
89
|
}
|
|
@@ -8,8 +8,8 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
10
10
|
import {translate} from '@docusaurus/Translate';
|
|
11
|
-
import IconLightMode from '@theme/
|
|
12
|
-
import IconDarkMode from '@theme/
|
|
11
|
+
import IconLightMode from '@theme/Icon/LightMode';
|
|
12
|
+
import IconDarkMode from '@theme/Icon/DarkMode';
|
|
13
13
|
import styles from './styles.module.css';
|
|
14
14
|
function ColorModeToggle({className, value, onChange}) {
|
|
15
15
|
const isBrowser = useIsBrowser();
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import Link from '@docusaurus/Link';
|
|
15
15
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
16
16
|
import {translate} from '@docusaurus/Translate';
|
|
17
|
-
import IconHome from '@theme/
|
|
17
|
+
import IconHome from '@theme/Icon/Home';
|
|
18
18
|
import styles from './styles.module.css';
|
|
19
19
|
// TODO move to design system folder
|
|
20
20
|
function BreadcrumbsItemLink({children, href, isLast}) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import {translate} from '@docusaurus/Translate';
|
|
9
|
-
import IconArrow from '@theme/
|
|
9
|
+
import IconArrow from '@theme/Icon/Arrow';
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
11
|
export default function DocPageLayoutSidebarExpandButton({toggleSidebar}) {
|
|
12
12
|
return (
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import {translate} from '@docusaurus/Translate';
|
|
10
|
-
import IconArrow from '@theme/
|
|
10
|
+
import IconArrow from '@theme/Icon/Arrow';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
export default function CollapseButton({onClick}) {
|
|
13
13
|
return (
|
|
@@ -10,7 +10,7 @@ import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
|
10
10
|
import {isActiveSidebarItem} from '@docusaurus/theme-common/internal';
|
|
11
11
|
import Link from '@docusaurus/Link';
|
|
12
12
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
13
|
-
import IconExternalLink from '@theme/
|
|
13
|
+
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
14
14
|
import styles from './styles.module.css';
|
|
15
15
|
export default function DocSidebarItemLink({
|
|
16
16
|
item,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Translate from '@docusaurus/Translate';
|
|
9
9
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
|
-
import IconEdit from '@theme/
|
|
10
|
+
import IconEdit from '@theme/Icon/Edit';
|
|
11
11
|
export default function EditThisPage({editUrl}) {
|
|
12
12
|
return (
|
|
13
13
|
<a
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import Link from '@docusaurus/Link';
|
|
9
9
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
10
10
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
11
|
-
import IconExternalLink from '@theme/
|
|
11
|
+
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
12
12
|
export default function FooterLinkItem({item}) {
|
|
13
13
|
const {to, href, label, prependBaseUrlToHref, ...props} = item;
|
|
14
14
|
const toUrl = useBaseUrl(to);
|
|
File without changes
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import type { Props } from '@theme/
|
|
8
|
+
import type { Props } from '@theme/Icon/Close';
|
|
9
9
|
export default function IconClose({ width, height, color, strokeWidth, className, ...restProps }: Props): JSX.Element;
|
|
File without changes
|
|
File without changes
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import type { Props } from '@theme/
|
|
8
|
+
import type { Props } from '@theme/Icon/Edit';
|
|
9
9
|
export default function IconEdit({ className, ...restProps }: Props): JSX.Element;
|
|
File without changes
|
|
File without changes
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import type { Props } from '@theme/
|
|
8
|
+
import type { Props } from '@theme/Icon/ExternalLink';
|
|
9
9
|
export default function IconExternalLink({ width, height, }: Props): JSX.Element;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import type { Props } from '@theme/
|
|
8
|
+
import type { Props } from '@theme/Icon/Language';
|
|
9
9
|
export default function IconLanguage({ width, height, ...props }: Props): JSX.Element;
|
|
File without changes
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import type { Props } from '@theme/
|
|
8
|
+
import type { Props } from '@theme/Icon/LightMode';
|
|
9
9
|
export default function IconLightMode(props: Props): JSX.Element;
|
|
File without changes
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import type { Props } from '@theme/
|
|
8
|
+
import type { Props } from '@theme/Icon/Menu';
|
|
9
9
|
export default function IconMenu({ width, height, className, ...restProps }: Props): JSX.Element;
|
|
File without changes
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
|
|
9
9
|
import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
|
|
10
|
-
import IconClose from '@theme/
|
|
10
|
+
import IconClose from '@theme/Icon/Close';
|
|
11
11
|
import NavbarLogo from '@theme/Navbar/Logo';
|
|
12
12
|
function CloseButton() {
|
|
13
13
|
const mobileSidebar = useNavbarMobileSidebar();
|