@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.
Files changed (217) hide show
  1. package/codeTranslations/ar.json +2 -0
  2. package/codeTranslations/base.json +4 -0
  3. package/codeTranslations/bn.json +56 -0
  4. package/codeTranslations/da.json +2 -0
  5. package/codeTranslations/de.json +2 -0
  6. package/codeTranslations/es.json +2 -0
  7. package/codeTranslations/fa.json +2 -0
  8. package/codeTranslations/fil.json +2 -0
  9. package/codeTranslations/fr.json +2 -0
  10. package/codeTranslations/he.json +18 -16
  11. package/codeTranslations/hi.json +2 -0
  12. package/codeTranslations/ja.json +2 -0
  13. package/codeTranslations/ko.json +2 -0
  14. package/codeTranslations/pl.json +2 -0
  15. package/codeTranslations/pt-BR.json +2 -0
  16. package/codeTranslations/pt-PT.json +2 -0
  17. package/codeTranslations/ru.json +2 -0
  18. package/codeTranslations/tr.json +2 -0
  19. package/codeTranslations/vi.json +2 -0
  20. package/codeTranslations/zh-Hans.json +2 -0
  21. package/codeTranslations/zh-Hant.json +2 -0
  22. package/lib/index.js +28 -7
  23. package/lib/theme/AnnouncementBar/index.js +5 -7
  24. package/lib/theme/AnnouncementBar/styles.module.css +6 -6
  25. package/lib/theme/BlogListPage/index.js +2 -2
  26. package/lib/theme/BlogListPaginator/index.js +2 -2
  27. package/lib/theme/BlogPostItem/index.js +32 -23
  28. package/lib/theme/BlogPostItem/styles.module.css +5 -1
  29. package/lib/theme/BlogPostPage/index.js +4 -10
  30. package/lib/theme/BlogPostPaginator/index.js +3 -3
  31. package/lib/theme/BlogSidebar/index.js +11 -3
  32. package/lib/theme/BlogSidebar/styles.module.css +4 -6
  33. package/lib/theme/BlogTagsListPage/index.js +15 -20
  34. package/lib/theme/BlogTagsPostsPage/index.js +29 -33
  35. package/lib/theme/CodeBlock/index.js +11 -11
  36. package/lib/theme/CodeBlock/styles.module.css +4 -7
  37. package/lib/theme/DocItem/index.js +35 -26
  38. package/lib/theme/DocItem/styles.module.css +8 -10
  39. package/lib/theme/DocPage/index.js +43 -11
  40. package/lib/theme/DocPage/styles.module.css +7 -19
  41. package/lib/theme/DocPaginator/index.js +3 -3
  42. package/lib/theme/DocSidebar/index.js +23 -24
  43. package/lib/theme/DocSidebar/styles.module.css +0 -14
  44. package/lib/theme/DocVersionBanner/index.js +128 -0
  45. package/lib/theme/DocVersionSuggestions/index.js +4 -4
  46. package/lib/theme/Heading/index.js +18 -2
  47. package/lib/theme/Heading/styles.module.css +5 -0
  48. package/lib/theme/IconArrow/index.js +1 -1
  49. package/lib/theme/IconEdit/index.js +1 -1
  50. package/lib/theme/IconExternalLink/index.js +30 -0
  51. package/lib/theme/IconExternalLink/styles.module.css +12 -0
  52. package/lib/theme/IconLanguage/index.js +1 -1
  53. package/lib/theme/IconMenu/index.js +1 -2
  54. package/lib/theme/LastUpdated/index.js +17 -21
  55. package/lib/theme/Layout/styles.css +6 -0
  56. package/lib/theme/LayoutHead/index.js +3 -1
  57. package/lib/theme/LayoutProviders/index.js +7 -5
  58. package/lib/theme/Logo/index.js +13 -12
  59. package/lib/theme/MDXComponents/index.js +2 -2
  60. package/lib/theme/MDXPage/index.js +13 -15
  61. package/{src/theme/LastUpdated → lib/theme/MDXPage}/styles.module.css +2 -2
  62. package/lib/theme/Navbar/index.js +4 -4
  63. package/lib/theme/Navbar/styles.module.css +1 -1
  64. package/lib/theme/NavbarItem/DefaultNavbarItem.js +18 -4
  65. package/lib/theme/NavbarItem/DocNavbarItem.js +19 -11
  66. package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -4
  67. package/lib/theme/NavbarItem/SearchNavbarItem.js +1 -5
  68. package/lib/theme/NavbarItem/index.js +1 -1
  69. package/lib/theme/NotFound.js +9 -2
  70. package/lib/theme/SearchMetadatas/index.js +1 -1
  71. package/lib/theme/Seo/index.js +0 -1
  72. package/lib/theme/SkipToContent/index.js +6 -4
  73. package/lib/theme/SkipToContent/styles.module.css +1 -3
  74. package/lib/theme/TOC/styles.module.css +1 -1
  75. package/lib/theme/Tabs/index.js +2 -2
  76. package/lib/theme/ThemedImage/index.js +2 -1
  77. package/lib/theme/ThemedImage/styles.module.css +7 -0
  78. package/lib/theme/Toggle/index.js +12 -24
  79. package/lib/theme/Toggle/styles.css +103 -0
  80. package/lib/theme/Toggle/styles.module.css +0 -97
  81. package/lib/theme/UserPreferencesProvider/index.js +1 -9
  82. package/lib/theme/hooks/useHideableNavbar.js +2 -2
  83. package/lib/theme/hooks/useTabGroupChoice.js +2 -4
  84. package/lib/theme/hooks/useThemeContext.js +1 -1
  85. package/lib/theme/hooks/useUserPreferencesContext.js +1 -1
  86. package/lib/types.d.ts +10 -12
  87. package/lib/validateThemeConfig.js +3 -3
  88. package/lib-next/index.js +31 -8
  89. package/lib-next/theme/AnnouncementBar/index.js +5 -9
  90. package/lib-next/theme/AnnouncementBar/styles.module.css +6 -6
  91. package/lib-next/theme/BlogListPage/index.js +2 -2
  92. package/lib-next/theme/BlogPostItem/index.js +41 -24
  93. package/lib-next/theme/BlogPostItem/styles.module.css +5 -1
  94. package/lib-next/theme/BlogPostPage/index.js +4 -8
  95. package/lib-next/theme/BlogPostPaginator/index.js +1 -1
  96. package/lib-next/theme/BlogSidebar/index.js +12 -3
  97. package/lib-next/theme/BlogSidebar/styles.module.css +4 -6
  98. package/lib-next/theme/BlogTagsListPage/index.js +17 -23
  99. package/lib-next/theme/BlogTagsPostsPage/index.js +36 -40
  100. package/lib-next/theme/CodeBlock/index.js +10 -9
  101. package/lib-next/theme/CodeBlock/styles.module.css +4 -7
  102. package/lib-next/theme/DocItem/index.js +41 -41
  103. package/lib-next/theme/DocItem/styles.module.css +8 -10
  104. package/lib-next/theme/DocPage/index.js +36 -9
  105. package/lib-next/theme/DocPage/styles.module.css +7 -19
  106. package/lib-next/theme/DocPaginator/index.js +1 -1
  107. package/lib-next/theme/DocSidebar/index.js +28 -21
  108. package/lib-next/theme/DocSidebar/styles.module.css +0 -14
  109. package/lib-next/theme/DocVersionBanner/index.js +127 -0
  110. package/lib-next/theme/DocVersionSuggestions/index.js +4 -4
  111. package/lib-next/theme/Heading/index.js +17 -1
  112. package/lib-next/theme/Heading/styles.module.css +5 -0
  113. package/lib-next/theme/IconArrow/index.js +1 -1
  114. package/lib-next/theme/IconEdit/index.js +3 -5
  115. package/lib-next/theme/IconExternalLink/index.js +26 -0
  116. package/{lib/theme/NavbarItem → lib-next/theme/IconExternalLink}/styles.module.css +4 -5
  117. package/lib-next/theme/IconLanguage/index.js +1 -1
  118. package/lib-next/theme/IconMenu/index.js +1 -4
  119. package/lib-next/theme/LastUpdated/index.js +34 -39
  120. package/lib-next/theme/Layout/styles.css +6 -0
  121. package/lib-next/theme/LayoutHead/index.js +5 -1
  122. package/lib-next/theme/LayoutProviders/index.js +11 -6
  123. package/lib-next/theme/Logo/index.js +12 -8
  124. package/lib-next/theme/MDXPage/index.js +13 -17
  125. package/lib-next/theme/{LastUpdated → MDXPage}/styles.module.css +2 -2
  126. package/lib-next/theme/Navbar/index.js +2 -2
  127. package/lib-next/theme/Navbar/styles.module.css +1 -1
  128. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +19 -2
  129. package/lib-next/theme/NavbarItem/DocNavbarItem.js +23 -9
  130. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +6 -6
  131. package/lib-next/theme/NavbarItem/SearchNavbarItem.js +1 -6
  132. package/lib-next/theme/NavbarItem/index.js +1 -1
  133. package/lib-next/theme/NotFound.js +6 -2
  134. package/lib-next/theme/SearchMetadatas/index.js +1 -1
  135. package/lib-next/theme/Seo/index.js +0 -1
  136. package/lib-next/theme/SkipToContent/index.js +3 -3
  137. package/lib-next/theme/SkipToContent/styles.module.css +1 -3
  138. package/lib-next/theme/TOC/styles.module.css +1 -1
  139. package/lib-next/theme/ThemedImage/index.js +2 -3
  140. package/lib-next/theme/ThemedImage/styles.module.css +7 -0
  141. package/lib-next/theme/Toggle/index.js +9 -24
  142. package/lib-next/theme/Toggle/styles.css +103 -0
  143. package/lib-next/theme/Toggle/styles.module.css +0 -97
  144. package/lib-next/theme/UserPreferencesProvider/index.js +0 -4
  145. package/lib-next/theme/hooks/useHideableNavbar.js +3 -3
  146. package/lib-next/theme/hooks/useTabGroupChoice.js +2 -4
  147. package/lib-next/theme/hooks/useThemeContext.js +1 -1
  148. package/lib-next/theme/hooks/useUserPreferencesContext.js +1 -1
  149. package/lib-next/types.d.ts +10 -12
  150. package/lib-next/validateThemeConfig.js +3 -3
  151. package/package.json +18 -17
  152. package/src/index.ts +32 -8
  153. package/src/theme/AnnouncementBar/index.tsx +6 -9
  154. package/src/theme/AnnouncementBar/styles.module.css +6 -6
  155. package/src/theme/BlogListPage/index.tsx +2 -2
  156. package/src/theme/BlogPostItem/index.tsx +40 -24
  157. package/src/theme/BlogPostItem/styles.module.css +5 -1
  158. package/src/theme/BlogPostPage/index.tsx +4 -8
  159. package/src/theme/BlogPostPaginator/index.tsx +1 -1
  160. package/src/theme/BlogSidebar/index.tsx +12 -3
  161. package/src/theme/BlogSidebar/styles.module.css +4 -6
  162. package/src/theme/BlogTagsListPage/index.tsx +17 -22
  163. package/src/theme/BlogTagsPostsPage/index.tsx +33 -43
  164. package/src/theme/CodeBlock/index.tsx +10 -9
  165. package/src/theme/CodeBlock/styles.module.css +4 -7
  166. package/src/theme/DocItem/index.tsx +40 -40
  167. package/src/theme/DocItem/styles.module.css +8 -10
  168. package/src/theme/DocPage/index.tsx +29 -9
  169. package/src/theme/DocPage/styles.module.css +7 -19
  170. package/src/theme/DocPaginator/index.tsx +1 -1
  171. package/src/theme/DocSidebar/index.tsx +28 -21
  172. package/src/theme/DocSidebar/styles.module.css +0 -14
  173. package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +46 -43
  174. package/src/theme/Heading/index.tsx +22 -1
  175. package/src/theme/Heading/styles.module.css +5 -0
  176. package/src/theme/IconArrow/index.tsx +1 -1
  177. package/src/theme/IconEdit/index.tsx +3 -5
  178. package/src/theme/IconExternalLink/index.tsx +32 -0
  179. package/src/theme/IconExternalLink/styles.module.css +12 -0
  180. package/src/theme/IconLanguage/index.tsx +1 -1
  181. package/src/theme/IconMenu/index.tsx +1 -4
  182. package/src/theme/LastUpdated/index.tsx +34 -39
  183. package/src/theme/Layout/styles.css +6 -0
  184. package/src/theme/LayoutHead/index.tsx +5 -1
  185. package/src/theme/LayoutProviders/index.tsx +11 -6
  186. package/src/theme/Logo/index.tsx +10 -6
  187. package/src/theme/MDXPage/index.tsx +14 -17
  188. package/{lib/theme/LastUpdated → src/theme/MDXPage}/styles.module.css +2 -2
  189. package/src/theme/Navbar/index.tsx +2 -2
  190. package/src/theme/Navbar/styles.module.css +1 -1
  191. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +15 -2
  192. package/src/theme/NavbarItem/DocNavbarItem.tsx +29 -10
  193. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +7 -6
  194. package/src/theme/NavbarItem/SearchNavbarItem.tsx +1 -6
  195. package/src/theme/NavbarItem/index.tsx +1 -1
  196. package/src/theme/NotFound.tsx +6 -2
  197. package/src/theme/SearchMetadatas/index.tsx +1 -1
  198. package/src/theme/Seo/index.tsx +0 -1
  199. package/src/theme/SkipToContent/index.tsx +3 -3
  200. package/src/theme/SkipToContent/styles.module.css +1 -3
  201. package/src/theme/TOC/styles.module.css +1 -1
  202. package/src/theme/ThemedImage/index.tsx +3 -3
  203. package/src/theme/ThemedImage/styles.module.css +7 -0
  204. package/src/theme/Toggle/index.tsx +9 -22
  205. package/src/theme/Toggle/styles.css +103 -0
  206. package/src/theme/Toggle/styles.module.css +0 -97
  207. package/src/theme/UserPreferencesProvider/index.tsx +0 -5
  208. package/src/theme/hooks/useHideableNavbar.ts +3 -3
  209. package/src/theme/hooks/useTabGroupChoice.ts +2 -2
  210. package/src/theme/hooks/useThemeContext.ts +1 -1
  211. package/src/theme/hooks/useUserPreferencesContext.ts +1 -1
  212. package/src/types.d.ts +10 -12
  213. package/src/validateThemeConfig.js +3 -3
  214. package/update-code-translations.js +1 -0
  215. package/lib-next/theme/NavbarItem/styles.module.css +0 -13
  216. package/src/theme/NavbarItem/styles.module.css +0 -13
  217. 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 styles from './styles.module.css';
15
- import {usePluralForm} from '@docusaurus/theme-common'; // Very simple pluralization: probably good enough for now
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 {date, formattedDate, permalink, tags, readingTime} = metadata;
48
- const {author, title, image, keywords} = frontMatter;
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="margin-vert--md">
63
- <time dateTime={date} className={styles.blogPostDate}>
64
- {formattedDate}
65
- {readingTime && (
66
- <>
67
- {' · '}
68
- {readingTimePlural(readingTime)}
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
- <h4 className="avatar__name">
89
+ <div className="avatar__name">
83
90
  <Link href={authorURL}>{author}</Link>
84
- </h4>
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 className="row margin-vert--lg">
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
- <strong>
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
- </strong>
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
- {truncated && (
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
- <strong>
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
- </strong>
157
+ </b>
141
158
  </Link>
142
159
  </div>
143
160
  )}
@@ -9,6 +9,10 @@
9
9
  font-size: 3rem;
10
10
  }
11
11
 
12
- .blogPostDate {
12
+ .blogPostData {
13
13
  font-size: 0.9rem;
14
14
  }
15
+
16
+ .blogPostDetailsFull {
17
+ flex-direction: column;
18
+ }
@@ -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, editUrl} = metadata;
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
- <div className="col col--3">
29
+ <aside className="col col--3">
31
30
  <BlogSidebar sidebar={sidebar} />
32
- </div>
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
- <div className="margin-vert--xl">
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
- <div className={clsx(styles.sidebar, 'thin-scrollbar')}>
18
- <h3 className={styles.sidebarItemTitle}>{sidebar.title}</h3>
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
- </div>
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
- margin-bottom: 0.5rem;
16
+ font-size: var(--ifm-h3-font-size);
17
+ font-weight: var(--ifm-font-weight-bold);
18
18
  }
19
19
 
20
20
  .sidebarItemList {
21
- overflow-y: auto;
21
+ list-style: none;
22
22
  font-size: 0.9rem;
23
23
  padding-left: 0;
24
24
  }
25
25
 
26
26
  .sidebarItem {
27
- list-style-type: none;
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 Translate from '@docusaurus/Translate';
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
- if (a === b) {
29
- return 0;
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
- <div key={category}>
37
- <h3>{category}</h3>
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
- </div>
48
+ </article>
48
49
  ))
49
50
  .filter((item) => item != null);
50
51
  return (
51
52
  <Layout
52
- title="Tags"
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
- <div className="col col--3">
62
+ <aside className="col col--3">
63
63
  <BlogSidebar sidebar={sidebar} />
64
- </div>
64
+ </aside>
65
65
  <main className="col col--7">
66
- <h1>
67
- <Translate
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={`Posts tagged "${tagName}"`}
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
- <div className="col col--3">
60
+ <aside className="col col--3">
65
61
  <BlogSidebar sidebar={sidebar} />
66
- </div>
62
+ </aside>
67
63
  <main className="col col--7">
68
- <h1>
69
- <BlogTagsPostPageTitle count={count} tagName={tagName} />
70
- </h1>
71
- <Link href={allTagsPath}>
72
- <Translate
73
- id="theme.tags.tagsPageLink"
74
- description="The label of the link targeting the tag list page">
75
- View All Tags
76
- </Translate>
77
- </Link>
78
- <div className="margin-vert--xl">
79
- {items.map(({content: BlogPostContent}) => (
80
- <BlogPostItem
81
- key={BlogPostContent.metadata.permalink}
82
- frontMatter={BlogPostContent.frontMatter}
83
- metadata={BlogPostContent.metadata}
84
- truncated>
85
- <BlogPostContent />
86
- </BlogPostItem>
87
- ))}
88
- </div>
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
- <div
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
- <div className={styles.codeBlockLines} style={style}>
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 = `${lineProps.className} docusaurus-highlight-code-line`;
219
+ lineProps.className += ' docusaurus-highlight-code-line';
219
220
  }
220
221
 
221
222
  return (
222
- <div key={i} {...lineProps}>
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
- </div>
233
+ </span>
233
234
  );
234
235
  })}
235
- </div>
236
- </div>
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
- overflow: auto;
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: var(--ifm-code-font-size) / var(--ifm-pre-line-height)
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 DocVersionSuggestions from '@theme/DocVersionSuggestions';
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; // For meta title, using frontMatter.title in priority over a potential # title found in markdown
48
- // See https://github.com/facebook/docusaurus/issues/4665#issuecomment-825831367
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 metaTitle = frontMatter.title || title;
47
+ const shouldAddTitle =
48
+ !hideTitle && typeof DocContent.contentTitle === 'undefined';
51
49
  return (
52
50
  <>
53
51
  <Seo
54
52
  {...{
55
- title: metaTitle,
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
- <DocVersionSuggestions />
65
+ <DocVersionBanner versionMetadata={versionMetadata} />
68
66
  <div className={styles.docItemContainer}>
69
67
  <article>
70
68
  {showVersionBadge && (
71
- <div>
72
- <span className="badge badge--secondary">
73
- Version: {version.label}
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
- </article>
86
- {(editUrl || lastUpdatedAt || lastUpdatedBy) && (
87
- <div className="margin-vert--xl">
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
- {(lastUpdatedAt || lastUpdatedBy) && (
93
- <LastUpdated
94
- lastUpdatedAt={lastUpdatedAt}
95
- formattedLastUpdatedAt={formattedLastUpdatedAt}
96
- lastUpdatedBy={lastUpdatedBy}
97
- />
98
- )}
99
- </div>
100
- </div>
101
- )}
102
- <div className="margin-vert--lg">
103
- <DocPaginator metadata={metadata} />
104
- </div>
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 && (