@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
|
@@ -9,10 +9,11 @@ import clsx from 'clsx';
|
|
|
9
9
|
import {MDXProvider} from '@mdx-js/react';
|
|
10
10
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
11
11
|
import Link from '@docusaurus/Link';
|
|
12
|
+
import {usePluralForm} from '@docusaurus/theme-common';
|
|
12
13
|
import MDXComponents from '@theme/MDXComponents';
|
|
13
14
|
import Seo from '@theme/Seo';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
15
|
+
import EditThisPage from '@theme/EditThisPage';
|
|
16
|
+
import styles from './styles.module.css'; // Very simple pluralization: probably good enough for now
|
|
16
17
|
|
|
17
18
|
function useReadingTimePlural() {
|
|
18
19
|
const {selectMessage} = usePluralForm();
|
|
@@ -44,8 +45,16 @@ function BlogPostItem(props) {
|
|
|
44
45
|
truncated,
|
|
45
46
|
isBlogPostPage = false,
|
|
46
47
|
} = props;
|
|
47
|
-
const {
|
|
48
|
-
|
|
48
|
+
const {
|
|
49
|
+
date,
|
|
50
|
+
formattedDate,
|
|
51
|
+
permalink,
|
|
52
|
+
tags,
|
|
53
|
+
readingTime,
|
|
54
|
+
title,
|
|
55
|
+
editUrl,
|
|
56
|
+
} = metadata;
|
|
57
|
+
const {author, image, keywords} = frontMatter;
|
|
49
58
|
const authorURL = frontMatter.author_url || frontMatter.authorURL;
|
|
50
59
|
const authorTitle = frontMatter.author_title || frontMatter.authorTitle;
|
|
51
60
|
const authorImageURL =
|
|
@@ -55,20 +64,18 @@ function BlogPostItem(props) {
|
|
|
55
64
|
const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
|
|
56
65
|
return (
|
|
57
66
|
<header>
|
|
58
|
-
<TitleHeading
|
|
59
|
-
className={clsx('margin-bottom--sm', styles.blogPostTitle)}>
|
|
67
|
+
<TitleHeading className={styles.blogPostTitle}>
|
|
60
68
|
{isBlogPostPage ? title : <Link to={permalink}>{title}</Link>}
|
|
61
69
|
</TitleHeading>
|
|
62
|
-
<div className=
|
|
63
|
-
<time dateTime={date}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</time>
|
|
70
|
+
<div className={clsx(styles.blogPostData, 'margin-vert--md')}>
|
|
71
|
+
<time dateTime={date}>{formattedDate}</time>
|
|
72
|
+
|
|
73
|
+
{readingTime && (
|
|
74
|
+
<>
|
|
75
|
+
{' · '}
|
|
76
|
+
{readingTimePlural(readingTime)}
|
|
77
|
+
</>
|
|
78
|
+
)}
|
|
72
79
|
</div>
|
|
73
80
|
<div className="avatar margin-vert--md">
|
|
74
81
|
{authorImageURL && (
|
|
@@ -79,9 +86,9 @@ function BlogPostItem(props) {
|
|
|
79
86
|
<div className="avatar__intro">
|
|
80
87
|
{author && (
|
|
81
88
|
<>
|
|
82
|
-
<
|
|
89
|
+
<div className="avatar__name">
|
|
83
90
|
<Link href={authorURL}>{author}</Link>
|
|
84
|
-
</
|
|
91
|
+
</div>
|
|
85
92
|
<small className="avatar__subtitle">{authorTitle}</small>
|
|
86
93
|
</>
|
|
87
94
|
)}
|
|
@@ -106,16 +113,19 @@ function BlogPostItem(props) {
|
|
|
106
113
|
<MDXProvider components={MDXComponents}>{children}</MDXProvider>
|
|
107
114
|
</div>
|
|
108
115
|
{(tags.length > 0 || truncated) && (
|
|
109
|
-
<footer
|
|
116
|
+
<footer
|
|
117
|
+
className={clsx('row docusaurus-mt-lg', {
|
|
118
|
+
[styles.blogPostDetailsFull]: isBlogPostPage,
|
|
119
|
+
})}>
|
|
110
120
|
{tags.length > 0 && (
|
|
111
121
|
<div className="col">
|
|
112
|
-
<
|
|
122
|
+
<b>
|
|
113
123
|
<Translate
|
|
114
124
|
id="theme.tags.tagsListLabel"
|
|
115
125
|
description="The label alongside a tag list">
|
|
116
126
|
Tags:
|
|
117
127
|
</Translate>
|
|
118
|
-
</
|
|
128
|
+
</b>
|
|
119
129
|
{tags.map(({label, permalink: tagPermalink}) => (
|
|
120
130
|
<Link
|
|
121
131
|
key={tagPermalink}
|
|
@@ -126,18 +136,25 @@ function BlogPostItem(props) {
|
|
|
126
136
|
))}
|
|
127
137
|
</div>
|
|
128
138
|
)}
|
|
129
|
-
|
|
139
|
+
|
|
140
|
+
{isBlogPostPage && editUrl && (
|
|
141
|
+
<div className="col margin-top--sm">
|
|
142
|
+
<EditThisPage editUrl={editUrl} />
|
|
143
|
+
</div>
|
|
144
|
+
)}
|
|
145
|
+
|
|
146
|
+
{!isBlogPostPage && truncated && (
|
|
130
147
|
<div className="col text--right">
|
|
131
148
|
<Link
|
|
132
149
|
to={metadata.permalink}
|
|
133
150
|
aria-label={`Read more about ${title}`}>
|
|
134
|
-
<
|
|
151
|
+
<b>
|
|
135
152
|
<Translate
|
|
136
153
|
id="theme.blog.post.readMore"
|
|
137
154
|
description="The label used in blog post item excerpts to link to full blog posts">
|
|
138
155
|
Read More
|
|
139
156
|
</Translate>
|
|
140
|
-
</
|
|
157
|
+
</b>
|
|
141
158
|
</Link>
|
|
142
159
|
</div>
|
|
143
160
|
)}
|
|
@@ -10,13 +10,12 @@ import BlogPostItem from '@theme/BlogPostItem';
|
|
|
10
10
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
11
11
|
import BlogSidebar from '@theme/BlogSidebar';
|
|
12
12
|
import TOC from '@theme/TOC';
|
|
13
|
-
import EditThisPage from '@theme/EditThisPage';
|
|
14
13
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
15
14
|
|
|
16
15
|
function BlogPostPage(props) {
|
|
17
16
|
const {content: BlogPostContents, sidebar} = props;
|
|
18
17
|
const {frontMatter, metadata} = BlogPostContents;
|
|
19
|
-
const {title, description, nextItem, prevItem
|
|
18
|
+
const {title, description, nextItem, prevItem} = metadata;
|
|
20
19
|
const {hide_table_of_contents: hideTableOfContents} = frontMatter;
|
|
21
20
|
return (
|
|
22
21
|
<Layout
|
|
@@ -27,9 +26,9 @@ function BlogPostPage(props) {
|
|
|
27
26
|
{BlogPostContents && (
|
|
28
27
|
<div className="container margin-vert--lg">
|
|
29
28
|
<div className="row">
|
|
30
|
-
<
|
|
29
|
+
<aside className="col col--3">
|
|
31
30
|
<BlogSidebar sidebar={sidebar} />
|
|
32
|
-
</
|
|
31
|
+
</aside>
|
|
33
32
|
<main className="col col--7">
|
|
34
33
|
<BlogPostItem
|
|
35
34
|
frontMatter={frontMatter}
|
|
@@ -37,11 +36,8 @@ function BlogPostPage(props) {
|
|
|
37
36
|
isBlogPostPage>
|
|
38
37
|
<BlogPostContents />
|
|
39
38
|
</BlogPostItem>
|
|
40
|
-
<div>{editUrl && <EditThisPage editUrl={editUrl} />}</div>
|
|
41
39
|
{(nextItem || prevItem) && (
|
|
42
|
-
<
|
|
43
|
-
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
44
|
-
</div>
|
|
40
|
+
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
45
41
|
)}
|
|
46
42
|
</main>
|
|
47
43
|
{!hideTableOfContents && BlogPostContents.toc && (
|
|
@@ -12,7 +12,7 @@ function BlogPostPaginator(props) {
|
|
|
12
12
|
const {nextItem, prevItem} = props;
|
|
13
13
|
return (
|
|
14
14
|
<nav
|
|
15
|
-
className="pagination-nav"
|
|
15
|
+
className="pagination-nav docusaurus-mt-lg"
|
|
16
16
|
aria-label={translate({
|
|
17
17
|
id: 'theme.blog.post.paginator.navAriaLabel',
|
|
18
18
|
message: 'Blog post page navigation',
|
|
@@ -8,14 +8,23 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Link from '@docusaurus/Link';
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
|
+
import {translate} from '@docusaurus/Translate';
|
|
11
12
|
export default function BlogSidebar({sidebar}) {
|
|
12
13
|
if (sidebar.items.length === 0) {
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
return (
|
|
17
|
-
<
|
|
18
|
-
|
|
18
|
+
<nav
|
|
19
|
+
className={clsx(styles.sidebar, 'thin-scrollbar')}
|
|
20
|
+
aria-label={translate({
|
|
21
|
+
id: 'theme.blog.sidebar.navAriaLabel',
|
|
22
|
+
message: 'Blog recent posts navigation',
|
|
23
|
+
description: 'The ARIA label for recent posts in the blog sidebar',
|
|
24
|
+
})}>
|
|
25
|
+
<div className={clsx(styles.sidebarItemTitle, 'margin-bottom--md')}>
|
|
26
|
+
{sidebar.title}
|
|
27
|
+
</div>
|
|
19
28
|
<ul className={styles.sidebarItemList}>
|
|
20
29
|
{sidebar.items.map((item) => {
|
|
21
30
|
return (
|
|
@@ -31,6 +40,6 @@ export default function BlogSidebar({sidebar}) {
|
|
|
31
40
|
);
|
|
32
41
|
})}
|
|
33
42
|
</ul>
|
|
34
|
-
</
|
|
43
|
+
</nav>
|
|
35
44
|
);
|
|
36
45
|
}
|
|
@@ -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 {
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import Layout from '@theme/Layout';
|
|
9
9
|
import Link from '@docusaurus/Link';
|
|
10
10
|
import BlogSidebar from '@theme/BlogSidebar';
|
|
11
|
-
import
|
|
11
|
+
import {translate} from '@docusaurus/Translate';
|
|
12
12
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
13
13
|
|
|
14
14
|
function getCategoryOfTag(tag) {
|
|
@@ -18,23 +18,24 @@ function getCategoryOfTag(tag) {
|
|
|
18
18
|
|
|
19
19
|
function BlogTagsListPage(props) {
|
|
20
20
|
const {tags, sidebar} = props;
|
|
21
|
+
const title = translate({
|
|
22
|
+
id: 'theme.tags.tagsPageTitle',
|
|
23
|
+
message: 'Tags',
|
|
24
|
+
description: 'The title of the tag list page',
|
|
25
|
+
});
|
|
21
26
|
const tagCategories = {};
|
|
22
27
|
Object.keys(tags).forEach((tag) => {
|
|
23
28
|
const category = getCategoryOfTag(tag);
|
|
24
29
|
tagCategories[category] = tagCategories[category] || [];
|
|
25
30
|
tagCategories[category].push(tag);
|
|
26
31
|
});
|
|
27
|
-
const tagsList = Object.entries(tagCategories).sort(([a], [b]) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return a > b ? 1 : -1;
|
|
33
|
-
});
|
|
32
|
+
const tagsList = Object.entries(tagCategories).sort(([a], [b]) =>
|
|
33
|
+
a.localeCompare(b),
|
|
34
|
+
);
|
|
34
35
|
const tagsSection = tagsList
|
|
35
36
|
.map(([category, tagsForCategory]) => (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
37
|
+
<article key={category}>
|
|
38
|
+
<h2>{category}</h2>
|
|
38
39
|
{tagsForCategory.map((tag) => (
|
|
39
40
|
<Link
|
|
40
41
|
className="padding-right--md"
|
|
@@ -44,13 +45,12 @@ function BlogTagsListPage(props) {
|
|
|
44
45
|
</Link>
|
|
45
46
|
))}
|
|
46
47
|
<hr />
|
|
47
|
-
</
|
|
48
|
+
</article>
|
|
48
49
|
))
|
|
49
50
|
.filter((item) => item != null);
|
|
50
51
|
return (
|
|
51
52
|
<Layout
|
|
52
|
-
title=
|
|
53
|
-
description="Blog Tags"
|
|
53
|
+
title={title}
|
|
54
54
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
55
55
|
pageClassName={ThemeClassNames.page.blogTagsListPage}
|
|
56
56
|
searchMetadatas={{
|
|
@@ -59,18 +59,12 @@ function BlogTagsListPage(props) {
|
|
|
59
59
|
}}>
|
|
60
60
|
<div className="container margin-vert--lg">
|
|
61
61
|
<div className="row">
|
|
62
|
-
<
|
|
62
|
+
<aside className="col col--3">
|
|
63
63
|
<BlogSidebar sidebar={sidebar} />
|
|
64
|
-
</
|
|
64
|
+
</aside>
|
|
65
65
|
<main className="col col--7">
|
|
66
|
-
<h1>
|
|
67
|
-
|
|
68
|
-
id="theme.tags.tagsPageTitle"
|
|
69
|
-
description="The title of the tag list page">
|
|
70
|
-
Tags
|
|
71
|
-
</Translate>
|
|
72
|
-
</h1>
|
|
73
|
-
<div className="margin-vert--lg">{tagsSection}</div>
|
|
66
|
+
<h1>{title}</h1>
|
|
67
|
+
<section className="margin-vert--lg">{tagsSection}</section>
|
|
74
68
|
</main>
|
|
75
69
|
</div>
|
|
76
70
|
</div>
|
|
@@ -31,28 +31,24 @@ function useBlogPostsPlural() {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function BlogTagsPostPageTitle({tagName, count}) {
|
|
35
|
-
const blogPostsPlural = useBlogPostsPlural();
|
|
36
|
-
return (
|
|
37
|
-
<Translate
|
|
38
|
-
id="theme.blog.tagTitle"
|
|
39
|
-
description="The title of the page for a blog tag"
|
|
40
|
-
values={{
|
|
41
|
-
nPosts: blogPostsPlural(count),
|
|
42
|
-
tagName,
|
|
43
|
-
}}>
|
|
44
|
-
{'{nPosts} tagged with "{tagName}"'}
|
|
45
|
-
</Translate>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
34
|
function BlogTagsPostPage(props) {
|
|
50
35
|
const {metadata, items, sidebar} = props;
|
|
51
36
|
const {allTagsPath, name: tagName, count} = metadata;
|
|
37
|
+
const blogPostsPlural = useBlogPostsPlural();
|
|
38
|
+
const title = translate(
|
|
39
|
+
{
|
|
40
|
+
id: 'theme.blog.tagTitle',
|
|
41
|
+
description: 'The title of the page for a blog tag',
|
|
42
|
+
message: '{nPosts} tagged with "{tagName}"',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
nPosts: blogPostsPlural(count),
|
|
46
|
+
tagName,
|
|
47
|
+
},
|
|
48
|
+
);
|
|
52
49
|
return (
|
|
53
50
|
<Layout
|
|
54
|
-
title={
|
|
55
|
-
description={`Blog | Tagged "${tagName}"`}
|
|
51
|
+
title={title}
|
|
56
52
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
57
53
|
pageClassName={ThemeClassNames.page.blogTagsPostPage}
|
|
58
54
|
searchMetadatas={{
|
|
@@ -61,31 +57,31 @@ function BlogTagsPostPage(props) {
|
|
|
61
57
|
}}>
|
|
62
58
|
<div className="container margin-vert--lg">
|
|
63
59
|
<div className="row">
|
|
64
|
-
<
|
|
60
|
+
<aside className="col col--3">
|
|
65
61
|
<BlogSidebar sidebar={sidebar} />
|
|
66
|
-
</
|
|
62
|
+
</aside>
|
|
67
63
|
<main className="col col--7">
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
+
))}
|
|
89
85
|
</main>
|
|
90
86
|
</div>
|
|
91
87
|
</div>
|
|
@@ -197,13 +197,14 @@ export default function CodeBlock({
|
|
|
197
197
|
</div>
|
|
198
198
|
)}
|
|
199
199
|
<div className={clsx(styles.codeBlockContent, language)}>
|
|
200
|
-
<
|
|
200
|
+
<pre
|
|
201
201
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
202
202
|
tabIndex={0}
|
|
203
203
|
className={clsx(className, styles.codeBlock, 'thin-scrollbar', {
|
|
204
204
|
[styles.codeBlockWithTitle]: codeBlockTitle,
|
|
205
|
-
})}
|
|
206
|
-
|
|
205
|
+
})}
|
|
206
|
+
style={style}>
|
|
207
|
+
<code className={styles.codeBlockLines}>
|
|
207
208
|
{tokens.map((line, i) => {
|
|
208
209
|
if (line.length === 1 && line[0].content === '') {
|
|
209
210
|
line[0].content = '\n'; // eslint-disable-line no-param-reassign
|
|
@@ -215,11 +216,11 @@ export default function CodeBlock({
|
|
|
215
216
|
});
|
|
216
217
|
|
|
217
218
|
if (highlightLines.includes(i + 1)) {
|
|
218
|
-
lineProps.className
|
|
219
|
+
lineProps.className += ' docusaurus-highlight-code-line';
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
return (
|
|
222
|
-
<
|
|
223
|
+
<span key={i} {...lineProps}>
|
|
223
224
|
{line.map((token, key) => (
|
|
224
225
|
<span
|
|
225
226
|
key={key}
|
|
@@ -229,11 +230,11 @@ export default function CodeBlock({
|
|
|
229
230
|
})}
|
|
230
231
|
/>
|
|
231
232
|
))}
|
|
232
|
-
</
|
|
233
|
+
</span>
|
|
233
234
|
);
|
|
234
235
|
})}
|
|
235
|
-
</
|
|
236
|
-
</
|
|
236
|
+
</code>
|
|
237
|
+
</pre>
|
|
237
238
|
|
|
238
239
|
<button
|
|
239
240
|
ref={button}
|
|
@@ -243,7 +244,7 @@ export default function CodeBlock({
|
|
|
243
244
|
message: 'Copy code to clipboard',
|
|
244
245
|
description: 'The ARIA label for copy code blocks button',
|
|
245
246
|
})}
|
|
246
|
-
className={clsx(styles.copyButton)}
|
|
247
|
+
className={clsx(styles.copyButton, 'clean-btn')}
|
|
247
248
|
onClick={handleCopyCode}>
|
|
248
249
|
{showCopied ? (
|
|
249
250
|
<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 {
|
|
@@ -6,21 +6,18 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import DocPaginator from '@theme/DocPaginator';
|
|
9
|
-
import
|
|
9
|
+
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
10
10
|
import Seo from '@theme/Seo';
|
|
11
11
|
import LastUpdated from '@theme/LastUpdated';
|
|
12
12
|
import TOC from '@theme/TOC';
|
|
13
13
|
import EditThisPage from '@theme/EditThisPage';
|
|
14
|
+
import {MainHeading} from '@theme/Heading';
|
|
14
15
|
import clsx from 'clsx';
|
|
15
16
|
import styles from './styles.module.css';
|
|
16
|
-
import {
|
|
17
|
-
useActivePlugin,
|
|
18
|
-
useVersions,
|
|
19
|
-
useActiveVersion,
|
|
20
|
-
} from '@theme/hooks/useDocs';
|
|
17
|
+
import {useActivePlugin, useVersions} from '@theme/hooks/useDocs';
|
|
21
18
|
|
|
22
19
|
function DocItem(props) {
|
|
23
|
-
const {content: DocContent} = props;
|
|
20
|
+
const {content: DocContent, versionMetadata} = props;
|
|
24
21
|
const {metadata, frontMatter} = DocContent;
|
|
25
22
|
const {
|
|
26
23
|
image,
|
|
@@ -39,20 +36,21 @@ function DocItem(props) {
|
|
|
39
36
|
const {pluginId} = useActivePlugin({
|
|
40
37
|
failfast: true,
|
|
41
38
|
});
|
|
42
|
-
const versions = useVersions(pluginId);
|
|
43
|
-
const version = useActiveVersion(pluginId); // If site is not versioned or only one version is included
|
|
39
|
+
const versions = useVersions(pluginId); // If site is not versioned or only one version is included
|
|
44
40
|
// we don't show the version badge
|
|
45
41
|
// See https://github.com/facebook/docusaurus/issues/3362
|
|
46
42
|
|
|
47
|
-
const showVersionBadge = versions.length > 1; //
|
|
48
|
-
//
|
|
43
|
+
const showVersionBadge = versions.length > 1; // We only add a title if:
|
|
44
|
+
// - user asks to hide it with frontmatter
|
|
45
|
+
// - the markdown content does not already contain a top-level h1 heading
|
|
49
46
|
|
|
50
|
-
const
|
|
47
|
+
const shouldAddTitle =
|
|
48
|
+
!hideTitle && typeof DocContent.contentTitle === 'undefined';
|
|
51
49
|
return (
|
|
52
50
|
<>
|
|
53
51
|
<Seo
|
|
54
52
|
{...{
|
|
55
|
-
title
|
|
53
|
+
title,
|
|
56
54
|
description,
|
|
57
55
|
keywords,
|
|
58
56
|
image,
|
|
@@ -64,44 +62,46 @@ function DocItem(props) {
|
|
|
64
62
|
className={clsx('col', {
|
|
65
63
|
[styles.docItemCol]: !hideTableOfContents,
|
|
66
64
|
})}>
|
|
67
|
-
<
|
|
65
|
+
<DocVersionBanner versionMetadata={versionMetadata} />
|
|
68
66
|
<div className={styles.docItemContainer}>
|
|
69
67
|
<article>
|
|
70
68
|
{showVersionBadge && (
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</span>
|
|
75
|
-
</div>
|
|
76
|
-
)}
|
|
77
|
-
{!hideTitle && (
|
|
78
|
-
<header>
|
|
79
|
-
<h1 className={styles.docTitle}>{title}</h1>
|
|
80
|
-
</header>
|
|
69
|
+
<span className="badge badge--secondary">
|
|
70
|
+
Version: {versionMetadata.label}
|
|
71
|
+
</span>
|
|
81
72
|
)}
|
|
73
|
+
|
|
82
74
|
<div className="markdown">
|
|
75
|
+
{/*
|
|
76
|
+
Title can be declared inside md content or declared through frontmatter and added manually
|
|
77
|
+
To make both cases consistent, the added title is added under the same div.markdown block
|
|
78
|
+
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
79
|
+
*/}
|
|
80
|
+
{shouldAddTitle && <MainHeading>{title}</MainHeading>}
|
|
81
|
+
|
|
83
82
|
<DocContent />
|
|
84
83
|
</div>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<div className="row">
|
|
84
|
+
|
|
85
|
+
{(editUrl || lastUpdatedAt || lastUpdatedBy) && (
|
|
86
|
+
<footer className="row docusaurus-mt-lg">
|
|
89
87
|
<div className="col">
|
|
90
88
|
{editUrl && <EditThisPage editUrl={editUrl} />}
|
|
91
89
|
</div>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</
|
|
90
|
+
|
|
91
|
+
<div className={clsx('col', styles.lastUpdated)}>
|
|
92
|
+
{(lastUpdatedAt || lastUpdatedBy) && (
|
|
93
|
+
<LastUpdated
|
|
94
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
95
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
96
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
97
|
+
/>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
</footer>
|
|
101
|
+
)}
|
|
102
|
+
</article>
|
|
103
|
+
|
|
104
|
+
<DocPaginator metadata={metadata} />
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
107
107
|
{!hideTableOfContents && DocContent.toc && (
|