@docusaurus/theme-classic 2.0.0-beta.1ab8aa0af → 2.0.0-beta.2
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/codeTranslations/ar.json +2 -0
- package/codeTranslations/base.json +4 -0
- package/codeTranslations/bn.json +56 -0
- package/codeTranslations/da.json +2 -0
- package/codeTranslations/de.json +2 -0
- package/codeTranslations/es.json +2 -0
- package/codeTranslations/fa.json +2 -0
- package/codeTranslations/fil.json +2 -0
- package/codeTranslations/fr.json +2 -0
- package/codeTranslations/he.json +18 -16
- package/codeTranslations/hi.json +2 -0
- package/codeTranslations/ja.json +2 -0
- package/codeTranslations/ko.json +2 -0
- package/codeTranslations/pl.json +2 -0
- package/codeTranslations/pt-BR.json +2 -0
- package/codeTranslations/pt-PT.json +2 -0
- package/codeTranslations/ru.json +2 -0
- package/codeTranslations/tr.json +2 -0
- package/codeTranslations/vi.json +2 -0
- package/codeTranslations/zh-Hans.json +2 -0
- package/codeTranslations/zh-Hant.json +2 -0
- package/lib/index.js +28 -7
- package/lib/theme/AnnouncementBar/index.js +5 -7
- package/lib/theme/AnnouncementBar/styles.module.css +6 -6
- package/lib/theme/BlogListPage/index.js +2 -2
- package/lib/theme/BlogListPaginator/index.js +2 -2
- package/lib/theme/BlogPostItem/index.js +32 -23
- package/lib/theme/BlogPostItem/styles.module.css +5 -1
- package/lib/theme/BlogPostPage/index.js +4 -10
- package/lib/theme/BlogPostPaginator/index.js +3 -3
- package/lib/theme/BlogSidebar/index.js +11 -3
- package/lib/theme/BlogSidebar/styles.module.css +4 -6
- package/lib/theme/BlogTagsListPage/index.js +15 -20
- package/lib/theme/BlogTagsPostsPage/index.js +29 -33
- package/lib/theme/CodeBlock/index.js +11 -11
- package/lib/theme/CodeBlock/styles.module.css +4 -7
- package/lib/theme/DocItem/index.js +35 -26
- package/lib/theme/DocItem/styles.module.css +8 -10
- package/lib/theme/DocPage/index.js +43 -11
- package/lib/theme/DocPage/styles.module.css +7 -19
- package/lib/theme/DocPaginator/index.js +3 -3
- package/lib/theme/DocSidebar/index.js +23 -24
- package/lib/theme/DocSidebar/styles.module.css +0 -14
- package/lib/theme/DocVersionBanner/index.js +128 -0
- package/lib/theme/DocVersionSuggestions/index.js +4 -4
- package/lib/theme/Heading/index.js +18 -2
- package/lib/theme/Heading/styles.module.css +5 -0
- package/lib/theme/IconArrow/index.js +1 -1
- package/lib/theme/IconEdit/index.js +1 -1
- package/lib/theme/IconExternalLink/index.js +30 -0
- package/lib/theme/IconExternalLink/styles.module.css +12 -0
- package/lib/theme/IconLanguage/index.js +1 -1
- package/lib/theme/IconMenu/index.js +1 -2
- package/lib/theme/LastUpdated/index.js +17 -21
- package/lib/theme/Layout/styles.css +6 -0
- package/lib/theme/LayoutHead/index.js +3 -1
- package/lib/theme/LayoutProviders/index.js +7 -5
- package/lib/theme/Logo/index.js +13 -12
- package/lib/theme/MDXComponents/index.js +2 -2
- package/lib/theme/MDXPage/index.js +13 -15
- package/{src/theme/LastUpdated → lib/theme/MDXPage}/styles.module.css +2 -2
- package/lib/theme/Navbar/index.js +4 -4
- package/lib/theme/Navbar/styles.module.css +1 -1
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +18 -4
- package/lib/theme/NavbarItem/DocNavbarItem.js +19 -11
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -4
- package/lib/theme/NavbarItem/SearchNavbarItem.js +1 -5
- package/lib/theme/NavbarItem/index.js +1 -1
- package/lib/theme/NotFound.js +9 -2
- package/lib/theme/SearchMetadatas/index.js +1 -1
- package/lib/theme/Seo/index.js +0 -1
- package/lib/theme/SkipToContent/index.js +6 -4
- package/lib/theme/SkipToContent/styles.module.css +1 -3
- package/lib/theme/TOC/styles.module.css +1 -1
- package/lib/theme/Tabs/index.js +2 -2
- package/lib/theme/ThemedImage/index.js +2 -1
- package/lib/theme/ThemedImage/styles.module.css +7 -0
- package/lib/theme/Toggle/index.js +12 -24
- package/lib/theme/Toggle/styles.css +103 -0
- package/lib/theme/Toggle/styles.module.css +0 -97
- package/lib/theme/UserPreferencesProvider/index.js +1 -9
- package/lib/theme/hooks/useHideableNavbar.js +2 -2
- package/lib/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib/theme/hooks/useThemeContext.js +1 -1
- package/lib/theme/hooks/useUserPreferencesContext.js +1 -1
- package/lib/types.d.ts +10 -12
- package/lib/validateThemeConfig.js +3 -3
- package/lib-next/index.js +31 -8
- package/lib-next/theme/AnnouncementBar/index.js +5 -9
- package/lib-next/theme/AnnouncementBar/styles.module.css +6 -6
- package/lib-next/theme/BlogListPage/index.js +2 -2
- package/lib-next/theme/BlogPostItem/index.js +41 -24
- package/lib-next/theme/BlogPostItem/styles.module.css +5 -1
- package/lib-next/theme/BlogPostPage/index.js +4 -8
- package/lib-next/theme/BlogPostPaginator/index.js +1 -1
- package/lib-next/theme/BlogSidebar/index.js +12 -3
- package/lib-next/theme/BlogSidebar/styles.module.css +4 -6
- package/lib-next/theme/BlogTagsListPage/index.js +17 -23
- package/lib-next/theme/BlogTagsPostsPage/index.js +36 -40
- package/lib-next/theme/CodeBlock/index.js +10 -9
- package/lib-next/theme/CodeBlock/styles.module.css +4 -7
- package/lib-next/theme/DocItem/index.js +41 -41
- package/lib-next/theme/DocItem/styles.module.css +8 -10
- package/lib-next/theme/DocPage/index.js +36 -9
- package/lib-next/theme/DocPage/styles.module.css +7 -19
- package/lib-next/theme/DocPaginator/index.js +1 -1
- package/lib-next/theme/DocSidebar/index.js +28 -21
- package/lib-next/theme/DocSidebar/styles.module.css +0 -14
- package/lib-next/theme/DocVersionBanner/index.js +127 -0
- package/lib-next/theme/DocVersionSuggestions/index.js +4 -4
- package/lib-next/theme/Heading/index.js +17 -1
- package/lib-next/theme/Heading/styles.module.css +5 -0
- package/lib-next/theme/IconArrow/index.js +1 -1
- package/lib-next/theme/IconEdit/index.js +3 -5
- package/lib-next/theme/IconExternalLink/index.js +26 -0
- package/{lib/theme/NavbarItem → lib-next/theme/IconExternalLink}/styles.module.css +4 -5
- package/lib-next/theme/IconLanguage/index.js +1 -1
- package/lib-next/theme/IconMenu/index.js +1 -4
- package/lib-next/theme/LastUpdated/index.js +34 -39
- package/lib-next/theme/Layout/styles.css +6 -0
- package/lib-next/theme/LayoutHead/index.js +5 -1
- package/lib-next/theme/LayoutProviders/index.js +11 -6
- package/lib-next/theme/Logo/index.js +12 -8
- package/lib-next/theme/MDXPage/index.js +13 -17
- package/lib-next/theme/{LastUpdated → MDXPage}/styles.module.css +2 -2
- package/lib-next/theme/Navbar/index.js +2 -2
- package/lib-next/theme/Navbar/styles.module.css +1 -1
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +19 -2
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +23 -9
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +6 -6
- package/lib-next/theme/NavbarItem/SearchNavbarItem.js +1 -6
- package/lib-next/theme/NavbarItem/index.js +1 -1
- package/lib-next/theme/NotFound.js +6 -2
- package/lib-next/theme/SearchMetadatas/index.js +1 -1
- package/lib-next/theme/Seo/index.js +0 -1
- package/lib-next/theme/SkipToContent/index.js +3 -3
- package/lib-next/theme/SkipToContent/styles.module.css +1 -3
- package/lib-next/theme/TOC/styles.module.css +1 -1
- package/lib-next/theme/ThemedImage/index.js +2 -3
- package/lib-next/theme/ThemedImage/styles.module.css +7 -0
- package/lib-next/theme/Toggle/index.js +9 -24
- package/lib-next/theme/Toggle/styles.css +103 -0
- package/lib-next/theme/Toggle/styles.module.css +0 -97
- package/lib-next/theme/UserPreferencesProvider/index.js +0 -4
- package/lib-next/theme/hooks/useHideableNavbar.js +3 -3
- package/lib-next/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib-next/theme/hooks/useThemeContext.js +1 -1
- package/lib-next/theme/hooks/useUserPreferencesContext.js +1 -1
- package/lib-next/types.d.ts +10 -12
- package/lib-next/validateThemeConfig.js +3 -3
- package/package.json +18 -17
- package/src/index.ts +32 -8
- package/src/theme/AnnouncementBar/index.tsx +6 -9
- package/src/theme/AnnouncementBar/styles.module.css +6 -6
- package/src/theme/BlogListPage/index.tsx +2 -2
- package/src/theme/BlogPostItem/index.tsx +40 -24
- package/src/theme/BlogPostItem/styles.module.css +5 -1
- package/src/theme/BlogPostPage/index.tsx +4 -8
- package/src/theme/BlogPostPaginator/index.tsx +1 -1
- package/src/theme/BlogSidebar/index.tsx +12 -3
- package/src/theme/BlogSidebar/styles.module.css +4 -6
- package/src/theme/BlogTagsListPage/index.tsx +17 -22
- package/src/theme/BlogTagsPostsPage/index.tsx +33 -43
- package/src/theme/CodeBlock/index.tsx +10 -9
- package/src/theme/CodeBlock/styles.module.css +4 -7
- package/src/theme/DocItem/index.tsx +40 -40
- package/src/theme/DocItem/styles.module.css +8 -10
- package/src/theme/DocPage/index.tsx +29 -9
- package/src/theme/DocPage/styles.module.css +7 -19
- package/src/theme/DocPaginator/index.tsx +1 -1
- package/src/theme/DocSidebar/index.tsx +28 -21
- package/src/theme/DocSidebar/styles.module.css +0 -14
- package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +46 -43
- package/src/theme/Heading/index.tsx +22 -1
- package/src/theme/Heading/styles.module.css +5 -0
- package/src/theme/IconArrow/index.tsx +1 -1
- package/src/theme/IconEdit/index.tsx +3 -5
- package/src/theme/IconExternalLink/index.tsx +32 -0
- package/src/theme/IconExternalLink/styles.module.css +12 -0
- package/src/theme/IconLanguage/index.tsx +1 -1
- package/src/theme/IconMenu/index.tsx +1 -4
- package/src/theme/LastUpdated/index.tsx +34 -39
- package/src/theme/Layout/styles.css +6 -0
- package/src/theme/LayoutHead/index.tsx +5 -1
- package/src/theme/LayoutProviders/index.tsx +11 -6
- package/src/theme/Logo/index.tsx +10 -6
- package/src/theme/MDXPage/index.tsx +14 -17
- package/{lib/theme/LastUpdated → src/theme/MDXPage}/styles.module.css +2 -2
- package/src/theme/Navbar/index.tsx +2 -2
- package/src/theme/Navbar/styles.module.css +1 -1
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +15 -2
- package/src/theme/NavbarItem/DocNavbarItem.tsx +29 -10
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +7 -6
- package/src/theme/NavbarItem/SearchNavbarItem.tsx +1 -6
- package/src/theme/NavbarItem/index.tsx +1 -1
- package/src/theme/NotFound.tsx +6 -2
- package/src/theme/SearchMetadatas/index.tsx +1 -1
- package/src/theme/Seo/index.tsx +0 -1
- package/src/theme/SkipToContent/index.tsx +3 -3
- package/src/theme/SkipToContent/styles.module.css +1 -3
- package/src/theme/TOC/styles.module.css +1 -1
- package/src/theme/ThemedImage/index.tsx +3 -3
- package/src/theme/ThemedImage/styles.module.css +7 -0
- package/src/theme/Toggle/index.tsx +9 -22
- package/src/theme/Toggle/styles.css +103 -0
- package/src/theme/Toggle/styles.module.css +0 -97
- package/src/theme/UserPreferencesProvider/index.tsx +0 -5
- package/src/theme/hooks/useHideableNavbar.ts +3 -3
- package/src/theme/hooks/useTabGroupChoice.ts +2 -2
- package/src/theme/hooks/useThemeContext.ts +1 -1
- package/src/theme/hooks/useUserPreferencesContext.ts +1 -1
- package/src/types.d.ts +10 -12
- package/src/validateThemeConfig.js +3 -3
- package/update-code-translations.js +1 -0
- package/lib-next/theme/NavbarItem/styles.module.css +0 -13
- package/src/theme/NavbarItem/styles.module.css +0 -13
- package/src/theme/hooks/useAnnouncementBar.ts +0 -58
|
@@ -10,14 +10,14 @@ import clsx from 'clsx';
|
|
|
10
10
|
import {MDXProvider} from '@mdx-js/react';
|
|
11
11
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
12
12
|
import Link from '@docusaurus/Link';
|
|
13
|
+
import {usePluralForm} from '@docusaurus/theme-common';
|
|
13
14
|
import MDXComponents from '@theme/MDXComponents';
|
|
14
15
|
import Seo from '@theme/Seo';
|
|
16
|
+
import EditThisPage from '@theme/EditThisPage';
|
|
15
17
|
import type {Props} from '@theme/BlogPostItem';
|
|
16
18
|
|
|
17
19
|
import styles from './styles.module.css';
|
|
18
20
|
|
|
19
|
-
import {usePluralForm} from '@docusaurus/theme-common';
|
|
20
|
-
|
|
21
21
|
// Very simple pluralization: probably good enough for now
|
|
22
22
|
function useReadingTimePlural() {
|
|
23
23
|
const {selectMessage} = usePluralForm();
|
|
@@ -47,8 +47,16 @@ function BlogPostItem(props: Props): JSX.Element {
|
|
|
47
47
|
truncated,
|
|
48
48
|
isBlogPostPage = false,
|
|
49
49
|
} = props;
|
|
50
|
-
const {
|
|
51
|
-
|
|
50
|
+
const {
|
|
51
|
+
date,
|
|
52
|
+
formattedDate,
|
|
53
|
+
permalink,
|
|
54
|
+
tags,
|
|
55
|
+
readingTime,
|
|
56
|
+
title,
|
|
57
|
+
editUrl,
|
|
58
|
+
} = metadata;
|
|
59
|
+
const {author, image, keywords} = frontMatter;
|
|
52
60
|
|
|
53
61
|
const authorURL = frontMatter.author_url || frontMatter.authorURL;
|
|
54
62
|
const authorTitle = frontMatter.author_title || frontMatter.authorTitle;
|
|
@@ -60,20 +68,18 @@ function BlogPostItem(props: Props): JSX.Element {
|
|
|
60
68
|
|
|
61
69
|
return (
|
|
62
70
|
<header>
|
|
63
|
-
<TitleHeading
|
|
64
|
-
className={clsx('margin-bottom--sm', styles.blogPostTitle)}>
|
|
71
|
+
<TitleHeading className={styles.blogPostTitle}>
|
|
65
72
|
{isBlogPostPage ? title : <Link to={permalink}>{title}</Link>}
|
|
66
73
|
</TitleHeading>
|
|
67
|
-
<div className=
|
|
68
|
-
<time dateTime={date}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</time>
|
|
74
|
+
<div className={clsx(styles.blogPostData, 'margin-vert--md')}>
|
|
75
|
+
<time dateTime={date}>{formattedDate}</time>
|
|
76
|
+
|
|
77
|
+
{readingTime && (
|
|
78
|
+
<>
|
|
79
|
+
{' · '}
|
|
80
|
+
{readingTimePlural(readingTime)}
|
|
81
|
+
</>
|
|
82
|
+
)}
|
|
77
83
|
</div>
|
|
78
84
|
<div className="avatar margin-vert--md">
|
|
79
85
|
{authorImageURL && (
|
|
@@ -84,9 +90,9 @@ function BlogPostItem(props: Props): JSX.Element {
|
|
|
84
90
|
<div className="avatar__intro">
|
|
85
91
|
{author && (
|
|
86
92
|
<>
|
|
87
|
-
<
|
|
93
|
+
<div className="avatar__name">
|
|
88
94
|
<Link href={authorURL}>{author}</Link>
|
|
89
|
-
</
|
|
95
|
+
</div>
|
|
90
96
|
<small className="avatar__subtitle">{authorTitle}</small>
|
|
91
97
|
</>
|
|
92
98
|
)}
|
|
@@ -106,16 +112,19 @@ function BlogPostItem(props: Props): JSX.Element {
|
|
|
106
112
|
<MDXProvider components={MDXComponents}>{children}</MDXProvider>
|
|
107
113
|
</div>
|
|
108
114
|
{(tags.length > 0 || truncated) && (
|
|
109
|
-
<footer
|
|
115
|
+
<footer
|
|
116
|
+
className={clsx('row docusaurus-mt-lg', {
|
|
117
|
+
[styles.blogPostDetailsFull]: isBlogPostPage,
|
|
118
|
+
})}>
|
|
110
119
|
{tags.length > 0 && (
|
|
111
120
|
<div className="col">
|
|
112
|
-
<
|
|
121
|
+
<b>
|
|
113
122
|
<Translate
|
|
114
123
|
id="theme.tags.tagsListLabel"
|
|
115
124
|
description="The label alongside a tag list">
|
|
116
125
|
Tags:
|
|
117
126
|
</Translate>
|
|
118
|
-
</
|
|
127
|
+
</b>
|
|
119
128
|
{tags.map(({label, permalink: tagPermalink}) => (
|
|
120
129
|
<Link
|
|
121
130
|
key={tagPermalink}
|
|
@@ -126,18 +135,25 @@ function BlogPostItem(props: Props): JSX.Element {
|
|
|
126
135
|
))}
|
|
127
136
|
</div>
|
|
128
137
|
)}
|
|
129
|
-
|
|
138
|
+
|
|
139
|
+
{isBlogPostPage && editUrl && (
|
|
140
|
+
<div className="col margin-top--sm">
|
|
141
|
+
<EditThisPage editUrl={editUrl} />
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
|
|
145
|
+
{!isBlogPostPage && truncated && (
|
|
130
146
|
<div className="col text--right">
|
|
131
147
|
<Link
|
|
132
148
|
to={metadata.permalink}
|
|
133
149
|
aria-label={`Read more about ${title}`}>
|
|
134
|
-
<
|
|
150
|
+
<b>
|
|
135
151
|
<Translate
|
|
136
152
|
id="theme.blog.post.readMore"
|
|
137
153
|
description="The label used in blog post item excerpts to link to full blog posts">
|
|
138
154
|
Read More
|
|
139
155
|
</Translate>
|
|
140
|
-
</
|
|
156
|
+
</b>
|
|
141
157
|
</Link>
|
|
142
158
|
</div>
|
|
143
159
|
)}
|
|
@@ -12,13 +12,12 @@ import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
|
12
12
|
import type {Props} from '@theme/BlogPostPage';
|
|
13
13
|
import BlogSidebar from '@theme/BlogSidebar';
|
|
14
14
|
import TOC from '@theme/TOC';
|
|
15
|
-
import EditThisPage from '@theme/EditThisPage';
|
|
16
15
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
17
16
|
|
|
18
17
|
function BlogPostPage(props: Props): JSX.Element {
|
|
19
18
|
const {content: BlogPostContents, sidebar} = props;
|
|
20
19
|
const {frontMatter, metadata} = BlogPostContents;
|
|
21
|
-
const {title, description, nextItem, prevItem
|
|
20
|
+
const {title, description, nextItem, prevItem} = metadata;
|
|
22
21
|
const {hide_table_of_contents: hideTableOfContents} = frontMatter;
|
|
23
22
|
|
|
24
23
|
return (
|
|
@@ -30,9 +29,9 @@ function BlogPostPage(props: Props): JSX.Element {
|
|
|
30
29
|
{BlogPostContents && (
|
|
31
30
|
<div className="container margin-vert--lg">
|
|
32
31
|
<div className="row">
|
|
33
|
-
<
|
|
32
|
+
<aside className="col col--3">
|
|
34
33
|
<BlogSidebar sidebar={sidebar} />
|
|
35
|
-
</
|
|
34
|
+
</aside>
|
|
36
35
|
<main className="col col--7">
|
|
37
36
|
<BlogPostItem
|
|
38
37
|
frontMatter={frontMatter}
|
|
@@ -40,11 +39,8 @@ function BlogPostPage(props: Props): JSX.Element {
|
|
|
40
39
|
isBlogPostPage>
|
|
41
40
|
<BlogPostContents />
|
|
42
41
|
</BlogPostItem>
|
|
43
|
-
<div>{editUrl && <EditThisPage editUrl={editUrl} />}</div>
|
|
44
42
|
{(nextItem || prevItem) && (
|
|
45
|
-
<
|
|
46
|
-
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
47
|
-
</div>
|
|
43
|
+
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
48
44
|
)}
|
|
49
45
|
</main>
|
|
50
46
|
{!hideTableOfContents && BlogPostContents.toc && (
|
|
@@ -15,7 +15,7 @@ function BlogPostPaginator(props: Props): JSX.Element {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<nav
|
|
18
|
-
className="pagination-nav"
|
|
18
|
+
className="pagination-nav docusaurus-mt-lg"
|
|
19
19
|
aria-label={translate({
|
|
20
20
|
id: 'theme.blog.post.paginator.navAriaLabel',
|
|
21
21
|
message: 'Blog post page navigation',
|
|
@@ -10,14 +10,23 @@ import clsx from 'clsx';
|
|
|
10
10
|
import Link from '@docusaurus/Link';
|
|
11
11
|
import type {Props} from '@theme/BlogSidebar';
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
|
+
import {translate} from '@docusaurus/Translate';
|
|
13
14
|
|
|
14
15
|
export default function BlogSidebar({sidebar}: Props): JSX.Element | null {
|
|
15
16
|
if (sidebar.items.length === 0) {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
19
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
20
|
+
<nav
|
|
21
|
+
className={clsx(styles.sidebar, 'thin-scrollbar')}
|
|
22
|
+
aria-label={translate({
|
|
23
|
+
id: 'theme.blog.sidebar.navAriaLabel',
|
|
24
|
+
message: 'Blog recent posts navigation',
|
|
25
|
+
description: 'The ARIA label for recent posts in the blog sidebar',
|
|
26
|
+
})}>
|
|
27
|
+
<div className={clsx(styles.sidebarItemTitle, 'margin-bottom--md')}>
|
|
28
|
+
{sidebar.title}
|
|
29
|
+
</div>
|
|
21
30
|
<ul className={styles.sidebarItemList}>
|
|
22
31
|
{sidebar.items.map((item) => {
|
|
23
32
|
return (
|
|
@@ -33,6 +42,6 @@ export default function BlogSidebar({sidebar}: Props): JSX.Element | null {
|
|
|
33
42
|
);
|
|
34
43
|
})}
|
|
35
44
|
</ul>
|
|
36
|
-
</
|
|
45
|
+
</nav>
|
|
37
46
|
);
|
|
38
47
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
.sidebar {
|
|
9
|
-
display: inherit;
|
|
10
9
|
max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
|
|
11
10
|
overflow-y: auto;
|
|
12
11
|
position: sticky;
|
|
@@ -14,25 +13,24 @@
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
.sidebarItemTitle {
|
|
17
|
-
|
|
16
|
+
font-size: var(--ifm-h3-font-size);
|
|
17
|
+
font-weight: var(--ifm-font-weight-bold);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.sidebarItemList {
|
|
21
|
-
|
|
21
|
+
list-style: none;
|
|
22
22
|
font-size: 0.9rem;
|
|
23
23
|
padding-left: 0;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.sidebarItem {
|
|
27
|
-
|
|
28
|
-
margin: 0.8rem 0;
|
|
27
|
+
margin-top: 0.7rem;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
.sidebarItemLink {
|
|
32
31
|
color: var(--ifm-font-color-base);
|
|
33
32
|
}
|
|
34
33
|
.sidebarItemLink:hover {
|
|
35
|
-
color: var(--ifm-color-primary);
|
|
36
34
|
text-decoration: none;
|
|
37
35
|
}
|
|
38
36
|
.sidebarItemLinkActive {
|
|
@@ -11,7 +11,7 @@ import Layout from '@theme/Layout';
|
|
|
11
11
|
import Link from '@docusaurus/Link';
|
|
12
12
|
import type {Props} from '@theme/BlogTagsListPage';
|
|
13
13
|
import BlogSidebar from '@theme/BlogSidebar';
|
|
14
|
-
import
|
|
14
|
+
import {translate} from '@docusaurus/Translate';
|
|
15
15
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
16
16
|
|
|
17
17
|
function getCategoryOfTag(tag: string) {
|
|
@@ -21,6 +21,11 @@ function getCategoryOfTag(tag: string) {
|
|
|
21
21
|
|
|
22
22
|
function BlogTagsListPage(props: Props): JSX.Element {
|
|
23
23
|
const {tags, sidebar} = props;
|
|
24
|
+
const title = translate({
|
|
25
|
+
id: 'theme.tags.tagsPageTitle',
|
|
26
|
+
message: 'Tags',
|
|
27
|
+
description: 'The title of the tag list page',
|
|
28
|
+
});
|
|
24
29
|
|
|
25
30
|
const tagCategories: {[category: string]: string[]} = {};
|
|
26
31
|
Object.keys(tags).forEach((tag) => {
|
|
@@ -28,16 +33,13 @@ function BlogTagsListPage(props: Props): JSX.Element {
|
|
|
28
33
|
tagCategories[category] = tagCategories[category] || [];
|
|
29
34
|
tagCategories[category].push(tag);
|
|
30
35
|
});
|
|
31
|
-
const tagsList = Object.entries(tagCategories).sort(([a], [b]) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
return a > b ? 1 : -1;
|
|
36
|
-
});
|
|
36
|
+
const tagsList = Object.entries(tagCategories).sort(([a], [b]) =>
|
|
37
|
+
a.localeCompare(b),
|
|
38
|
+
);
|
|
37
39
|
const tagsSection = tagsList
|
|
38
40
|
.map(([category, tagsForCategory]) => (
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
+
<article key={category}>
|
|
42
|
+
<h2>{category}</h2>
|
|
41
43
|
{tagsForCategory.map((tag) => (
|
|
42
44
|
<Link
|
|
43
45
|
className="padding-right--md"
|
|
@@ -47,14 +49,13 @@ function BlogTagsListPage(props: Props): JSX.Element {
|
|
|
47
49
|
</Link>
|
|
48
50
|
))}
|
|
49
51
|
<hr />
|
|
50
|
-
</
|
|
52
|
+
</article>
|
|
51
53
|
))
|
|
52
54
|
.filter((item) => item != null);
|
|
53
55
|
|
|
54
56
|
return (
|
|
55
57
|
<Layout
|
|
56
|
-
title=
|
|
57
|
-
description="Blog Tags"
|
|
58
|
+
title={title}
|
|
58
59
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
59
60
|
pageClassName={ThemeClassNames.page.blogTagsListPage}
|
|
60
61
|
searchMetadatas={{
|
|
@@ -63,18 +64,12 @@ function BlogTagsListPage(props: Props): JSX.Element {
|
|
|
63
64
|
}}>
|
|
64
65
|
<div className="container margin-vert--lg">
|
|
65
66
|
<div className="row">
|
|
66
|
-
<
|
|
67
|
+
<aside className="col col--3">
|
|
67
68
|
<BlogSidebar sidebar={sidebar} />
|
|
68
|
-
</
|
|
69
|
+
</aside>
|
|
69
70
|
<main className="col col--7">
|
|
70
|
-
<h1>
|
|
71
|
-
|
|
72
|
-
id="theme.tags.tagsPageTitle"
|
|
73
|
-
description="The title of the tag list page">
|
|
74
|
-
Tags
|
|
75
|
-
</Translate>
|
|
76
|
-
</h1>
|
|
77
|
-
<div className="margin-vert--lg">{tagsSection}</div>
|
|
71
|
+
<h1>{title}</h1>
|
|
72
|
+
<section className="margin-vert--lg">{tagsSection}</section>
|
|
78
73
|
</main>
|
|
79
74
|
</div>
|
|
80
75
|
</div>
|
|
@@ -33,32 +33,22 @@ function useBlogPostsPlural() {
|
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function BlogTagsPostPageTitle({
|
|
37
|
-
tagName,
|
|
38
|
-
count,
|
|
39
|
-
}: {
|
|
40
|
-
tagName: string;
|
|
41
|
-
count: number;
|
|
42
|
-
}) {
|
|
43
|
-
const blogPostsPlural = useBlogPostsPlural();
|
|
44
|
-
return (
|
|
45
|
-
<Translate
|
|
46
|
-
id="theme.blog.tagTitle"
|
|
47
|
-
description="The title of the page for a blog tag"
|
|
48
|
-
values={{nPosts: blogPostsPlural(count), tagName}}>
|
|
49
|
-
{'{nPosts} tagged with "{tagName}"'}
|
|
50
|
-
</Translate>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
36
|
function BlogTagsPostPage(props: Props): JSX.Element {
|
|
55
37
|
const {metadata, items, sidebar} = props;
|
|
56
38
|
const {allTagsPath, name: tagName, count} = metadata;
|
|
39
|
+
const blogPostsPlural = useBlogPostsPlural();
|
|
40
|
+
const title = translate(
|
|
41
|
+
{
|
|
42
|
+
id: 'theme.blog.tagTitle',
|
|
43
|
+
description: 'The title of the page for a blog tag',
|
|
44
|
+
message: '{nPosts} tagged with "{tagName}"',
|
|
45
|
+
},
|
|
46
|
+
{nPosts: blogPostsPlural(count), tagName},
|
|
47
|
+
);
|
|
57
48
|
|
|
58
49
|
return (
|
|
59
50
|
<Layout
|
|
60
|
-
title={
|
|
61
|
-
description={`Blog | Tagged "${tagName}"`}
|
|
51
|
+
title={title}
|
|
62
52
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
63
53
|
pageClassName={ThemeClassNames.page.blogTagsPostPage}
|
|
64
54
|
searchMetadatas={{
|
|
@@ -67,31 +57,31 @@ function BlogTagsPostPage(props: Props): JSX.Element {
|
|
|
67
57
|
}}>
|
|
68
58
|
<div className="container margin-vert--lg">
|
|
69
59
|
<div className="row">
|
|
70
|
-
<
|
|
60
|
+
<aside className="col col--3">
|
|
71
61
|
<BlogSidebar sidebar={sidebar} />
|
|
72
|
-
</
|
|
62
|
+
</aside>
|
|
73
63
|
<main className="col col--7">
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
64
|
+
<header className="margin-bottom--xl">
|
|
65
|
+
<h1>{title}</h1>
|
|
66
|
+
|
|
67
|
+
<Link href={allTagsPath}>
|
|
68
|
+
<Translate
|
|
69
|
+
id="theme.tags.tagsPageLink"
|
|
70
|
+
description="The label of the link targeting the tag list page">
|
|
71
|
+
View All Tags
|
|
72
|
+
</Translate>
|
|
73
|
+
</Link>
|
|
74
|
+
</header>
|
|
75
|
+
|
|
76
|
+
{items.map(({content: BlogPostContent}) => (
|
|
77
|
+
<BlogPostItem
|
|
78
|
+
key={BlogPostContent.metadata.permalink}
|
|
79
|
+
frontMatter={BlogPostContent.frontMatter}
|
|
80
|
+
metadata={BlogPostContent.metadata}
|
|
81
|
+
truncated>
|
|
82
|
+
<BlogPostContent />
|
|
83
|
+
</BlogPostItem>
|
|
84
|
+
))}
|
|
95
85
|
</main>
|
|
96
86
|
</div>
|
|
97
87
|
</div>
|
|
@@ -207,13 +207,14 @@ export default function CodeBlock({
|
|
|
207
207
|
</div>
|
|
208
208
|
)}
|
|
209
209
|
<div className={clsx(styles.codeBlockContent, language)}>
|
|
210
|
-
<
|
|
210
|
+
<pre
|
|
211
211
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
212
212
|
tabIndex={0}
|
|
213
213
|
className={clsx(className, styles.codeBlock, 'thin-scrollbar', {
|
|
214
214
|
[styles.codeBlockWithTitle]: codeBlockTitle,
|
|
215
|
-
})}
|
|
216
|
-
|
|
215
|
+
})}
|
|
216
|
+
style={style}>
|
|
217
|
+
<code className={styles.codeBlockLines}>
|
|
217
218
|
{tokens.map((line, i) => {
|
|
218
219
|
if (line.length === 1 && line[0].content === '') {
|
|
219
220
|
line[0].content = '\n'; // eslint-disable-line no-param-reassign
|
|
@@ -222,19 +223,19 @@ export default function CodeBlock({
|
|
|
222
223
|
const lineProps = getLineProps({line, key: i});
|
|
223
224
|
|
|
224
225
|
if (highlightLines.includes(i + 1)) {
|
|
225
|
-
lineProps.className
|
|
226
|
+
lineProps.className += ' docusaurus-highlight-code-line';
|
|
226
227
|
}
|
|
227
228
|
|
|
228
229
|
return (
|
|
229
|
-
<
|
|
230
|
+
<span key={i} {...lineProps}>
|
|
230
231
|
{line.map((token, key) => (
|
|
231
232
|
<span key={key} {...getTokenProps({token, key})} />
|
|
232
233
|
))}
|
|
233
|
-
</
|
|
234
|
+
</span>
|
|
234
235
|
);
|
|
235
236
|
})}
|
|
236
|
-
</
|
|
237
|
-
</
|
|
237
|
+
</code>
|
|
238
|
+
</pre>
|
|
238
239
|
|
|
239
240
|
<button
|
|
240
241
|
ref={button}
|
|
@@ -244,7 +245,7 @@ export default function CodeBlock({
|
|
|
244
245
|
message: 'Copy code to clipboard',
|
|
245
246
|
description: 'The ARIA label for copy code blocks button',
|
|
246
247
|
})}
|
|
247
|
-
className={clsx(styles.copyButton)}
|
|
248
|
+
className={clsx(styles.copyButton, 'clean-btn')}
|
|
248
249
|
onClick={handleCopyCode}>
|
|
249
250
|
{showCopied ? (
|
|
250
251
|
<Translate
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.codeBlock {
|
|
28
|
-
|
|
29
|
-
border-radius: var(--ifm-global-radius);
|
|
28
|
+
padding: 0;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
.codeBlockWithTitle {
|
|
@@ -36,10 +35,8 @@
|
|
|
36
35
|
|
|
37
36
|
.copyButton {
|
|
38
37
|
background: rgba(0, 0, 0, 0.3);
|
|
39
|
-
border: none;
|
|
40
38
|
border-radius: var(--ifm-global-radius);
|
|
41
39
|
color: var(--ifm-color-white);
|
|
42
|
-
cursor: pointer;
|
|
43
40
|
opacity: 0;
|
|
44
41
|
user-select: none;
|
|
45
42
|
padding: 0.4rem 0.5rem;
|
|
@@ -56,12 +53,12 @@
|
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
.codeBlockLines {
|
|
59
|
-
font:
|
|
60
|
-
var(--ifm-font-family-monospace);
|
|
61
|
-
white-space: pre;
|
|
56
|
+
font: inherit;
|
|
62
57
|
float: left;
|
|
63
58
|
min-width: 100%;
|
|
64
59
|
padding: var(--ifm-pre-padding);
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
@media print {
|
|
@@ -7,23 +7,20 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import DocPaginator from '@theme/DocPaginator';
|
|
10
|
-
import
|
|
10
|
+
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
11
11
|
import Seo from '@theme/Seo';
|
|
12
12
|
import LastUpdated from '@theme/LastUpdated';
|
|
13
13
|
import type {Props} from '@theme/DocItem';
|
|
14
14
|
import TOC from '@theme/TOC';
|
|
15
15
|
import EditThisPage from '@theme/EditThisPage';
|
|
16
|
+
import {MainHeading} from '@theme/Heading';
|
|
16
17
|
|
|
17
18
|
import clsx from 'clsx';
|
|
18
19
|
import styles from './styles.module.css';
|
|
19
|
-
import {
|
|
20
|
-
useActivePlugin,
|
|
21
|
-
useVersions,
|
|
22
|
-
useActiveVersion,
|
|
23
|
-
} from '@theme/hooks/useDocs';
|
|
20
|
+
import {useActivePlugin, useVersions} from '@theme/hooks/useDocs';
|
|
24
21
|
|
|
25
22
|
function DocItem(props: Props): JSX.Element {
|
|
26
|
-
const {content: DocContent} = props;
|
|
23
|
+
const {content: DocContent, versionMetadata} = props;
|
|
27
24
|
const {metadata, frontMatter} = DocContent;
|
|
28
25
|
const {
|
|
29
26
|
image,
|
|
@@ -42,64 +39,67 @@ function DocItem(props: Props): JSX.Element {
|
|
|
42
39
|
|
|
43
40
|
const {pluginId} = useActivePlugin({failfast: true});
|
|
44
41
|
const versions = useVersions(pluginId);
|
|
45
|
-
const version = useActiveVersion(pluginId);
|
|
46
42
|
|
|
47
43
|
// If site is not versioned or only one version is included
|
|
48
44
|
// we don't show the version badge
|
|
49
45
|
// See https://github.com/facebook/docusaurus/issues/3362
|
|
50
46
|
const showVersionBadge = versions.length > 1;
|
|
51
47
|
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
|
|
48
|
+
// We only add a title if:
|
|
49
|
+
// - user asks to hide it with frontmatter
|
|
50
|
+
// - the markdown content does not already contain a top-level h1 heading
|
|
51
|
+
const shouldAddTitle =
|
|
52
|
+
!hideTitle && typeof DocContent.contentTitle === 'undefined';
|
|
55
53
|
|
|
56
54
|
return (
|
|
57
55
|
<>
|
|
58
|
-
<Seo {...{title
|
|
56
|
+
<Seo {...{title, description, keywords, image}} />
|
|
59
57
|
|
|
60
58
|
<div className="row">
|
|
61
59
|
<div
|
|
62
60
|
className={clsx('col', {
|
|
63
61
|
[styles.docItemCol]: !hideTableOfContents,
|
|
64
62
|
})}>
|
|
65
|
-
<
|
|
63
|
+
<DocVersionBanner versionMetadata={versionMetadata} />
|
|
66
64
|
<div className={styles.docItemContainer}>
|
|
67
65
|
<article>
|
|
68
66
|
{showVersionBadge && (
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</span>
|
|
73
|
-
</div>
|
|
74
|
-
)}
|
|
75
|
-
{!hideTitle && (
|
|
76
|
-
<header>
|
|
77
|
-
<h1 className={styles.docTitle}>{title}</h1>
|
|
78
|
-
</header>
|
|
67
|
+
<span className="badge badge--secondary">
|
|
68
|
+
Version: {versionMetadata.label}
|
|
69
|
+
</span>
|
|
79
70
|
)}
|
|
71
|
+
|
|
80
72
|
<div className="markdown">
|
|
73
|
+
{/*
|
|
74
|
+
Title can be declared inside md content or declared through frontmatter and added manually
|
|
75
|
+
To make both cases consistent, the added title is added under the same div.markdown block
|
|
76
|
+
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
77
|
+
*/}
|
|
78
|
+
{shouldAddTitle && <MainHeading>{title}</MainHeading>}
|
|
79
|
+
|
|
81
80
|
<DocContent />
|
|
82
81
|
</div>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<div className="row">
|
|
82
|
+
|
|
83
|
+
{(editUrl || lastUpdatedAt || lastUpdatedBy) && (
|
|
84
|
+
<footer className="row docusaurus-mt-lg">
|
|
87
85
|
<div className="col">
|
|
88
86
|
{editUrl && <EditThisPage editUrl={editUrl} />}
|
|
89
87
|
</div>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
</
|
|
88
|
+
|
|
89
|
+
<div className={clsx('col', styles.lastUpdated)}>
|
|
90
|
+
{(lastUpdatedAt || lastUpdatedBy) && (
|
|
91
|
+
<LastUpdated
|
|
92
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
93
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
94
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
</footer>
|
|
99
|
+
)}
|
|
100
|
+
</article>
|
|
101
|
+
|
|
102
|
+
<DocPaginator metadata={metadata} />
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
105
105
|
{!hideTableOfContents && DocContent.toc && (
|