@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
@@ -6,7 +6,6 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import styles from './styles.module.css';
10
9
  import Translate from '@docusaurus/Translate';
11
10
  import type {Props} from '@theme/LastUpdated';
12
11
 
@@ -23,11 +22,11 @@ function LastUpdatedAtDate({
23
22
  description="The words used to describe on which date a page has been last updated"
24
23
  values={{
25
24
  date: (
26
- <time
27
- dateTime={new Date(lastUpdatedAt * 1000).toISOString()}
28
- className={styles.lastUpdatedDate}>
29
- {formattedLastUpdatedAt}
30
- </time>
25
+ <b>
26
+ <time dateTime={new Date(lastUpdatedAt * 1000).toISOString()}>
27
+ {formattedLastUpdatedAt}
28
+ </time>
29
+ </b>
31
30
  ),
32
31
  }}>
33
32
  {' on {date}'}
@@ -45,7 +44,7 @@ function LastUpdatedByUser({
45
44
  id="theme.lastUpdated.byUser"
46
45
  description="The words used to describe by who the page has been last updated"
47
46
  values={{
48
- user: <strong>{lastUpdatedBy}</strong>,
47
+ user: <b>{lastUpdatedBy}</b>,
49
48
  }}>
50
49
  {' by {user}'}
51
50
  </Translate>
@@ -58,37 +57,33 @@ export default function LastUpdated({
58
57
  lastUpdatedBy,
59
58
  }: Props): JSX.Element {
60
59
  return (
61
- <div className="col text--right">
62
- <em>
63
- <small>
64
- <Translate
65
- id="theme.lastUpdated.lastUpdatedAtBy"
66
- description="The sentence used to display when a page has been last updated, and by who"
67
- values={{
68
- atDate:
69
- lastUpdatedAt && formattedLastUpdatedAt ? (
70
- <LastUpdatedAtDate
71
- lastUpdatedAt={lastUpdatedAt}
72
- formattedLastUpdatedAt={formattedLastUpdatedAt}
73
- />
74
- ) : (
75
- ''
76
- ),
77
- byUser: lastUpdatedBy ? (
78
- <LastUpdatedByUser lastUpdatedBy={lastUpdatedBy} />
79
- ) : (
80
- ''
81
- ),
82
- }}>
83
- {'Last updated{atDate}{byUser}'}
84
- </Translate>
85
- {process.env.NODE_ENV === 'development' && (
86
- <div>
87
- <small> (Simulated during dev for better perf)</small>
88
- </div>
89
- )}
90
- </small>
91
- </em>
92
- </div>
60
+ <>
61
+ <Translate
62
+ id="theme.lastUpdated.lastUpdatedAtBy"
63
+ description="The sentence used to display when a page has been last updated, and by who"
64
+ values={{
65
+ atDate:
66
+ lastUpdatedAt && formattedLastUpdatedAt ? (
67
+ <LastUpdatedAtDate
68
+ lastUpdatedAt={lastUpdatedAt}
69
+ formattedLastUpdatedAt={formattedLastUpdatedAt}
70
+ />
71
+ ) : (
72
+ ''
73
+ ),
74
+ byUser: lastUpdatedBy ? (
75
+ <LastUpdatedByUser lastUpdatedBy={lastUpdatedBy} />
76
+ ) : (
77
+ ''
78
+ ),
79
+ }}>
80
+ {'Last updated{atDate}{byUser}'}
81
+ </Translate>
82
+ {process.env.NODE_ENV === 'development' && (
83
+ <div>
84
+ <small> (Simulated during dev for better perf)</small>
85
+ </div>
86
+ )}
87
+ </>
93
88
  );
94
89
  }
@@ -19,3 +19,9 @@ body {
19
19
  .main-wrapper {
20
20
  flex: 1 0 auto;
21
21
  }
22
+
23
+ /* Docusaurus-specific utility classes */
24
+
25
+ .docusaurus-mt-lg {
26
+ margin-top: 3rem;
27
+ }
@@ -85,7 +85,7 @@ export default function LayoutHead(props: Props): JSX.Element {
85
85
  const {
86
86
  siteConfig: {
87
87
  favicon,
88
- themeConfig: {metadatas},
88
+ themeConfig: {metadatas, image: defaultImage},
89
89
  },
90
90
  i18n: {currentLocale, localeConfigs},
91
91
  } = useDocusaurusContext();
@@ -105,6 +105,10 @@ export default function LayoutHead(props: Props): JSX.Element {
105
105
  {favicon && <link rel="shortcut icon" href={faviconUrl} />}
106
106
  <title>{pageTitle}</title>
107
107
  <meta property="og:title" content={pageTitle} />
108
+ {image ||
109
+ (defaultImage && (
110
+ <meta name="twitter:card" content="summary_large_image" />
111
+ ))}
108
112
  </Head>
109
113
 
110
114
  <Seo {...{description, keywords, image}} />
@@ -8,17 +8,22 @@
8
8
  import React from 'react';
9
9
  import ThemeProvider from '@theme/ThemeProvider';
10
10
  import UserPreferencesProvider from '@theme/UserPreferencesProvider';
11
- import {DocsPreferredVersionContextProvider} from '@docusaurus/theme-common';
11
+ import {
12
+ AnnouncementBarProvider,
13
+ DocsPreferredVersionContextProvider,
14
+ } from '@docusaurus/theme-common';
12
15
  import type {Props} from '@theme/LayoutProviders';
13
16
 
14
17
  export default function LayoutProviders({children}: Props): JSX.Element {
15
18
  return (
16
19
  <ThemeProvider>
17
- <UserPreferencesProvider>
18
- <DocsPreferredVersionContextProvider>
19
- {children}
20
- </DocsPreferredVersionContextProvider>
21
- </UserPreferencesProvider>
20
+ <AnnouncementBarProvider>
21
+ <UserPreferencesProvider>
22
+ <DocsPreferredVersionContextProvider>
23
+ {children}
24
+ </DocsPreferredVersionContextProvider>
25
+ </UserPreferencesProvider>
26
+ </AnnouncementBarProvider>
22
27
  </ThemeProvider>
23
28
  );
24
29
  }
@@ -12,13 +12,17 @@ import Link from '@docusaurus/Link';
12
12
  import ThemedImage from '@theme/ThemedImage';
13
13
  import useBaseUrl from '@docusaurus/useBaseUrl';
14
14
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
15
- import {useThemeConfig} from '@docusaurus/theme-common';
16
15
 
17
16
  const Logo = (props: Props): JSX.Element => {
18
- const {isClient} = useDocusaurusContext();
19
17
  const {
20
- navbar: {title, logo = {src: ''}},
21
- } = useThemeConfig();
18
+ siteConfig: {
19
+ title,
20
+ themeConfig: {
21
+ navbar: {title: navbarTitle, logo = {src: ''}},
22
+ },
23
+ },
24
+ isClient,
25
+ } = useDocusaurusContext();
22
26
 
23
27
  const {imageClassName, titleClassName, ...propsRest} = props;
24
28
  const logoLink = useBaseUrl(logo.href || '/');
@@ -37,10 +41,10 @@ const Logo = (props: Props): JSX.Element => {
37
41
  key={isClient}
38
42
  className={imageClassName}
39
43
  sources={sources}
40
- alt={logo.alt || title || 'Logo'}
44
+ alt={logo.alt || navbarTitle || title}
41
45
  />
42
46
  )}
43
- {title != null && <strong className={titleClassName}>{title}</strong>}
47
+ {navbarTitle != null && <b className={titleClassName}>{navbarTitle}</b>}
44
48
  </Link>
45
49
  );
46
50
  };
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
+ import clsx from 'clsx';
9
10
  import Layout from '@theme/Layout';
10
11
  import {MDXProvider} from '@mdx-js/react';
11
12
  import MDXComponents from '@theme/MDXComponents';
@@ -13,6 +14,8 @@ import type {Props} from '@theme/MDXPage';
13
14
  import TOC from '@theme/TOC';
14
15
  import {ThemeClassNames} from '@docusaurus/theme-common';
15
16
 
17
+ import styles from './styles.module.css';
18
+
16
19
  function MDXPage(props: Props): JSX.Element {
17
20
  const {content: MDXPageContent} = props;
18
21
  const {frontMatter, metadata} = MDXPageContent;
@@ -32,24 +35,18 @@ function MDXPage(props: Props): JSX.Element {
32
35
  permalink={permalink}
33
36
  wrapperClassName={wrapperClassName ?? ThemeClassNames.wrapper.mdxPages}
34
37
  pageClassName={ThemeClassNames.page.mdxPage}>
35
- <main>
36
- <div className="container container--fluid">
37
- <div className="margin-vert--lg padding-vert--lg">
38
- <div className="row">
39
- <div className="col col--8 col--offset-2">
40
- <div className="container">
41
- <MDXProvider components={MDXComponents}>
42
- <MDXPageContent />
43
- </MDXProvider>
44
- </div>
45
- </div>
46
- {!hideTableOfContents && MDXPageContent.toc && (
47
- <div className="col col--2">
48
- <TOC toc={MDXPageContent.toc} />
49
- </div>
50
- )}
51
- </div>
38
+ <main className="container container--fluid margin-vert--lg">
39
+ <div className={clsx('row', styles.mdxPageWrapper)}>
40
+ <div className={clsx('col', !hideTableOfContents && 'col--8')}>
41
+ <MDXProvider components={MDXComponents}>
42
+ <MDXPageContent />
43
+ </MDXProvider>
52
44
  </div>
45
+ {!hideTableOfContents && MDXPageContent.toc && (
46
+ <div className="col col--2">
47
+ <TOC toc={MDXPageContent.toc} />
48
+ </div>
49
+ )}
53
50
  </div>
54
51
  </main>
55
52
  </Layout>
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- .lastUpdatedDate {
9
- font-weight: bold;
8
+ .mdxPageWrapper {
9
+ justify-content: center;
10
10
  }
@@ -88,7 +88,7 @@ function Navbar(): JSX.Element {
88
88
  {items != null && items.length !== 0 && (
89
89
  <button
90
90
  aria-label="Navigation bar toggle"
91
- className="navbar__toggle"
91
+ className="navbar__toggle clean-btn"
92
92
  type="button"
93
93
  tabIndex={0}
94
94
  onClick={showSidebar}
@@ -99,7 +99,7 @@ function Navbar(): JSX.Element {
99
99
  <Logo
100
100
  className="navbar__brand"
101
101
  imageClassName="navbar__logo"
102
- titleClassName={clsx('navbar__title')}
102
+ titleClassName="navbar__title"
103
103
  />
104
104
  {leftItems.map((item, i) => (
105
105
  <NavbarItem {...item} key={i} />
@@ -16,5 +16,5 @@
16
16
  }
17
17
 
18
18
  .navbarHidden {
19
- transform: translate3d(0, calc(var(--ifm-navbar-height) * -1), 0);
19
+ transform: translate3d(0, calc(-100% - 2px), 0);
20
20
  }
@@ -16,6 +16,10 @@ import type {
16
16
  DesktopOrMobileNavBarItemProps,
17
17
  Props,
18
18
  } from '@theme/NavbarItem/DefaultNavbarItem';
19
+ import IconExternalLink from '@theme/IconExternalLink';
20
+ import isInternalUrl from '@docusaurus/isInternalUrl';
21
+
22
+ const dropdownLinkActiveClass = 'dropdown__link--active';
19
23
 
20
24
  function NavLink({
21
25
  activeBasePath,
@@ -32,6 +36,8 @@ function NavLink({
32
36
  const toUrl = useBaseUrl(to);
33
37
  const activeBaseUrl = useBaseUrl(activeBasePath);
34
38
  const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
39
+ const isExternalLink = label && href && !isInternalUrl(href);
40
+ const isDropdownLink = activeClassName === dropdownLinkActiveClass;
35
41
 
36
42
  return (
37
43
  <Link
@@ -53,7 +59,14 @@ function NavLink({
53
59
  : null),
54
60
  })}
55
61
  {...props}>
56
- {label}
62
+ {isExternalLink ? (
63
+ <span>
64
+ {label}
65
+ <IconExternalLink {...(isDropdownLink && {width: 12, height: 12})} />
66
+ </span>
67
+ ) : (
68
+ label
69
+ )}
57
70
  </Link>
58
71
  );
59
72
  }
@@ -137,7 +150,7 @@ function NavItemDesktop({
137
150
  }
138
151
  }
139
152
  }}
140
- activeClassName="dropdown__link--active"
153
+ activeClassName={dropdownLinkActiveClass}
141
154
  className={navLinkClassNames(childItemClassName, true)}
142
155
  {...childItemProps}
143
156
  />
@@ -11,6 +11,30 @@ import {useLatestVersion, useActiveDocContext} from '@theme/hooks/useDocs';
11
11
  import clsx from 'clsx';
12
12
  import type {Props} from '@theme/NavbarItem/DocNavbarItem';
13
13
  import {useDocsPreferredVersion} from '@docusaurus/theme-common';
14
+ import {uniq} from '@docusaurus/utils-common';
15
+ import type {
16
+ GlobalDataVersion,
17
+ GlobalDataDoc,
18
+ } from '@docusaurus/plugin-content-docs-types';
19
+
20
+ function getDocInVersions(versions: GlobalDataVersion[], docId: string) {
21
+ // vanilla-js flatten, TODO replace soon by ES flat() / flatMap()
22
+ const allDocs: GlobalDataDoc[] = [].concat(
23
+ ...versions.map((version) => version.docs),
24
+ );
25
+
26
+ const doc = allDocs.find((versionDoc) => versionDoc.id === docId);
27
+ if (!doc) {
28
+ const docIds = allDocs.map((versionDoc) => versionDoc.id).join('\n- ');
29
+ throw new Error(
30
+ `DocNavbarItem: couldn't find any doc with id "${docId}" in version${
31
+ versions.length ? 's' : ''
32
+ } ${versions.map((version) => version.name).join(', ')}".
33
+ Available doc ids are:\n- ${docIds}`,
34
+ );
35
+ }
36
+ return doc;
37
+ }
14
38
 
15
39
  export default function DocNavbarItem({
16
40
  docId,
@@ -23,16 +47,11 @@ export default function DocNavbarItem({
23
47
  const {preferredVersion} = useDocsPreferredVersion(docsPluginId);
24
48
  const latestVersion = useLatestVersion(docsPluginId);
25
49
 
26
- const version = activeVersion ?? preferredVersion ?? latestVersion;
27
-
28
- const doc = version.docs.find((versionDoc) => versionDoc.id === docId);
29
- if (!doc) {
30
- const docIds = version.docs.map((versionDoc) => versionDoc.id).join('\n- ');
31
- throw new Error(
32
- `DocNavbarItem: couldn't find any doc with id=${docId} in version ${version.name}.
33
- Available docIds=\n- ${docIds}`,
34
- );
35
- }
50
+ // Versions used to look for the doc to link to, ordered + no duplicate
51
+ const versions: GlobalDataVersion[] = uniq(
52
+ [activeVersion, preferredVersion, latestVersion].filter(Boolean),
53
+ );
54
+ const doc = getDocInVersions(versions, docId);
36
55
 
37
56
  return (
38
57
  <DefaultNavbarItem
@@ -68,14 +68,15 @@ export default function DocsVersionDropdownNavbarItem({
68
68
  return items;
69
69
  }
70
70
 
71
+ const items = getItems();
72
+
71
73
  const dropdownVersion =
72
74
  activeDocContext.activeVersion ?? preferredVersion ?? latestVersion;
73
75
 
74
- // Mobile is handled a bit differently
75
- const dropdownLabel = mobile ? 'Versions' : dropdownVersion.label;
76
- const dropdownTo = mobile
77
- ? undefined
78
- : getVersionMainDoc(dropdownVersion).path;
76
+ // Mobile dropdown is handled a bit differently
77
+ const dropdownLabel = mobile && items ? 'Versions' : dropdownVersion.label;
78
+ const dropdownTo =
79
+ mobile && items ? undefined : getVersionMainDoc(dropdownVersion).path;
79
80
 
80
81
  return (
81
82
  <DefaultNavbarItem
@@ -83,7 +84,7 @@ export default function DocsVersionDropdownNavbarItem({
83
84
  mobile={mobile}
84
85
  label={dropdownLabel}
85
86
  to={dropdownTo}
86
- items={getItems()}
87
+ items={items}
87
88
  isActive={dropdownActiveClassDisabled ? () => false : undefined}
88
89
  />
89
90
  );
@@ -8,16 +8,11 @@
8
8
  import React from 'react';
9
9
  import type {Props} from '@theme/NavbarItem/SearchNavbarItem';
10
10
  import SearchBar from '@theme/SearchBar';
11
- import styles from './styles.module.css';
12
11
 
13
12
  export default function SearchNavbarItem({mobile}: Props): JSX.Element | null {
14
13
  if (mobile) {
15
14
  return null;
16
15
  }
17
16
 
18
- return (
19
- <div className={styles.searchWrapper}>
20
- <SearchBar />
21
- </div>
22
- );
17
+ return <SearchBar />;
23
18
  }
@@ -34,7 +34,7 @@ const getNavbarItemComponent = (
34
34
  ) => {
35
35
  const navbarItemComponent = NavbarItemComponents[type];
36
36
  if (!navbarItemComponent) {
37
- throw new Error(`No NavbarItem component found for type=${type}.`);
37
+ throw new Error(`No NavbarItem component found for type "${type}".`);
38
38
  }
39
39
  return navbarItemComponent();
40
40
  };
@@ -7,11 +7,15 @@
7
7
 
8
8
  import React from 'react';
9
9
  import Layout from '@theme/Layout';
10
- import Translate from '@docusaurus/Translate';
10
+ import Translate, {translate} from '@docusaurus/Translate';
11
11
 
12
12
  function NotFound(): JSX.Element {
13
13
  return (
14
- <Layout title="Page Not Found">
14
+ <Layout
15
+ title={translate({
16
+ id: 'theme.NotFound.title',
17
+ message: 'Page Not Found',
18
+ })}>
15
19
  <main className="container margin-vert--xl">
16
20
  <div className="row">
17
21
  <div className="col col--6 col--offset-3">
@@ -20,7 +20,7 @@ export default function SearchMetadatas({
20
20
  }: Props): JSX.Element {
21
21
  return (
22
22
  <Head>
23
- {locale && <meta name="docusaurus_locale" content={`${locale}`} />}
23
+ {locale && <meta name="docusaurus_locale" content={locale} />}
24
24
  {version && <meta name="docusaurus_version" content={version} />}
25
25
  {tag && <meta name="docusaurus_tag" content={tag} />}
26
26
  </Head>
@@ -41,7 +41,6 @@ export default function Seo({
41
41
 
42
42
  {pageImage && <meta property="og:image" content={pageImage} />}
43
43
  {pageImage && <meta name="twitter:image" content={pageImage} />}
44
- {pageImage && <meta name="twitter:card" content="summary_large_image" />}
45
44
  </Head>
46
45
  );
47
46
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
  import React, {useRef} from 'react';
9
9
  import Translate from '@docusaurus/Translate';
10
- import {useChangeRoute} from '@docusaurus/theme-common';
10
+ import {useLocationChange} from '@docusaurus/theme-common';
11
11
 
12
12
  import styles from './styles.module.css';
13
13
 
@@ -31,8 +31,8 @@ function SkipToContent(): JSX.Element {
31
31
  }
32
32
  };
33
33
 
34
- useChangeRoute(() => {
35
- if (containerRef.current) {
34
+ useLocationChange(({location}) => {
35
+ if (containerRef.current && !location.hash) {
36
36
  programmaticFocus(containerRef.current);
37
37
  }
38
38
  });
@@ -6,11 +6,9 @@
6
6
  padding: calc(var(--ifm-global-spacing) / 2) var(--ifm-global-spacing);
7
7
  color: var(--ifm-color-emphasis-900);
8
8
  background-color: var(--ifm-background-surface-color);
9
- border-radius: var(--ifm-global-radius);
10
- font: inherit;
11
- border: none;
12
9
  }
13
10
 
14
11
  .skipToContent:focus {
15
12
  left: 1rem;
13
+ box-shadow: var(--ifm-global-shadow-md);
16
14
  }
@@ -9,7 +9,7 @@
9
9
  max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
10
10
  overflow-y: auto;
11
11
  position: sticky;
12
- top: calc(var(--ifm-navbar-height) + 2rem);
12
+ top: calc(var(--ifm-navbar-height) + 1rem);
13
13
  }
14
14
 
15
15
  @media only screen and (max-width: 996px) {
@@ -21,10 +21,10 @@ const ThemedImage = (props: Props): JSX.Element => {
21
21
 
22
22
  type SourceName = keyof Props['sources'];
23
23
 
24
+ const clientThemes: SourceName[] = isDarkTheme ? ['dark'] : ['light'];
25
+
24
26
  const renderedSourceNames: SourceName[] = isClient
25
- ? isDarkTheme
26
- ? ['dark']
27
- : ['light']
27
+ ? clientThemes
28
28
  : // We need to render both images on the server to avoid flash
29
29
  // See https://github.com/facebook/docusaurus/pull/3730
30
30
  ['light', 'dark'];
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
1
8
  .themedImage {
2
9
  display: none;
3
10
  }
@@ -11,6 +11,7 @@ import {useThemeConfig} from '@docusaurus/theme-common';
11
11
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
12
12
 
13
13
  import clsx from 'clsx';
14
+ import './styles.css';
14
15
  import styles from './styles.module.css';
15
16
 
16
17
  interface IconProps {
@@ -44,22 +45,6 @@ const Toggle = memo(
44
45
  const [checked, setChecked] = useState(defaultChecked);
45
46
  const [focused, setFocused] = useState(false);
46
47
  const inputRef = useRef<HTMLInputElement>(null);
47
- const handleToggle = (e) => {
48
- const checkbox = inputRef.current;
49
-
50
- if (!checkbox) {
51
- return;
52
- }
53
-
54
- if (e.target !== checkbox) {
55
- e.preventDefault();
56
- checkbox.focus();
57
- checkbox.click();
58
- return;
59
- }
60
-
61
- setChecked(checkbox?.checked);
62
- };
63
48
 
64
49
  return (
65
50
  <div
@@ -67,15 +52,16 @@ const Toggle = memo(
67
52
  'react-toggle--checked': checked,
68
53
  'react-toggle--focus': focused,
69
54
  'react-toggle--disabled': disabled,
70
- })}
71
- role="button"
72
- tabIndex={-1}
73
- onClick={handleToggle}>
74
- <div className="react-toggle-track">
55
+ })}>
56
+ <div
57
+ className="react-toggle-track"
58
+ role="button"
59
+ tabIndex={-1}
60
+ onClick={() => inputRef.current?.click()}>
75
61
  <div className="react-toggle-track-check">{icons.checked}</div>
76
62
  <div className="react-toggle-track-x">{icons.unchecked}</div>
63
+ <div className="react-toggle-thumb" />
77
64
  </div>
78
- <div className="react-toggle-thumb" />
79
65
 
80
66
  <input
81
67
  ref={inputRef}
@@ -84,6 +70,7 @@ const Toggle = memo(
84
70
  className="react-toggle-screenreader-only"
85
71
  aria-label="Switch between dark and light mode"
86
72
  onChange={onChange}
73
+ onClick={() => setChecked(!checked)}
87
74
  onFocus={() => setFocused(true)}
88
75
  onBlur={() => setFocused(false)}
89
76
  />