@docusaurus/theme-classic 2.0.0-beta.12faed89d → 2.0.0-beta.14

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 (349) hide show
  1. package/README.md +1 -1
  2. package/lib/admonitions.css +35 -0
  3. package/lib/deps.d.ts +13 -0
  4. package/lib/index.js +16 -15
  5. package/lib/prism-include-languages.js +9 -5
  6. package/{lib-next/types.d.ts → lib/theme-classic.d.ts} +338 -156
  7. package/lib/translations.js +16 -7
  8. package/lib/types.d.ts +0 -629
  9. package/lib/validateThemeConfig.js +232 -248
  10. package/lib-next/theme/Admonition/index.js +101 -0
  11. package/lib-next/theme/AnnouncementBar/index.js +7 -12
  12. package/lib-next/theme/AnnouncementBar/styles.module.css +23 -32
  13. package/lib-next/theme/BackToTopButton/index.js +131 -0
  14. package/lib-next/theme/BackToTopButton/styles.module.css +42 -0
  15. package/lib-next/theme/BlogArchivePage/index.js +80 -0
  16. package/lib-next/theme/BlogLayout/index.js +40 -0
  17. package/lib-next/theme/BlogListPage/index.js +17 -25
  18. package/lib-next/theme/BlogPostAuthor/index.js +46 -0
  19. package/{lib/theme/MDXPage → lib-next/theme/BlogPostAuthor}/styles.module.css +4 -2
  20. package/lib-next/theme/BlogPostAuthors/index.js +34 -0
  21. package/{lib/theme/IconExternalLink → lib-next/theme/BlogPostAuthors}/styles.module.css +3 -4
  22. package/lib-next/theme/BlogPostItem/index.js +79 -86
  23. package/lib-next/theme/BlogPostPage/index.js +70 -35
  24. package/lib-next/theme/BlogSidebar/index.js +11 -13
  25. package/lib-next/theme/BlogSidebar/styles.module.css +2 -2
  26. package/lib-next/theme/BlogTagsListPage/index.js +14 -55
  27. package/lib-next/theme/BlogTagsPostsPage/index.js +29 -39
  28. package/lib-next/theme/CodeBlock/index.js +23 -149
  29. package/lib-next/theme/CodeBlock/styles.module.css +12 -9
  30. package/lib-next/theme/Details/index.js +20 -0
  31. package/lib-next/theme/Details/styles.module.css +13 -0
  32. package/lib-next/theme/DocCard/index.js +80 -0
  33. package/lib-next/theme/DocCard/styles.module.css +43 -0
  34. package/lib-next/theme/DocCardList/index.js +19 -0
  35. package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +49 -0
  36. package/lib-next/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
  37. package/lib-next/theme/DocItem/index.js +30 -59
  38. package/lib-next/theme/DocItem/styles.module.css +2 -11
  39. package/lib-next/theme/DocItemFooter/index.js +79 -0
  40. package/{lib/theme/DocSidebarItem → lib-next/theme/DocItemFooter}/styles.module.css +8 -5
  41. package/lib-next/theme/DocPage/index.js +46 -23
  42. package/lib-next/theme/DocPaginator/index.js +5 -33
  43. package/lib-next/theme/DocPaginatorNavLink/index.js +36 -0
  44. package/lib-next/theme/DocSidebar/index.js +37 -43
  45. package/lib-next/theme/DocSidebarItem/index.js +115 -65
  46. package/lib-next/theme/DocSidebarItem/styles.module.css +4 -0
  47. package/lib-next/theme/DocTagDocListPage/index.js +89 -0
  48. package/lib-next/theme/DocTagsListPage/index.js +38 -0
  49. package/lib-next/theme/DocVersionBadge/index.js +27 -0
  50. package/lib-next/theme/DocVersionBanner/index.js +28 -14
  51. package/lib-next/theme/EditThisPage/index.js +6 -1
  52. package/lib-next/theme/ErrorPageContent.js +35 -0
  53. package/lib-next/theme/Footer/index.js +90 -39
  54. package/lib-next/theme/Heading/index.js +24 -29
  55. package/lib-next/theme/Heading/styles.css +5 -6
  56. package/lib-next/theme/Heading/styles.module.css +9 -5
  57. package/lib-next/theme/IconArrow/index.js +2 -2
  58. package/lib-next/theme/IconClose/index.js +23 -0
  59. package/lib-next/theme/IconEdit/index.js +2 -2
  60. package/lib-next/theme/IconExternalLink/index.js +2 -2
  61. package/lib-next/theme/IconLanguage/index.js +2 -2
  62. package/lib-next/theme/IconMenu/index.js +2 -2
  63. package/lib-next/theme/LastUpdated/index.js +3 -2
  64. package/lib-next/theme/Layout/index.js +3 -1
  65. package/lib-next/theme/LayoutHead/index.js +18 -23
  66. package/lib-next/theme/LayoutProviders/index.js +8 -5
  67. package/lib-next/theme/Logo/index.js +25 -21
  68. package/lib-next/theme/MDXComponents/index.js +34 -7
  69. package/{lib/theme/hooks → lib-next/theme/MDXComponents}/styles.css +3 -2
  70. package/lib-next/theme/MDXPage/index.js +10 -2
  71. package/lib-next/theme/Navbar/index.js +62 -34
  72. package/lib-next/theme/Navbar/styles.module.css +3 -39
  73. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +45 -143
  74. package/lib-next/theme/NavbarItem/DocNavbarItem.js +7 -7
  75. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +31 -19
  76. package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +158 -0
  77. package/lib-next/theme/NavbarItem/{LocaleDropdownNavbarItem.js → LocaleDropdownNavbarItem/index.js} +4 -12
  78. package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
  79. package/lib-next/theme/NavbarItem/index.js +25 -12
  80. package/lib-next/theme/{SearchMetadatas → SearchMetadata}/index.js +1 -1
  81. package/lib-next/theme/Seo/index.js +11 -7
  82. package/lib-next/theme/TOC/index.js +12 -36
  83. package/lib-next/theme/TOC/styles.module.css +1 -1
  84. package/lib-next/theme/TOCCollapsible/index.js +13 -4
  85. package/lib-next/theme/TOCCollapsible/styles.module.css +1 -0
  86. package/lib-next/theme/TOCInline/index.js +10 -28
  87. package/lib-next/theme/TOCItems/index.js +85 -0
  88. package/lib-next/theme/Tabs/__tests__/index.test.js +142 -0
  89. package/lib-next/theme/Tabs/index.js +103 -48
  90. package/lib-next/theme/Tabs/styles.module.css +0 -13
  91. package/lib-next/theme/Tag/index.js +27 -0
  92. package/lib-next/theme/Tag/styles.module.css +70 -0
  93. package/lib-next/theme/TagsListByLetter/index.js +42 -0
  94. package/lib-next/theme/TagsListByLetter/styles.module.css +11 -0
  95. package/lib-next/theme/TagsListInline/index.js +31 -0
  96. package/lib-next/theme/TagsListInline/styles.module.css +15 -0
  97. package/lib-next/theme/ThemeProvider/index.js +10 -7
  98. package/lib-next/theme/ThemedImage/index.js +5 -5
  99. package/lib-next/theme/Toggle/index.js +34 -37
  100. package/lib-next/theme/Toggle/styles.module.css +91 -3
  101. package/lib-next/theme/UserPreferencesProvider/index.js +9 -6
  102. package/lib-next/theme/hooks/useHideableNavbar.js +31 -44
  103. package/lib-next/theme/hooks/useTheme.js +4 -5
  104. package/lib-next/theme/hooks/useWindowSize.js +2 -6
  105. package/lib-next/theme/prism-include-languages.js +2 -1
  106. package/package.json +26 -24
  107. package/src/admonitions.css +35 -0
  108. package/src/deps.d.ts +13 -0
  109. package/src/index.ts +23 -20
  110. package/{lib-next/prism-include-languages.js → src/prism-include-languages.ts} +0 -0
  111. package/src/theme/Admonition/index.tsx +106 -0
  112. package/src/theme/AnnouncementBar/index.tsx +8 -12
  113. package/src/theme/AnnouncementBar/styles.module.css +23 -32
  114. package/src/theme/BackToTopButton/index.tsx +142 -0
  115. package/src/theme/BackToTopButton/styles.module.css +42 -0
  116. package/src/theme/BlogArchivePage/index.tsx +91 -0
  117. package/src/theme/BlogLayout/index.tsx +44 -0
  118. package/src/theme/BlogListPage/index.tsx +18 -25
  119. package/src/theme/BlogPostAuthor/index.tsx +49 -0
  120. package/{lib/theme/IconEdit → src/theme/BlogPostAuthor}/styles.module.css +4 -3
  121. package/src/theme/BlogPostAuthors/index.tsx +39 -0
  122. package/src/theme/BlogPostAuthors/styles.module.css +11 -0
  123. package/src/theme/BlogPostItem/index.tsx +70 -80
  124. package/src/theme/BlogPostPage/index.tsx +72 -35
  125. package/src/theme/BlogSidebar/index.tsx +11 -13
  126. package/src/theme/BlogSidebar/styles.module.css +2 -2
  127. package/src/theme/BlogTagsListPage/index.tsx +14 -57
  128. package/src/theme/BlogTagsPostsPage/index.tsx +29 -39
  129. package/src/theme/CodeBlock/index.tsx +27 -151
  130. package/src/theme/CodeBlock/styles.module.css +12 -9
  131. package/src/theme/Details/index.tsx +24 -0
  132. package/src/theme/Details/styles.module.css +13 -0
  133. package/src/theme/DocCard/index.tsx +100 -0
  134. package/src/theme/DocCard/styles.module.css +43 -0
  135. package/src/theme/DocCardList/index.tsx +27 -0
  136. package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +53 -0
  137. package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
  138. package/src/theme/DocItem/index.tsx +30 -60
  139. package/src/theme/DocItem/styles.module.css +2 -11
  140. package/src/theme/DocItemFooter/index.tsx +91 -0
  141. package/{lib/theme/BlogPostItem → src/theme/DocItemFooter}/styles.module.css +8 -8
  142. package/src/theme/DocPage/index.tsx +44 -22
  143. package/src/theme/DocPaginator/index.tsx +5 -33
  144. package/src/theme/DocPaginatorNavLink/index.tsx +38 -0
  145. package/src/theme/DocSidebar/index.tsx +38 -39
  146. package/src/theme/DocSidebarItem/index.tsx +108 -49
  147. package/src/theme/DocSidebarItem/styles.module.css +4 -0
  148. package/src/theme/DocTagDocListPage/index.tsx +89 -0
  149. package/src/theme/DocTagsListPage/index.tsx +41 -0
  150. package/src/theme/DocVersionBadge/index.tsx +30 -0
  151. package/src/theme/DocVersionBanner/index.tsx +48 -21
  152. package/src/theme/EditThisPage/index.tsx +6 -1
  153. package/src/theme/ErrorPageContent.tsx +41 -0
  154. package/src/theme/Footer/index.tsx +103 -42
  155. package/src/theme/Heading/index.tsx +24 -31
  156. package/src/theme/Heading/styles.css +5 -6
  157. package/src/theme/Heading/styles.module.css +9 -5
  158. package/src/theme/IconArrow/index.tsx +2 -2
  159. package/src/theme/IconClose/index.tsx +26 -0
  160. package/src/theme/IconEdit/index.tsx +2 -2
  161. package/src/theme/IconExternalLink/index.tsx +2 -5
  162. package/src/theme/IconLanguage/index.tsx +2 -6
  163. package/src/theme/IconMenu/index.tsx +3 -3
  164. package/src/theme/LastUpdated/index.tsx +3 -2
  165. package/src/theme/Layout/index.tsx +3 -1
  166. package/src/theme/LayoutHead/index.tsx +18 -17
  167. package/src/theme/LayoutProviders/index.tsx +8 -5
  168. package/src/theme/Logo/index.tsx +21 -17
  169. package/src/theme/MDXComponents/index.tsx +39 -5
  170. package/src/theme/MDXComponents/styles.css +11 -0
  171. package/src/theme/MDXPage/index.tsx +10 -2
  172. package/src/theme/Navbar/index.tsx +62 -35
  173. package/src/theme/Navbar/styles.module.css +3 -39
  174. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +42 -149
  175. package/src/theme/NavbarItem/DocNavbarItem.tsx +12 -16
  176. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +33 -21
  177. package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +7 -3
  178. package/src/theme/NavbarItem/DropdownNavbarItem.tsx +180 -0
  179. package/src/theme/NavbarItem/{LocaleDropdownNavbarItem.tsx → LocaleDropdownNavbarItem/index.tsx} +8 -9
  180. package/src/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
  181. package/src/theme/NavbarItem/index.tsx +41 -16
  182. package/src/theme/{SearchMetadatas → SearchMetadata}/index.tsx +2 -2
  183. package/src/theme/Seo/index.tsx +7 -4
  184. package/src/theme/TOC/index.tsx +13 -35
  185. package/src/theme/TOC/styles.module.css +1 -1
  186. package/src/theme/TOCCollapsible/index.tsx +13 -4
  187. package/src/theme/TOCCollapsible/styles.module.css +1 -0
  188. package/src/theme/TOCInline/index.tsx +13 -32
  189. package/src/theme/TOCItems/index.tsx +96 -0
  190. package/src/theme/Tabs/index.tsx +110 -54
  191. package/src/theme/Tabs/styles.module.css +0 -13
  192. package/src/theme/Tag/index.tsx +31 -0
  193. package/src/theme/Tag/styles.module.css +70 -0
  194. package/src/theme/TagsListByLetter/index.tsx +45 -0
  195. package/src/theme/TagsListByLetter/styles.module.css +11 -0
  196. package/src/theme/TagsListInline/index.tsx +35 -0
  197. package/src/theme/TagsListInline/styles.module.css +15 -0
  198. package/src/theme/ThemeProvider/index.tsx +6 -2
  199. package/src/theme/ThemedImage/index.tsx +5 -5
  200. package/src/theme/Toggle/index.tsx +36 -43
  201. package/src/theme/Toggle/styles.module.css +91 -3
  202. package/src/theme/UserPreferencesProvider/index.tsx +9 -6
  203. package/src/theme/hooks/useHideableNavbar.ts +32 -45
  204. package/src/theme/hooks/useTabGroupChoice.ts +2 -2
  205. package/src/theme/hooks/useTheme.ts +4 -5
  206. package/src/theme/hooks/useWindowSize.ts +2 -7
  207. package/src/theme/prism-include-languages.ts +3 -2
  208. package/src/theme-classic.d.ts +822 -0
  209. package/src/translations.ts +41 -23
  210. package/src/types.d.ts +0 -629
  211. package/src/{validateThemeConfig.js → validateThemeConfig.ts} +160 -100
  212. package/babel.config.js +0 -35
  213. package/codeTranslations/README.md +0 -20
  214. package/codeTranslations/ar.json +0 -56
  215. package/codeTranslations/base.json +0 -110
  216. package/codeTranslations/bn.json +0 -56
  217. package/codeTranslations/da.json +0 -56
  218. package/codeTranslations/de.json +0 -56
  219. package/codeTranslations/es.json +0 -56
  220. package/codeTranslations/fa.json +0 -56
  221. package/codeTranslations/fil.json +0 -56
  222. package/codeTranslations/fr.json +0 -56
  223. package/codeTranslations/he.json +0 -56
  224. package/codeTranslations/hi.json +0 -56
  225. package/codeTranslations/ja.json +0 -56
  226. package/codeTranslations/ko.json +0 -56
  227. package/codeTranslations/pl.json +0 -56
  228. package/codeTranslations/pt-BR.json +0 -56
  229. package/codeTranslations/pt-PT.json +0 -56
  230. package/codeTranslations/ru.json +0 -56
  231. package/codeTranslations/tr.json +0 -56
  232. package/codeTranslations/vi.json +0 -56
  233. package/codeTranslations/zh-Hans.json +0 -56
  234. package/codeTranslations/zh-Hant.json +0 -56
  235. package/lib/__tests__/__snapshots__/translations.test.ts.snap +0 -116
  236. package/lib/__tests__/translations.test.js +0 -112
  237. package/lib/__tests__/validateThemeConfig.test.js +0 -333
  238. package/lib/theme/AnnouncementBar/index.js +0 -72
  239. package/lib/theme/AnnouncementBar/styles.module.css +0 -72
  240. package/lib/theme/BlogListPage/index.js +0 -71
  241. package/lib/theme/BlogListPaginator/index.js +0 -63
  242. package/lib/theme/BlogPostItem/index.js +0 -161
  243. package/lib/theme/BlogPostPage/index.js +0 -69
  244. package/lib/theme/BlogPostPaginator/index.js +0 -64
  245. package/lib/theme/BlogSidebar/index.js +0 -51
  246. package/lib/theme/BlogSidebar/styles.module.css +0 -44
  247. package/lib/theme/BlogTagsListPage/index.js +0 -76
  248. package/lib/theme/BlogTagsPostsPage/index.js +0 -100
  249. package/lib/theme/CodeBlock/index.js +0 -253
  250. package/lib/theme/CodeBlock/styles.module.css +0 -68
  251. package/lib/theme/DocItem/index.js +0 -138
  252. package/lib/theme/DocItem/styles.module.css +0 -31
  253. package/lib/theme/DocPage/index.js +0 -139
  254. package/lib/theme/DocPage/styles.module.css +0 -85
  255. package/lib/theme/DocPaginator/index.js +0 -63
  256. package/lib/theme/DocSidebar/index.js +0 -133
  257. package/lib/theme/DocSidebar/styles.module.css +0 -106
  258. package/lib/theme/DocSidebarItem/index.js +0 -175
  259. package/lib/theme/DocVersionBanner/index.js +0 -128
  260. package/lib/theme/EditThisPage/index.js +0 -31
  261. package/lib/theme/Footer/index.js +0 -115
  262. package/lib/theme/Footer/styles.module.css +0 -15
  263. package/lib/theme/Heading/index.js +0 -76
  264. package/lib/theme/Heading/styles.css +0 -23
  265. package/lib/theme/Heading/styles.module.css +0 -15
  266. package/lib/theme/IconArrow/index.js +0 -28
  267. package/lib/theme/IconEdit/index.js +0 -34
  268. package/lib/theme/IconExternalLink/index.js +0 -30
  269. package/lib/theme/IconLanguage/index.js +0 -29
  270. package/lib/theme/IconMenu/index.js +0 -30
  271. package/lib/theme/LastUpdated/index.js +0 -61
  272. package/lib/theme/Layout/index.js +0 -64
  273. package/lib/theme/Layout/styles.css +0 -27
  274. package/lib/theme/LayoutHead/index.js +0 -144
  275. package/lib/theme/LayoutProviders/index.js +0 -38
  276. package/lib/theme/Logo/index.js +0 -60
  277. package/lib/theme/MDXComponents/index.js +0 -65
  278. package/lib/theme/MDXPage/index.js +0 -66
  279. package/lib/theme/Navbar/index.js +0 -248
  280. package/lib/theme/Navbar/styles.module.css +0 -63
  281. package/lib/theme/NavbarItem/DefaultNavbarItem.js +0 -210
  282. package/lib/theme/NavbarItem/DocNavbarItem.js +0 -63
  283. package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +0 -76
  284. package/lib/theme/NavbarItem/DocsVersionNavbarItem.js +0 -43
  285. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem.js +0 -72
  286. package/lib/theme/NavbarItem/SearchNavbarItem.js +0 -28
  287. package/lib/theme/NavbarItem/index.js +0 -54
  288. package/lib/theme/NotFound.js +0 -57
  289. package/lib/theme/SearchBar.js +0 -15
  290. package/lib/theme/SearchMetadatas/index.js +0 -33
  291. package/lib/theme/Seo/index.js +0 -49
  292. package/lib/theme/SkipToContent/index.js +0 -71
  293. package/lib/theme/SkipToContent/styles.module.css +0 -14
  294. package/lib/theme/TOC/index.js +0 -60
  295. package/lib/theme/TOC/styles.module.css +0 -23
  296. package/lib/theme/TOCCollapsible/index.js +0 -51
  297. package/lib/theme/TOCCollapsible/styles.module.css +0 -49
  298. package/lib/theme/TOCInline/index.js +0 -53
  299. package/lib/theme/TOCInline/styles.module.css +0 -12
  300. package/lib/theme/TabItem/index.js +0 -32
  301. package/lib/theme/Tabs/index.js +0 -150
  302. package/lib/theme/Tabs/styles.module.css +0 -23
  303. package/lib/theme/ThemeContext.js +0 -21
  304. package/lib/theme/ThemeProvider/index.js +0 -38
  305. package/lib/theme/ThemedImage/index.js +0 -49
  306. package/lib/theme/ThemedImage/styles.module.css +0 -18
  307. package/lib/theme/Toggle/index.js +0 -94
  308. package/lib/theme/Toggle/styles.css +0 -103
  309. package/lib/theme/Toggle/styles.module.css +0 -17
  310. package/lib/theme/UserPreferencesContext.js +0 -18
  311. package/lib/theme/UserPreferencesProvider/index.js +0 -36
  312. package/lib/theme/hooks/useContextualSearchFilters.js +0 -47
  313. package/lib/theme/hooks/useDocs.js +0 -18
  314. package/lib/theme/hooks/useHideableNavbar.js +0 -92
  315. package/lib/theme/hooks/useKeyboardNavigation.js +0 -45
  316. package/lib/theme/hooks/useLocationHash.js +0 -28
  317. package/lib/theme/hooks/useLockBodyScroll.js +0 -26
  318. package/lib/theme/hooks/usePrismTheme.js +0 -36
  319. package/lib/theme/hooks/useScrollPosition.js +0 -49
  320. package/lib/theme/hooks/useTOCHighlight.js +0 -87
  321. package/lib/theme/hooks/useTabGroupChoice.js +0 -51
  322. package/lib/theme/hooks/useTheme.js +0 -99
  323. package/lib/theme/hooks/useThemeContext.js +0 -31
  324. package/lib/theme/hooks/useUserPreferencesContext.js +0 -31
  325. package/lib/theme/hooks/useWindowSize.js +0 -73
  326. package/lib/theme/prism-include-languages.js +0 -39
  327. package/lib-next/__tests__/__snapshots__/translations.test.ts.snap +0 -116
  328. package/lib-next/__tests__/translations.test.js +0 -128
  329. package/lib-next/__tests__/validateThemeConfig.test.js +0 -333
  330. package/lib-next/index.js +0 -221
  331. package/lib-next/theme/Toggle/styles.css +0 -103
  332. package/lib-next/theme/hooks/useContextualSearchFilters.js +0 -41
  333. package/lib-next/theme/hooks/useLocationHash.js +0 -20
  334. package/lib-next/theme/hooks/useScrollPosition.js +0 -38
  335. package/lib-next/theme/hooks/useTOCHighlight.js +0 -84
  336. package/lib-next/translations.js +0 -145
  337. package/lib-next/validateThemeConfig.js +0 -319
  338. package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -116
  339. package/src/__tests__/translations.test.ts +0 -116
  340. package/src/__tests__/validateThemeConfig.test.js +0 -333
  341. package/src/prism-include-languages.js +0 -11
  342. package/src/theme/Toggle/styles.css +0 -103
  343. package/src/theme/hooks/useContextualSearchFilters.ts +0 -52
  344. package/src/theme/hooks/useLocationHash.ts +0 -25
  345. package/src/theme/hooks/useScrollPosition.ts +0 -45
  346. package/src/theme/hooks/useTOCHighlight.ts +0 -98
  347. package/tsconfig.json +0 -12
  348. package/update-code-translations.js +0 -242
  349. package/update-code-translations.test.js +0 -33
@@ -0,0 +1,106 @@
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
+
8
+ import React from 'react';
9
+ import clsx from 'clsx';
10
+ import {Props} from '@theme/Admonition';
11
+
12
+ const icons = {
13
+ note: (
14
+ <svg
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ width="14"
17
+ height="16"
18
+ viewBox="0 0 14 16">
19
+ <path
20
+ fillRule="evenodd"
21
+ d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"
22
+ />
23
+ </svg>
24
+ ),
25
+ tip: (
26
+ <svg
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ width="12"
29
+ height="16"
30
+ viewBox="0 0 12 16">
31
+ <path
32
+ fillRule="evenodd"
33
+ d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"
34
+ />
35
+ </svg>
36
+ ),
37
+ danger: (
38
+ <svg
39
+ xmlns="http://www.w3.org/2000/svg"
40
+ width="12"
41
+ height="16"
42
+ viewBox="0 0 12 16">
43
+ <path
44
+ fillRule="evenodd"
45
+ d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"
46
+ />
47
+ </svg>
48
+ ),
49
+ info: (
50
+ <svg
51
+ xmlns="http://www.w3.org/2000/svg"
52
+ width="14"
53
+ height="16"
54
+ viewBox="0 0 14 16">
55
+ <path
56
+ fillRule="evenodd"
57
+ d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"
58
+ />
59
+ </svg>
60
+ ),
61
+ caution: (
62
+ <svg
63
+ xmlns="http://www.w3.org/2000/svg"
64
+ width="16"
65
+ height="16"
66
+ viewBox="0 0 16 16">
67
+ <path
68
+ fillRule="evenodd"
69
+ d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"
70
+ />
71
+ </svg>
72
+ ),
73
+ };
74
+
75
+ const ifmClassNames = {
76
+ note: 'secondary',
77
+ tip: 'success',
78
+ danger: 'danger',
79
+ info: 'info',
80
+ caution: 'warning',
81
+ };
82
+
83
+ export default function Admonition({
84
+ children,
85
+ type,
86
+ title = type,
87
+ icon = icons[type],
88
+ }: Props): JSX.Element {
89
+ return (
90
+ <div
91
+ className={clsx(
92
+ 'admonition',
93
+ `admonition-${type}`,
94
+ 'alert',
95
+ `alert--${ifmClassNames[type]}`,
96
+ )}>
97
+ <div className="admonition-heading">
98
+ <h5>
99
+ <span className="admonition-icon">{icon}</span>
100
+ {title}
101
+ </h5>
102
+ </div>
103
+ <div className="admonition-content">{children}</div>
104
+ </div>
105
+ );
106
+ }
@@ -9,32 +9,28 @@ import React from 'react';
9
9
  import clsx from 'clsx';
10
10
  import {useThemeConfig, useAnnouncementBar} from '@docusaurus/theme-common';
11
11
  import {translate} from '@docusaurus/Translate';
12
+ import IconClose from '@theme/IconClose';
12
13
 
13
14
  import styles from './styles.module.css';
14
15
 
15
16
  function AnnouncementBar(): JSX.Element | null {
16
- const {isClosed, close} = useAnnouncementBar();
17
+ const {isActive, close} = useAnnouncementBar();
17
18
  const {announcementBar} = useThemeConfig();
18
19
 
19
- if (!announcementBar) {
20
+ if (!isActive) {
20
21
  return null;
21
22
  }
22
23
 
23
- const {content, backgroundColor, textColor, isCloseable} = announcementBar;
24
-
25
- if (!content || (isCloseable && isClosed)) {
26
- return null;
27
- }
24
+ const {content, backgroundColor, textColor, isCloseable} = announcementBar!;
28
25
 
29
26
  return (
30
27
  <div
31
28
  className={styles.announcementBar}
32
29
  style={{backgroundColor, color: textColor}}
33
30
  role="banner">
31
+ {isCloseable && <div className={styles.announcementBarPlaceholder} />}
34
32
  <div
35
- className={clsx(styles.announcementBarContent, {
36
- [styles.announcementBarCloseable]: isCloseable,
37
- })}
33
+ className={styles.announcementBarContent}
38
34
  // Developer provided the HTML, so assume it's safe.
39
35
  // eslint-disable-next-line react/no-danger
40
36
  dangerouslySetInnerHTML={{__html: content}}
@@ -42,14 +38,14 @@ function AnnouncementBar(): JSX.Element | null {
42
38
  {isCloseable ? (
43
39
  <button
44
40
  type="button"
45
- className={clsx(styles.announcementBarClose, 'clean-btn')}
41
+ className={clsx('clean-btn close', styles.announcementBarClose)}
46
42
  onClick={close}
47
43
  aria-label={translate({
48
44
  id: 'theme.AnnouncementBar.closeButtonAriaLabel',
49
45
  message: 'Close',
50
46
  description: 'The ARIA label for close button of announcement bar',
51
47
  })}>
52
- <span aria-hidden="true">×</span>
48
+ <IconClose width={14} height={14} strokeWidth={3.1} />
53
49
  </button>
54
50
  ) : null}
55
51
  </div>
@@ -10,8 +10,8 @@
10
10
  }
11
11
 
12
12
  .announcementBar {
13
- position: relative;
14
- width: 100%;
13
+ display: flex;
14
+ align-items: center;
15
15
  height: var(--docusaurus-announcement-bar-height);
16
16
  background-color: var(--ifm-color-white);
17
17
  color: var(--ifm-color-black);
@@ -22,47 +22,27 @@ html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
22
22
  display: none;
23
23
  }
24
24
 
25
- @media print {
26
- .announcementBar {
27
- display: none;
28
- }
29
- }
30
-
31
- @media screen and (min-width: 1024px) {
32
- :root {
33
- --docusaurus-announcement-bar-height: 30px;
34
- }
25
+ .announcementBarPlaceholder {
26
+ flex: 0 0 10px;
35
27
  }
36
28
 
37
29
  .announcementBarClose {
38
- position: absolute;
39
- right: 0;
40
- top: 0;
41
- width: 55px;
42
- font-size: 1.25rem;
43
- height: 100%;
30
+ flex: 0 0 30px;
31
+ align-self: stretch;
32
+ padding: 0;
33
+ line-height: 0;
44
34
  }
45
35
 
46
36
  .announcementBarContent {
37
+ flex: 1 1 auto;
47
38
  font-size: 85%;
48
- width: 100%;
49
39
  text-align: center;
50
40
  padding: 5px 0;
51
41
  }
52
42
 
53
- .announcementBarCloseable {
54
- margin-right: 55px;
55
- }
56
-
57
- @media screen and (max-width: 576px) {
58
- .announcementBarClose {
59
- width: 35px;
60
- }
61
- .announcementBarContent {
62
- width: auto;
63
- }
64
- .announcementBarCloseable {
65
- margin-right: 35px;
43
+ @media print {
44
+ .announcementBar {
45
+ display: none;
66
46
  }
67
47
  }
68
48
 
@@ -70,3 +50,14 @@ html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
70
50
  color: inherit;
71
51
  text-decoration: underline;
72
52
  }
53
+
54
+ @media (min-width: 997px) {
55
+ :root {
56
+ --docusaurus-announcement-bar-height: 30px;
57
+ }
58
+
59
+ .announcementBarPlaceholder,
60
+ .announcementBarClose {
61
+ flex-basis: 50px;
62
+ }
63
+ }
@@ -0,0 +1,142 @@
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
+
8
+ import React, {useRef, useState} from 'react';
9
+ import clsx from 'clsx';
10
+ import {translate} from '@docusaurus/Translate';
11
+
12
+ import styles from './styles.module.css';
13
+ import {
14
+ ThemeClassNames,
15
+ useScrollPosition,
16
+ useLocationChange,
17
+ } from '@docusaurus/theme-common';
18
+
19
+ const threshold = 300;
20
+
21
+ // Not all have support for smooth scrolling (particularly Safari mobile iOS)
22
+ // TODO proper detection is currently unreliable!
23
+ // see https://github.com/wessberg/scroll-behavior-polyfill/issues/16
24
+ const SupportsNativeSmoothScrolling = false;
25
+ // const SupportsNativeSmoothScrolling = ExecutionEnvironment.canUseDOM && 'scrollBehavior' in document.documentElement.style;
26
+
27
+ type CancelScrollTop = () => void;
28
+
29
+ function smoothScrollTopNative(): CancelScrollTop {
30
+ window.scrollTo({top: 0, behavior: 'smooth'});
31
+ return () => {
32
+ // Nothing to cancel, it's natively cancelled if user tries to scroll down
33
+ };
34
+ }
35
+
36
+ function smoothScrollTopPolyfill(): CancelScrollTop {
37
+ let raf: number | null = null;
38
+ function rafRecursion() {
39
+ const currentScroll = document.documentElement.scrollTop;
40
+ if (currentScroll > 0) {
41
+ raf = requestAnimationFrame(rafRecursion);
42
+ window.scrollTo(0, Math.floor(currentScroll * 0.85));
43
+ }
44
+ }
45
+ rafRecursion();
46
+
47
+ // Break the recursion
48
+ // Prevents the user from "fighting" against that recursion producing a weird UX
49
+ return () => raf && cancelAnimationFrame(raf);
50
+ }
51
+
52
+ type UseSmoothScrollTopReturn = {
53
+ // We use a cancel function because the non-native smooth scroll-top implementation must be interrupted if user scroll down
54
+ smoothScrollTop: () => void;
55
+ cancelScrollToTop: CancelScrollTop;
56
+ };
57
+
58
+ function useSmoothScrollToTop(): UseSmoothScrollTopReturn {
59
+ const lastCancelRef = useRef<CancelScrollTop | null>(null);
60
+
61
+ function smoothScrollTop(): void {
62
+ lastCancelRef.current = SupportsNativeSmoothScrolling
63
+ ? smoothScrollTopNative()
64
+ : smoothScrollTopPolyfill();
65
+ }
66
+
67
+ return {
68
+ smoothScrollTop,
69
+ cancelScrollToTop: () => lastCancelRef.current?.(),
70
+ };
71
+ }
72
+
73
+ function BackToTopButton(): JSX.Element {
74
+ const [show, setShow] = useState(false);
75
+ const isFocusedAnchor = useRef(false);
76
+ const {smoothScrollTop, cancelScrollToTop} = useSmoothScrollToTop();
77
+
78
+ useScrollPosition(({scrollY: scrollTop}, lastPosition) => {
79
+ const lastScrollTop = lastPosition?.scrollY;
80
+
81
+ // No lastScrollTop means component is just being mounted.
82
+ // Not really a scroll event from the user, so we ignore it
83
+ if (!lastScrollTop) {
84
+ return;
85
+ }
86
+
87
+ if (isFocusedAnchor.current) {
88
+ isFocusedAnchor.current = false;
89
+ return;
90
+ }
91
+
92
+ const isScrollingUp = scrollTop < lastScrollTop;
93
+
94
+ if (!isScrollingUp) {
95
+ cancelScrollToTop();
96
+ }
97
+
98
+ if (scrollTop < threshold) {
99
+ setShow(false);
100
+ return;
101
+ }
102
+
103
+ if (isScrollingUp) {
104
+ const documentHeight = document.documentElement.scrollHeight;
105
+ const windowHeight = window.innerHeight;
106
+ if (scrollTop + windowHeight < documentHeight) {
107
+ setShow(true);
108
+ }
109
+ } else {
110
+ setShow(false);
111
+ }
112
+ });
113
+
114
+ useLocationChange((locationChangeEvent) => {
115
+ if (locationChangeEvent.location.hash) {
116
+ isFocusedAnchor.current = true;
117
+ setShow(false);
118
+ }
119
+ });
120
+
121
+ return (
122
+ <button
123
+ aria-label={translate({
124
+ id: 'theme.BackToTopButton.buttonAriaLabel',
125
+ message: 'Scroll back to top',
126
+ description: 'The ARIA label for the back to top button',
127
+ })}
128
+ className={clsx(
129
+ 'clean-btn',
130
+ ThemeClassNames.common.backToTopButton,
131
+ styles.backToTopButton,
132
+ {
133
+ [styles.backToTopButtonShow]: show,
134
+ },
135
+ )}
136
+ type="button"
137
+ onClick={() => smoothScrollTop()}
138
+ />
139
+ );
140
+ }
141
+
142
+ export default BackToTopButton;
@@ -0,0 +1,42 @@
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
+
8
+ .backToTopButton {
9
+ position: fixed;
10
+ right: 1.3rem;
11
+ bottom: 1.3rem;
12
+ border-radius: 50%;
13
+ background-color: var(--ifm-color-emphasis-200);
14
+ width: 3rem;
15
+ height: 3rem;
16
+ z-index: var(--ifm-z-index-fixed);
17
+ box-shadow: var(--ifm-global-shadow-lw);
18
+ transition: all var(--ifm-transition-fast)
19
+ var(--ifm-transition-timing-default);
20
+ opacity: 0;
21
+ transform: scale(0);
22
+ }
23
+
24
+ .backToTopButton:after {
25
+ content: ' ';
26
+ display: inline-block;
27
+ mask: var(--ifm-menu-link-sublist-icon) 50% / 2rem 2rem no-repeat;
28
+ background-color: var(--ifm-color-emphasis-1000);
29
+ width: 100%;
30
+ height: 100%;
31
+ }
32
+
33
+ @media (hover: hover) {
34
+ .backToTopButton:hover {
35
+ background-color: var(--ifm-color-emphasis-300);
36
+ }
37
+ }
38
+
39
+ .backToTopButtonShow {
40
+ opacity: 1;
41
+ transform: scale(1);
42
+ }
@@ -0,0 +1,91 @@
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
+
8
+ import React from 'react';
9
+ import Layout from '@theme/Layout';
10
+ import Link from '@docusaurus/Link';
11
+ import type {ArchiveBlogPost, Props} from '@theme/BlogArchivePage';
12
+ import {translate} from '@docusaurus/Translate';
13
+
14
+ type YearProp = {
15
+ year: string;
16
+ posts: ArchiveBlogPost[];
17
+ };
18
+
19
+ function Year({year, posts}: YearProp) {
20
+ return (
21
+ <>
22
+ <h3>{year}</h3>
23
+ <ul>
24
+ {posts.map((post) => (
25
+ <li key={post.metadata.date}>
26
+ <Link to={post.metadata.permalink}>
27
+ {post.metadata.formattedDate} - {post.metadata.title}
28
+ </Link>
29
+ </li>
30
+ ))}
31
+ </ul>
32
+ </>
33
+ );
34
+ }
35
+
36
+ function YearsSection({years}: {years: YearProp[]}) {
37
+ return (
38
+ <section className="margin-vert--lg">
39
+ <div className="container">
40
+ <div className="row">
41
+ {years.map((_props, idx) => (
42
+ <div key={idx} className="col col--4 margin-vert--lg">
43
+ <Year {..._props} />
44
+ </div>
45
+ ))}
46
+ </div>
47
+ </div>
48
+ </section>
49
+ );
50
+ }
51
+
52
+ function listPostsByYears(blogPosts: readonly ArchiveBlogPost[]): YearProp[] {
53
+ const postsByYear: Map<string, ArchiveBlogPost[]> = blogPosts.reduceRight(
54
+ (posts, post) => {
55
+ const year = post.metadata.date.split('-')[0];
56
+ const yearPosts = posts.get(year) || [];
57
+ return posts.set(year, [post, ...yearPosts]);
58
+ },
59
+ new Map(),
60
+ );
61
+
62
+ return Array.from(postsByYear, ([year, posts]) => ({
63
+ year,
64
+ posts,
65
+ }));
66
+ }
67
+
68
+ export default function BlogArchive({archive}: Props): JSX.Element {
69
+ const title = translate({
70
+ id: 'theme.blog.archive.title',
71
+ message: 'Archive',
72
+ description: 'The page & hero title of the blog archive page',
73
+ });
74
+ const description = translate({
75
+ id: 'theme.blog.archive.description',
76
+ message: 'Archive',
77
+ description: 'The page & hero description of the blog archive page',
78
+ });
79
+ const years = listPostsByYears(archive.blogPosts);
80
+ return (
81
+ <Layout title={title} description={description}>
82
+ <header className="hero hero--primary">
83
+ <div className="container">
84
+ <h1 className="hero__title">{title}</h1>
85
+ <p className="hero__subtitle">{description}</p>
86
+ </div>
87
+ </header>
88
+ <main>{years.length > 0 && <YearsSection years={years} />}</main>
89
+ </Layout>
90
+ );
91
+ }
@@ -0,0 +1,44 @@
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
+
8
+ import React from 'react';
9
+ import clsx from 'clsx';
10
+ import Layout from '@theme/Layout';
11
+ import BlogSidebar from '@theme/BlogSidebar';
12
+
13
+ import type {Props} from '@theme/BlogLayout';
14
+
15
+ function BlogLayout(props: Props): JSX.Element {
16
+ const {sidebar, toc, children, ...layoutProps} = props;
17
+ const hasSidebar = sidebar && sidebar.items.length > 0;
18
+
19
+ return (
20
+ <Layout {...layoutProps}>
21
+ <div className="container margin-vert--lg">
22
+ <div className="row">
23
+ {hasSidebar && (
24
+ <aside className="col col--3">
25
+ <BlogSidebar sidebar={sidebar!} />
26
+ </aside>
27
+ )}
28
+ <main
29
+ className={clsx('col', {
30
+ 'col--7': hasSidebar,
31
+ 'col--9 col--offset-1': !hasSidebar,
32
+ })}
33
+ itemScope
34
+ itemType="http://schema.org/Blog">
35
+ {children}
36
+ </main>
37
+ {toc && <div className="col col--2">{toc}</div>}
38
+ </div>
39
+ </div>
40
+ </Layout>
41
+ );
42
+ }
43
+
44
+ export default BlogLayout;
@@ -8,11 +8,10 @@
8
8
  import React from 'react';
9
9
 
10
10
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
11
- import Layout from '@theme/Layout';
11
+ import BlogLayout from '@theme/BlogLayout';
12
12
  import BlogPostItem from '@theme/BlogPostItem';
13
13
  import BlogListPaginator from '@theme/BlogListPaginator';
14
14
  import type {Props} from '@theme/BlogListPage';
15
- import BlogSidebar from '@theme/BlogSidebar';
16
15
  import {ThemeClassNames} from '@docusaurus/theme-common';
17
16
 
18
17
  function BlogListPage(props: Props): JSX.Element {
@@ -23,36 +22,30 @@ function BlogListPage(props: Props): JSX.Element {
23
22
  const {blogDescription, blogTitle, permalink} = metadata;
24
23
  const isBlogOnlyMode = permalink === '/';
25
24
  const title = isBlogOnlyMode ? siteTitle : blogTitle;
25
+
26
26
  return (
27
- <Layout
27
+ <BlogLayout
28
28
  title={title}
29
29
  description={blogDescription}
30
30
  wrapperClassName={ThemeClassNames.wrapper.blogPages}
31
31
  pageClassName={ThemeClassNames.page.blogListPage}
32
- searchMetadatas={{
32
+ searchMetadata={{
33
33
  // assign unique search tag to exclude this page from search results!
34
34
  tag: 'blog_posts_list',
35
- }}>
36
- <div className="container margin-vert--lg">
37
- <div className="row">
38
- <aside className="col col--3">
39
- <BlogSidebar sidebar={sidebar} />
40
- </aside>
41
- <main className="col col--7">
42
- {items.map(({content: BlogPostContent}) => (
43
- <BlogPostItem
44
- key={BlogPostContent.metadata.permalink}
45
- frontMatter={BlogPostContent.frontMatter}
46
- metadata={BlogPostContent.metadata}
47
- truncated={BlogPostContent.metadata.truncated}>
48
- <BlogPostContent />
49
- </BlogPostItem>
50
- ))}
51
- <BlogListPaginator metadata={metadata} />
52
- </main>
53
- </div>
54
- </div>
55
- </Layout>
35
+ }}
36
+ sidebar={sidebar}>
37
+ {items.map(({content: BlogPostContent}) => (
38
+ <BlogPostItem
39
+ key={BlogPostContent.metadata.permalink}
40
+ frontMatter={BlogPostContent.frontMatter}
41
+ assets={BlogPostContent.assets}
42
+ metadata={BlogPostContent.metadata}
43
+ truncated={BlogPostContent.metadata.truncated}>
44
+ <BlogPostContent />
45
+ </BlogPostItem>
46
+ ))}
47
+ <BlogListPaginator metadata={metadata} />
48
+ </BlogLayout>
56
49
  );
57
50
  }
58
51
 
@@ -0,0 +1,49 @@
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
+
8
+ import React from 'react';
9
+ import Link from '@docusaurus/Link';
10
+ import type {Props} from '@theme/BlogPostAuthor';
11
+
12
+ import styles from './styles.module.css';
13
+
14
+ function BlogPostAuthor({author}: Props): JSX.Element {
15
+ const {name, title, url, imageURL} = author;
16
+ return (
17
+ <div className="avatar margin-bottom--sm">
18
+ {imageURL && (
19
+ <Link className="avatar__photo-link avatar__photo" href={url}>
20
+ <img className={styles.image} src={imageURL} alt={name} />
21
+ </Link>
22
+ )}
23
+
24
+ {
25
+ // Note: only legacy author frontmatter allow empty name (not frontMatter.authors)
26
+ name && (
27
+ <div
28
+ className="avatar__intro"
29
+ itemProp="author"
30
+ itemScope
31
+ itemType="https://schema.org/Person">
32
+ <div className="avatar__name">
33
+ <Link href={url} itemProp="url">
34
+ <span itemProp="name">{name}</span>
35
+ </Link>
36
+ </div>
37
+ {title && (
38
+ <small className="avatar__subtitle" itemProp="description">
39
+ {title}
40
+ </small>
41
+ )}
42
+ </div>
43
+ )
44
+ }
45
+ </div>
46
+ );
47
+ }
48
+
49
+ export default BlogPostAuthor;