@docusaurus/theme-classic 0.0.0-5183 → 0.0.0-5186

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 (110) hide show
  1. package/lib/getSwizzleConfig.js +5 -5
  2. package/lib/theme/AnnouncementBar/index.js +1 -1
  3. package/lib/theme/BlogListPage/index.js +2 -11
  4. package/lib/theme/BlogPostItem/Container/index.d.ts +9 -0
  5. package/lib/theme/BlogPostItem/Container/index.js +26 -0
  6. package/lib/theme/BlogPostItem/Content/index.d.ts +9 -0
  7. package/lib/theme/BlogPostItem/Content/index.js +23 -0
  8. package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.d.ts +9 -0
  9. package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.js +38 -0
  10. package/lib/theme/BlogPostItem/Footer/index.d.ts +8 -0
  11. package/lib/theme/BlogPostItem/Footer/index.js +52 -0
  12. package/lib/theme/BlogPostItem/Footer/styles.module.css +10 -0
  13. package/lib/theme/BlogPostItem/Header/Author/index.d.ts +9 -0
  14. package/lib/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.js +3 -2
  15. package/lib/theme/BlogPostItem/Header/Authors/index.d.ts +9 -0
  16. package/{src/theme/BlogPostAuthors/index.tsx → lib/theme/BlogPostItem/Header/Authors/index.js} +9 -10
  17. package/lib/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
  18. package/lib/theme/{BlogPostAuthor → BlogPostItem/Header/Info}/index.d.ts +2 -2
  19. package/lib/theme/BlogPostItem/Header/Info/index.js +60 -0
  20. package/lib/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
  21. package/lib/theme/{BlogPostAuthors → BlogPostItem/Header/Title}/index.d.ts +2 -2
  22. package/lib/theme/BlogPostItem/Header/Title/index.js +27 -0
  23. package/{src/theme/BlogPostItem → lib/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
  24. package/lib/theme/BlogPostItem/Header/index.d.ts +8 -0
  25. package/lib/theme/BlogPostItem/Header/index.js +19 -0
  26. package/lib/theme/BlogPostItem/index.d.ts +1 -1
  27. package/lib/theme/BlogPostItem/index.js +16 -142
  28. package/lib/theme/BlogPostItems/index.d.ts +9 -0
  29. package/lib/theme/BlogPostItems/index.js +27 -0
  30. package/lib/theme/BlogPostPage/Metadata/index.d.ts +8 -0
  31. package/lib/theme/BlogPostPage/Metadata/index.js +41 -0
  32. package/lib/theme/BlogPostPage/index.js +21 -58
  33. package/lib/theme/BlogTagsPostsPage/index.d.ts +1 -1
  34. package/lib/theme/BlogTagsPostsPage/index.js +36 -30
  35. package/lib/theme/ColorModeToggle/index.js +2 -2
  36. package/lib/theme/DocBreadcrumbs/index.js +1 -1
  37. package/lib/theme/DocPage/Layout/Sidebar/ExpandButton/index.js +1 -1
  38. package/lib/theme/DocSidebar/Desktop/CollapseButton/index.js +1 -1
  39. package/lib/theme/DocSidebarItem/Link/index.js +1 -1
  40. package/lib/theme/EditThisPage/index.js +1 -1
  41. package/lib/theme/Footer/LinkItem/index.js +1 -1
  42. package/lib/theme/{IconArrow → Icon/Arrow}/index.d.ts +1 -1
  43. package/lib/theme/{IconArrow → Icon/Arrow}/index.js +0 -0
  44. package/lib/theme/{IconClose → Icon/Close}/index.d.ts +1 -1
  45. package/lib/theme/{IconClose → Icon/Close}/index.js +0 -0
  46. package/lib/theme/{IconDarkMode → Icon/DarkMode}/index.d.ts +1 -1
  47. package/lib/theme/{IconDarkMode → Icon/DarkMode}/index.js +0 -0
  48. package/lib/theme/{IconEdit → Icon/Edit}/index.d.ts +1 -1
  49. package/lib/theme/{IconEdit → Icon/Edit}/index.js +0 -0
  50. package/lib/theme/{IconEdit → Icon/Edit}/styles.module.css +0 -0
  51. package/lib/theme/{IconExternalLink → Icon/ExternalLink}/index.d.ts +1 -1
  52. package/lib/theme/{IconExternalLink → Icon/ExternalLink}/index.js +0 -0
  53. package/lib/theme/{IconExternalLink → Icon/ExternalLink}/styles.module.css +0 -0
  54. package/lib/theme/{IconHome → Icon/Home}/index.d.ts +1 -1
  55. package/lib/theme/{IconHome → Icon/Home}/index.js +0 -0
  56. package/lib/theme/{IconLanguage → Icon/Language}/index.d.ts +1 -1
  57. package/lib/theme/{IconLanguage → Icon/Language}/index.js +0 -0
  58. package/lib/theme/{IconLightMode → Icon/LightMode}/index.d.ts +1 -1
  59. package/lib/theme/{IconLightMode → Icon/LightMode}/index.js +0 -0
  60. package/lib/theme/{IconMenu → Icon/Menu}/index.d.ts +1 -1
  61. package/lib/theme/{IconMenu → Icon/Menu}/index.js +0 -0
  62. package/lib/theme/Navbar/MobileSidebar/Header/index.js +1 -1
  63. package/lib/theme/Navbar/MobileSidebar/Toggle/index.js +1 -1
  64. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +1 -1
  65. package/lib/theme/NavbarItem/NavbarNavLink.js +1 -1
  66. package/package.json +15 -15
  67. package/src/getSwizzleConfig.ts +5 -5
  68. package/src/theme/AnnouncementBar/index.tsx +1 -1
  69. package/src/theme/BlogListPage/index.tsx +2 -11
  70. package/src/theme/BlogPostItem/Container/index.tsx +32 -0
  71. package/src/theme/BlogPostItem/Content/index.tsx +29 -0
  72. package/src/theme/BlogPostItem/Footer/ReadMoreLink/index.tsx +44 -0
  73. package/src/theme/BlogPostItem/Footer/index.tsx +60 -0
  74. package/src/theme/BlogPostItem/Footer/styles.module.css +10 -0
  75. package/src/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.tsx +8 -3
  76. package/{lib/theme/BlogPostAuthors/index.js → src/theme/BlogPostItem/Header/Authors/index.tsx} +14 -3
  77. package/src/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
  78. package/src/theme/BlogPostItem/Header/Info/index.tsx +71 -0
  79. package/src/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
  80. package/src/theme/BlogPostItem/Header/Title/index.tsx +33 -0
  81. package/{lib/theme/BlogPostItem → src/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
  82. package/src/theme/BlogPostItem/Header/index.tsx +21 -0
  83. package/src/theme/BlogPostItem/index.tsx +19 -145
  84. package/src/theme/BlogPostItems/index.tsx +30 -0
  85. package/src/theme/BlogPostPage/Metadata/index.tsx +44 -0
  86. package/src/theme/BlogPostPage/index.tsx +29 -60
  87. package/src/theme/BlogTagsPostsPage/index.tsx +42 -35
  88. package/src/theme/ColorModeToggle/index.tsx +2 -2
  89. package/src/theme/DocBreadcrumbs/index.tsx +1 -1
  90. package/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx +1 -1
  91. package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +1 -1
  92. package/src/theme/DocSidebarItem/Link/index.tsx +1 -1
  93. package/src/theme/EditThisPage/index.tsx +1 -1
  94. package/src/theme/Footer/LinkItem/index.tsx +1 -1
  95. package/src/theme/{IconArrow → Icon/Arrow}/index.tsx +1 -1
  96. package/src/theme/{IconClose → Icon/Close}/index.tsx +1 -1
  97. package/src/theme/{IconDarkMode → Icon/DarkMode}/index.tsx +1 -1
  98. package/src/theme/{IconEdit → Icon/Edit}/index.tsx +1 -1
  99. package/src/theme/{IconEdit → Icon/Edit}/styles.module.css +0 -0
  100. package/src/theme/{IconExternalLink → Icon/ExternalLink}/index.tsx +1 -1
  101. package/src/theme/{IconExternalLink → Icon/ExternalLink}/styles.module.css +0 -0
  102. package/src/theme/{IconHome → Icon/Home}/index.tsx +1 -1
  103. package/src/theme/{IconLanguage → Icon/Language}/index.tsx +1 -1
  104. package/src/theme/{IconLightMode → Icon/LightMode}/index.tsx +1 -1
  105. package/src/theme/{IconMenu → Icon/Menu}/index.tsx +1 -1
  106. package/src/theme/Navbar/MobileSidebar/Header/index.tsx +1 -1
  107. package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +1 -1
  108. package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +1 -1
  109. package/src/theme/NavbarItem/NavbarNavLink.tsx +1 -1
  110. package/src/theme-classic.d.ts +89 -27
@@ -87,35 +87,35 @@ function getSwizzleConfig() {
87
87
  },
88
88
  description: 'The footer logo',
89
89
  },
90
- IconArrow: {
90
+ 'Icon/Arrow': {
91
91
  actions: {
92
92
  eject: 'safe',
93
93
  wrap: 'safe',
94
94
  },
95
95
  description: 'The arrow icon component',
96
96
  },
97
- IconDarkMode: {
97
+ 'Icon/DarkMode': {
98
98
  actions: {
99
99
  eject: 'safe',
100
100
  wrap: 'safe',
101
101
  },
102
102
  description: 'The dark mode icon component.',
103
103
  },
104
- IconEdit: {
104
+ 'Icon/Edit': {
105
105
  actions: {
106
106
  eject: 'safe',
107
107
  wrap: 'safe',
108
108
  },
109
109
  description: 'The edit icon component',
110
110
  },
111
- IconLightMode: {
111
+ 'Icon/LightMode': {
112
112
  actions: {
113
113
  eject: 'safe',
114
114
  wrap: 'safe',
115
115
  },
116
116
  description: 'The light mode icon component.',
117
117
  },
118
- IconMenu: {
118
+ 'Icon/Menu': {
119
119
  actions: {
120
120
  eject: 'safe',
121
121
  wrap: 'safe',
@@ -9,7 +9,7 @@ import clsx from 'clsx';
9
9
  import {useThemeConfig} from '@docusaurus/theme-common';
10
10
  import {useAnnouncementBar} from '@docusaurus/theme-common/internal';
11
11
  import {translate} from '@docusaurus/Translate';
12
- import IconClose from '@theme/IconClose';
12
+ import IconClose from '@theme/Icon/Close';
13
13
  import styles from './styles.module.css';
14
14
  export default function AnnouncementBar() {
15
15
  const {isActive, close} = useAnnouncementBar();
@@ -13,9 +13,9 @@ import {
13
13
  ThemeClassNames,
14
14
  } from '@docusaurus/theme-common';
15
15
  import BlogLayout from '@theme/BlogLayout';
16
- import BlogPostItem from '@theme/BlogPostItem';
17
16
  import BlogListPaginator from '@theme/BlogListPaginator';
18
17
  import SearchMetadata from '@theme/SearchMetadata';
18
+ import BlogPostItems from '@theme/BlogPostItems';
19
19
  function BlogListPageMetadata(props) {
20
20
  const {metadata} = props;
21
21
  const {
@@ -35,16 +35,7 @@ function BlogListPageContent(props) {
35
35
  const {metadata, items, sidebar} = props;
36
36
  return (
37
37
  <BlogLayout sidebar={sidebar}>
38
- {items.map(({content: BlogPostContent}) => (
39
- <BlogPostItem
40
- key={BlogPostContent.metadata.permalink}
41
- frontMatter={BlogPostContent.frontMatter}
42
- assets={BlogPostContent.assets}
43
- metadata={BlogPostContent.metadata}
44
- truncated={BlogPostContent.metadata.truncated}>
45
- <BlogPostContent />
46
- </BlogPostItem>
47
- ))}
38
+ <BlogPostItems items={items} />
48
39
  <BlogListPaginator metadata={metadata} />
49
40
  </BlogLayout>
50
41
  );
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/BlogPostItem/Container';
9
+ export default function BlogPostItemContainer({ children, className, }: Props): JSX.Element;
@@ -0,0 +1,26 @@
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
+ import React from 'react';
8
+ import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
9
+ import {useBlogPost} from '@docusaurus/theme-common/internal';
10
+ export default function BlogPostItemContainer({children, className}) {
11
+ const {frontMatter, assets} = useBlogPost();
12
+ const {withBaseUrl} = useBaseUrlUtils();
13
+ const image = assets.image ?? frontMatter.image;
14
+ return (
15
+ <article
16
+ className={className}
17
+ itemProp="blogPost"
18
+ itemScope
19
+ itemType="http://schema.org/BlogPosting">
20
+ {image && (
21
+ <meta itemProp="image" content={withBaseUrl(image, {absolute: true})} />
22
+ )}
23
+ {children}
24
+ </article>
25
+ );
26
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/BlogPostItem/Content';
9
+ export default function BlogPostItemContent({ children, className, }: Props): JSX.Element;
@@ -0,0 +1,23 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import {blogPostContainerID} from '@docusaurus/utils-common';
10
+ import {useBlogPost} from '@docusaurus/theme-common/internal';
11
+ import MDXContent from '@theme/MDXContent';
12
+ export default function BlogPostItemContent({children, className}) {
13
+ const {isBlogPostPage} = useBlogPost();
14
+ return (
15
+ <div
16
+ // This ID is used for the feed generation to locate the main content
17
+ id={isBlogPostPage ? blogPostContainerID : undefined}
18
+ className={clsx('markdown', className)}
19
+ itemProp="articleBody">
20
+ <MDXContent>{children}</MDXContent>
21
+ </div>
22
+ );
23
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/BlogPostItem/Footer/ReadMoreLink';
9
+ export default function BlogPostItemFooterReadMoreLink(props: Props): JSX.Element;
@@ -0,0 +1,38 @@
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
+ import React from 'react';
8
+ import Translate, {translate} from '@docusaurus/Translate';
9
+ import Link from '@docusaurus/Link';
10
+ function ReadMoreLabel() {
11
+ return (
12
+ <b>
13
+ <Translate
14
+ id="theme.blog.post.readMore"
15
+ description="The label used in blog post item excerpts to link to full blog posts">
16
+ Read More
17
+ </Translate>
18
+ </b>
19
+ );
20
+ }
21
+ export default function BlogPostItemFooterReadMoreLink(props) {
22
+ const {blogPostTitle, ...linkProps} = props;
23
+ return (
24
+ <Link
25
+ aria-label={translate(
26
+ {
27
+ message: 'Read more about {title}',
28
+ id: 'theme.blog.post.readMoreLabel',
29
+ description:
30
+ 'The ARIA label for the link to full blog posts from excerpts',
31
+ },
32
+ {title: blogPostTitle},
33
+ )}
34
+ {...linkProps}>
35
+ <ReadMoreLabel />
36
+ </Link>
37
+ );
38
+ }
@@ -0,0 +1,8 @@
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
+ /// <reference types="react" />
8
+ export default function BlogPostItemFooter(): JSX.Element | null;
@@ -0,0 +1,52 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import {useBlogPost} from '@docusaurus/theme-common/internal';
10
+ import EditThisPage from '@theme/EditThisPage';
11
+ import TagsListInline from '@theme/TagsListInline';
12
+ import ReadMoreLink from '@theme/BlogPostItem/Footer/ReadMoreLink';
13
+ import styles from './styles.module.css';
14
+ export default function BlogPostItemFooter() {
15
+ const {metadata, isBlogPostPage} = useBlogPost();
16
+ const {tags, title, editUrl, hasTruncateMarker} = metadata;
17
+ // A post is truncated if it's in the "list view" and it has a truncate marker
18
+ const truncatedPost = !isBlogPostPage && hasTruncateMarker;
19
+ const tagsExists = tags.length > 0;
20
+ const renderFooter = tagsExists || truncatedPost || editUrl;
21
+ if (!renderFooter) {
22
+ return null;
23
+ }
24
+ return (
25
+ <footer
26
+ className={clsx(
27
+ 'row docusaurus-mt-lg',
28
+ isBlogPostPage && styles.blogPostFooterDetailsFull,
29
+ )}>
30
+ {tagsExists && (
31
+ <div className={clsx('col', {'col--9': truncatedPost})}>
32
+ <TagsListInline tags={tags} />
33
+ </div>
34
+ )}
35
+
36
+ {isBlogPostPage && editUrl && (
37
+ <div className="col margin-top--sm">
38
+ <EditThisPage editUrl={editUrl} />
39
+ </div>
40
+ )}
41
+
42
+ {truncatedPost && (
43
+ <div
44
+ className={clsx('col text--right', {
45
+ 'col--3': tagsExists,
46
+ })}>
47
+ <ReadMoreLink blogPostTitle={title} to={metadata.permalink} />
48
+ </div>
49
+ )}
50
+ </footer>
51
+ );
52
+ }
@@ -0,0 +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
+
8
+ .blogPostFooterDetailsFull {
9
+ flex-direction: column;
10
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/BlogPostItem/Header/Author';
9
+ export default function BlogPostItemHeaderAuthor({ author, className, }: Props): JSX.Element;
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import clsx from 'clsx';
8
9
  import Link from '@docusaurus/Link';
9
10
  function MaybeLink(props) {
10
11
  if (props.href) {
@@ -12,11 +13,11 @@ function MaybeLink(props) {
12
13
  }
13
14
  return <>{props.children}</>;
14
15
  }
15
- export default function BlogPostAuthor({author}) {
16
+ export default function BlogPostItemHeaderAuthor({author, className}) {
16
17
  const {name, title, url, imageURL, email} = author;
17
18
  const link = url || (email && `mailto:${email}`) || undefined;
18
19
  return (
19
- <div className="avatar margin-bottom--sm">
20
+ <div className={clsx('avatar margin-bottom--sm', className)}>
20
21
  {imageURL && (
21
22
  <MaybeLink href={link} className="avatar__photo-link">
22
23
  <img className="avatar__photo" src={imageURL} alt={name} />
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ import type { Props } from '@theme/BlogPostItem/Header/Authors';
9
+ export default function BlogPostItemHeaderAuthors({ className, }: Props): JSX.Element | null;
@@ -4,19 +4,17 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
-
8
7
  import React from 'react';
9
8
  import clsx from 'clsx';
10
- import BlogPostAuthor from '@theme/BlogPostAuthor';
11
- import type {Props} from '@theme/BlogPostAuthors';
12
-
9
+ import {useBlogPost} from '@docusaurus/theme-common/internal';
10
+ import BlogPostItemHeaderAuthor from '@theme/BlogPostItem/Header/Author';
13
11
  import styles from './styles.module.css';
14
-
15
12
  // Component responsible for the authors layout
16
- export default function BlogPostAuthors({
17
- authors,
18
- assets,
19
- }: Props): JSX.Element | null {
13
+ export default function BlogPostItemHeaderAuthors({className}) {
14
+ const {
15
+ metadata: {authors},
16
+ assets,
17
+ } = useBlogPost();
20
18
  const authorsCount = authors.length;
21
19
  if (authorsCount === 0) {
22
20
  return null;
@@ -27,6 +25,7 @@ export default function BlogPostAuthors({
27
25
  className={clsx(
28
26
  'margin-top--md margin-bottom--sm',
29
27
  imageOnly ? styles.imageOnlyAuthorRow : 'row',
28
+ className,
30
29
  )}>
31
30
  {authors.map((author, idx) => (
32
31
  <div
@@ -35,7 +34,7 @@ export default function BlogPostAuthors({
35
34
  imageOnly ? styles.imageOnlyAuthorCol : styles.authorCol,
36
35
  )}
37
36
  key={idx}>
38
- <BlogPostAuthor
37
+ <BlogPostItemHeaderAuthor
39
38
  author={{
40
39
  ...author,
41
40
  // Handle author images using relative paths
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  /// <reference types="react" />
8
- import type { Props } from '@theme/BlogPostAuthor';
9
- export default function BlogPostAuthor({ author }: Props): JSX.Element;
8
+ import type { Props } from '@theme/BlogPostItem/Header/Info';
9
+ export default function BlogPostItemHeaderInfo({ className, }: Props): JSX.Element;
@@ -0,0 +1,60 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import {translate} from '@docusaurus/Translate';
10
+ import {usePluralForm} from '@docusaurus/theme-common';
11
+ import {useBlogPost} from '@docusaurus/theme-common/internal';
12
+ import styles from './styles.module.css';
13
+ // Very simple pluralization: probably good enough for now
14
+ function useReadingTimePlural() {
15
+ const {selectMessage} = usePluralForm();
16
+ return (readingTimeFloat) => {
17
+ const readingTime = Math.ceil(readingTimeFloat);
18
+ return selectMessage(
19
+ readingTime,
20
+ translate(
21
+ {
22
+ id: 'theme.blog.post.readingTime.plurals',
23
+ description:
24
+ 'Pluralized label for "{readingTime} min read". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',
25
+ message: 'One min read|{readingTime} min read',
26
+ },
27
+ {readingTime},
28
+ ),
29
+ );
30
+ };
31
+ }
32
+ function ReadingTime({readingTime}) {
33
+ const readingTimePlural = useReadingTimePlural();
34
+ return <>{readingTimePlural(readingTime)}</>;
35
+ }
36
+ function Date({date, formattedDate}) {
37
+ return (
38
+ <time dateTime={date} itemProp="datePublished">
39
+ {formattedDate}
40
+ </time>
41
+ );
42
+ }
43
+ function Spacer() {
44
+ return <>{' · '}</>;
45
+ }
46
+ export default function BlogPostItemHeaderInfo({className}) {
47
+ const {metadata} = useBlogPost();
48
+ const {date, formattedDate, readingTime} = metadata;
49
+ return (
50
+ <div className={clsx(styles.container, 'margin-vert--md', className)}>
51
+ <Date date={date} formattedDate={formattedDate} />
52
+ {typeof readingTime !== 'undefined' && (
53
+ <>
54
+ <Spacer />
55
+ <ReadingTime readingTime={readingTime} />
56
+ </>
57
+ )}
58
+ </div>
59
+ );
60
+ }
@@ -0,0 +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
+
8
+ .container {
9
+ font-size: 0.9rem;
10
+ }
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  /// <reference types="react" />
8
- import type { Props } from '@theme/BlogPostAuthors';
9
- export default function BlogPostAuthors({ authors, assets, }: Props): JSX.Element | null;
8
+ import type { Props } from '@theme/BlogPostItem/Header/Title';
9
+ export default function BlogPostItemHeaderTitle({ className, }: Props): JSX.Element;
@@ -0,0 +1,27 @@
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
+ import React from 'react';
8
+ import clsx from 'clsx';
9
+ import Link from '@docusaurus/Link';
10
+ import {useBlogPost} from '@docusaurus/theme-common/internal';
11
+ import styles from './styles.module.css';
12
+ export default function BlogPostItemHeaderTitle({className}) {
13
+ const {metadata, isBlogPostPage} = useBlogPost();
14
+ const {permalink, title} = metadata;
15
+ const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
16
+ return (
17
+ <TitleHeading className={clsx(styles.title, className)} itemProp="headline">
18
+ {isBlogPostPage ? (
19
+ title
20
+ ) : (
21
+ <Link itemProp="url" to={permalink}>
22
+ {title}
23
+ </Link>
24
+ )}
25
+ </TitleHeading>
26
+ );
27
+ }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- .blogPostTitle {
8
+ .title {
9
9
  font-size: 3rem;
10
10
  }
11
11
 
@@ -13,15 +13,7 @@
13
13
  Blog post title should be smaller on smaller devices
14
14
  **/
15
15
  @media (max-width: 576px) {
16
- .blogPostTitle {
16
+ .title {
17
17
  font-size: 2rem;
18
18
  }
19
19
  }
20
-
21
- .blogPostData {
22
- font-size: 0.9rem;
23
- }
24
-
25
- .blogPostDetailsFull {
26
- flex-direction: column;
27
- }
@@ -0,0 +1,8 @@
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
+ /// <reference types="react" />
8
+ export default function BlogPostItemHeader(): JSX.Element;
@@ -0,0 +1,19 @@
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
+ import React from 'react';
8
+ import BlogPostItemHeaderTitle from '@theme/BlogPostItem/Header/Title';
9
+ import BlogPostItemHeaderInfo from '@theme/BlogPostItem/Header/Info';
10
+ import BlogPostItemHeaderAuthors from '@theme/BlogPostItem/Header/Authors';
11
+ export default function BlogPostItemHeader() {
12
+ return (
13
+ <header>
14
+ <BlogPostItemHeaderTitle />
15
+ <BlogPostItemHeaderInfo />
16
+ <BlogPostItemHeaderAuthors />
17
+ </header>
18
+ );
19
+ }
@@ -6,4 +6,4 @@
6
6
  */
7
7
  /// <reference types="react" />
8
8
  import type { Props } from '@theme/BlogPostItem';
9
- export default function BlogPostItem(props: Props): JSX.Element;
9
+ export default function BlogPostItem({ children, className, }: Props): JSX.Element;