@docusaurus/theme-classic 0.0.0-5180 → 0.0.0-5185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/getSwizzleConfig.js +5 -5
- package/lib/theme/AnnouncementBar/index.js +1 -1
- package/lib/theme/BlogListPage/index.js +2 -11
- package/lib/theme/BlogPostItem/Container/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Container/index.js +26 -0
- package/lib/theme/BlogPostItem/Content/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Content/index.js +23 -0
- package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.d.ts +9 -0
- package/lib/theme/BlogPostItem/Footer/ReadMoreLink/index.js +38 -0
- package/lib/theme/BlogPostItem/Footer/index.d.ts +8 -0
- package/lib/theme/BlogPostItem/Footer/index.js +52 -0
- package/lib/theme/BlogPostItem/Footer/styles.module.css +10 -0
- package/lib/theme/BlogPostItem/Header/Author/index.d.ts +9 -0
- package/lib/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.js +3 -2
- package/lib/theme/BlogPostItem/Header/Authors/index.d.ts +9 -0
- package/{src/theme/BlogPostAuthors/index.tsx → lib/theme/BlogPostItem/Header/Authors/index.js} +9 -10
- package/lib/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
- package/lib/theme/{BlogPostAuthor → BlogPostItem/Header/Info}/index.d.ts +2 -2
- package/lib/theme/BlogPostItem/Header/Info/index.js +60 -0
- package/lib/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
- package/lib/theme/{BlogPostAuthors → BlogPostItem/Header/Title}/index.d.ts +2 -2
- package/lib/theme/BlogPostItem/Header/Title/index.js +27 -0
- package/{src/theme/BlogPostItem → lib/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
- package/lib/theme/BlogPostItem/Header/index.d.ts +8 -0
- package/lib/theme/BlogPostItem/Header/index.js +19 -0
- package/lib/theme/BlogPostItem/index.d.ts +1 -1
- package/lib/theme/BlogPostItem/index.js +16 -142
- package/lib/theme/BlogPostItems/index.d.ts +9 -0
- package/lib/theme/BlogPostItems/index.js +27 -0
- package/lib/theme/BlogPostPage/Metadata/index.d.ts +8 -0
- package/lib/theme/BlogPostPage/Metadata/index.js +41 -0
- package/lib/theme/BlogPostPage/index.js +21 -58
- package/lib/theme/BlogTagsPostsPage/index.d.ts +1 -1
- package/lib/theme/BlogTagsPostsPage/index.js +36 -30
- package/lib/theme/ColorModeToggle/index.js +2 -2
- package/lib/theme/DocBreadcrumbs/index.js +1 -1
- package/lib/theme/DocPage/Layout/Sidebar/ExpandButton/index.js +1 -1
- package/lib/theme/DocSidebar/Desktop/CollapseButton/index.js +1 -1
- package/lib/theme/DocSidebarItem/Link/index.js +1 -1
- package/lib/theme/EditThisPage/index.js +1 -1
- package/lib/theme/Footer/LinkItem/index.js +1 -1
- package/lib/theme/{IconArrow → Icon/Arrow}/index.d.ts +1 -1
- package/lib/theme/{IconArrow → Icon/Arrow}/index.js +0 -0
- package/lib/theme/{IconClose → Icon/Close}/index.d.ts +1 -1
- package/lib/theme/{IconClose → Icon/Close}/index.js +0 -0
- package/lib/theme/{IconDarkMode → Icon/DarkMode}/index.d.ts +1 -1
- package/lib/theme/{IconDarkMode → Icon/DarkMode}/index.js +0 -0
- package/lib/theme/{IconEdit → Icon/Edit}/index.d.ts +1 -1
- package/lib/theme/{IconEdit → Icon/Edit}/index.js +0 -0
- package/lib/theme/{IconEdit → Icon/Edit}/styles.module.css +0 -0
- package/lib/theme/{IconExternalLink → Icon/ExternalLink}/index.d.ts +1 -1
- package/lib/theme/{IconExternalLink → Icon/ExternalLink}/index.js +0 -0
- package/lib/theme/{IconExternalLink → Icon/ExternalLink}/styles.module.css +0 -0
- package/lib/theme/{IconHome → Icon/Home}/index.d.ts +1 -1
- package/lib/theme/{IconHome → Icon/Home}/index.js +0 -0
- package/lib/theme/{IconLanguage → Icon/Language}/index.d.ts +1 -1
- package/lib/theme/{IconLanguage → Icon/Language}/index.js +0 -0
- package/lib/theme/{IconLightMode → Icon/LightMode}/index.d.ts +1 -1
- package/lib/theme/{IconLightMode → Icon/LightMode}/index.js +0 -0
- package/lib/theme/{IconMenu → Icon/Menu}/index.d.ts +1 -1
- package/lib/theme/{IconMenu → Icon/Menu}/index.js +0 -0
- package/lib/theme/Navbar/MobileSidebar/Header/index.js +1 -1
- package/lib/theme/Navbar/MobileSidebar/Toggle/index.js +1 -1
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +1 -1
- package/lib/theme/NavbarItem/NavbarNavLink.js +1 -1
- package/package.json +14 -14
- package/src/getSwizzleConfig.ts +5 -5
- package/src/theme/AnnouncementBar/index.tsx +1 -1
- package/src/theme/BlogListPage/index.tsx +2 -11
- package/src/theme/BlogPostItem/Container/index.tsx +32 -0
- package/src/theme/BlogPostItem/Content/index.tsx +29 -0
- package/src/theme/BlogPostItem/Footer/ReadMoreLink/index.tsx +44 -0
- package/src/theme/BlogPostItem/Footer/index.tsx +60 -0
- package/src/theme/BlogPostItem/Footer/styles.module.css +10 -0
- package/src/theme/{BlogPostAuthor → BlogPostItem/Header/Author}/index.tsx +8 -3
- package/{lib/theme/BlogPostAuthors/index.js → src/theme/BlogPostItem/Header/Authors/index.tsx} +14 -3
- package/src/theme/{BlogPostAuthors → BlogPostItem/Header/Authors}/styles.module.css +0 -0
- package/src/theme/BlogPostItem/Header/Info/index.tsx +71 -0
- package/src/theme/BlogPostItem/Header/Info/styles.module.css +10 -0
- package/src/theme/BlogPostItem/Header/Title/index.tsx +33 -0
- package/{lib/theme/BlogPostItem → src/theme/BlogPostItem/Header/Title}/styles.module.css +2 -10
- package/src/theme/BlogPostItem/Header/index.tsx +21 -0
- package/src/theme/BlogPostItem/index.tsx +19 -145
- package/src/theme/BlogPostItems/index.tsx +30 -0
- package/src/theme/BlogPostPage/Metadata/index.tsx +44 -0
- package/src/theme/BlogPostPage/index.tsx +29 -60
- package/src/theme/BlogTagsPostsPage/index.tsx +42 -35
- package/src/theme/ColorModeToggle/index.tsx +2 -2
- package/src/theme/DocBreadcrumbs/index.tsx +1 -1
- package/src/theme/DocPage/Layout/Sidebar/ExpandButton/index.tsx +1 -1
- package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +1 -1
- package/src/theme/DocSidebarItem/Link/index.tsx +1 -1
- package/src/theme/EditThisPage/index.tsx +1 -1
- package/src/theme/Footer/LinkItem/index.tsx +1 -1
- package/src/theme/{IconArrow → Icon/Arrow}/index.tsx +1 -1
- package/src/theme/{IconClose → Icon/Close}/index.tsx +1 -1
- package/src/theme/{IconDarkMode → Icon/DarkMode}/index.tsx +1 -1
- package/src/theme/{IconEdit → Icon/Edit}/index.tsx +1 -1
- package/src/theme/{IconEdit → Icon/Edit}/styles.module.css +0 -0
- package/src/theme/{IconExternalLink → Icon/ExternalLink}/index.tsx +1 -1
- package/src/theme/{IconExternalLink → Icon/ExternalLink}/styles.module.css +0 -0
- package/src/theme/{IconHome → Icon/Home}/index.tsx +1 -1
- package/src/theme/{IconLanguage → Icon/Language}/index.tsx +1 -1
- package/src/theme/{IconLightMode → Icon/LightMode}/index.tsx +1 -1
- package/src/theme/{IconMenu → Icon/Menu}/index.tsx +1 -1
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +1 -1
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +1 -1
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +1 -1
- package/src/theme/NavbarItem/NavbarNavLink.tsx +1 -1
- package/src/theme-classic.d.ts +89 -27
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
|
|
9
|
-
import IconMenu from '@theme/
|
|
9
|
+
import IconMenu from '@theme/Icon/Menu';
|
|
10
10
|
export default function MobileSidebarToggle() {
|
|
11
11
|
const mobileSidebar = useNavbarMobileSidebar();
|
|
12
12
|
return (
|
|
@@ -9,7 +9,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
|
9
9
|
import {useAlternatePageUtils} from '@docusaurus/theme-common/internal';
|
|
10
10
|
import {translate} from '@docusaurus/Translate';
|
|
11
11
|
import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
|
|
12
|
-
import IconLanguage from '@theme/
|
|
12
|
+
import IconLanguage from '@theme/Icon/Language';
|
|
13
13
|
import styles from './styles.module.css';
|
|
14
14
|
export default function LocaleDropdownNavbarItem({
|
|
15
15
|
mobile,
|
|
@@ -9,7 +9,7 @@ import Link from '@docusaurus/Link';
|
|
|
9
9
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
10
10
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
11
11
|
import {isRegexpStringMatch} from '@docusaurus/theme-common';
|
|
12
|
-
import IconExternalLink from '@theme/
|
|
12
|
+
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
13
13
|
export default function NavbarNavLink({
|
|
14
14
|
activeBasePath,
|
|
15
15
|
activeBaseRegex,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5185",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "0.0.0-
|
|
24
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
25
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
31
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
23
|
+
"@docusaurus/core": "0.0.0-5185",
|
|
24
|
+
"@docusaurus/mdx-loader": "0.0.0-5185",
|
|
25
|
+
"@docusaurus/module-type-aliases": "0.0.0-5185",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5185",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5185",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5185",
|
|
29
|
+
"@docusaurus/theme-common": "0.0.0-5185",
|
|
30
|
+
"@docusaurus/theme-translations": "0.0.0-5185",
|
|
31
|
+
"@docusaurus/types": "0.0.0-5185",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-5185",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-5185",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5185",
|
|
35
35
|
"@mdx-js/react": "^1.6.22",
|
|
36
36
|
"clsx": "^1.2.0",
|
|
37
37
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=16.14"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "2e7a502e77969aa2835397f045bece984fc05ea4"
|
|
68
68
|
}
|
package/src/getSwizzleConfig.ts
CHANGED
|
@@ -93,35 +93,35 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
93
93
|
},
|
|
94
94
|
description: 'The footer logo',
|
|
95
95
|
},
|
|
96
|
-
|
|
96
|
+
'Icon/Arrow': {
|
|
97
97
|
actions: {
|
|
98
98
|
eject: 'safe',
|
|
99
99
|
wrap: 'safe',
|
|
100
100
|
},
|
|
101
101
|
description: 'The arrow icon component',
|
|
102
102
|
},
|
|
103
|
-
|
|
103
|
+
'Icon/DarkMode': {
|
|
104
104
|
actions: {
|
|
105
105
|
eject: 'safe',
|
|
106
106
|
wrap: 'safe',
|
|
107
107
|
},
|
|
108
108
|
description: 'The dark mode icon component.',
|
|
109
109
|
},
|
|
110
|
-
|
|
110
|
+
'Icon/Edit': {
|
|
111
111
|
actions: {
|
|
112
112
|
eject: 'safe',
|
|
113
113
|
wrap: 'safe',
|
|
114
114
|
},
|
|
115
115
|
description: 'The edit icon component',
|
|
116
116
|
},
|
|
117
|
-
|
|
117
|
+
'Icon/LightMode': {
|
|
118
118
|
actions: {
|
|
119
119
|
eject: 'safe',
|
|
120
120
|
wrap: 'safe',
|
|
121
121
|
},
|
|
122
122
|
description: 'The light mode icon component.',
|
|
123
123
|
},
|
|
124
|
-
|
|
124
|
+
'Icon/Menu': {
|
|
125
125
|
actions: {
|
|
126
126
|
eject: 'safe',
|
|
127
127
|
wrap: 'safe',
|
|
@@ -10,7 +10,7 @@ import clsx from 'clsx';
|
|
|
10
10
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
11
11
|
import {useAnnouncementBar} from '@docusaurus/theme-common/internal';
|
|
12
12
|
import {translate} from '@docusaurus/Translate';
|
|
13
|
-
import IconClose from '@theme/
|
|
13
|
+
import IconClose from '@theme/Icon/Close';
|
|
14
14
|
|
|
15
15
|
import styles from './styles.module.css';
|
|
16
16
|
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
ThemeClassNames,
|
|
16
16
|
} from '@docusaurus/theme-common';
|
|
17
17
|
import BlogLayout from '@theme/BlogLayout';
|
|
18
|
-
import BlogPostItem from '@theme/BlogPostItem';
|
|
19
18
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
20
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
21
20
|
import type {Props} from '@theme/BlogListPage';
|
|
21
|
+
import BlogPostItems from '@theme/BlogPostItems';
|
|
22
22
|
|
|
23
23
|
function BlogListPageMetadata(props: Props): JSX.Element {
|
|
24
24
|
const {metadata} = props;
|
|
@@ -40,16 +40,7 @@ function BlogListPageContent(props: Props): JSX.Element {
|
|
|
40
40
|
const {metadata, items, sidebar} = props;
|
|
41
41
|
return (
|
|
42
42
|
<BlogLayout sidebar={sidebar}>
|
|
43
|
-
{items
|
|
44
|
-
<BlogPostItem
|
|
45
|
-
key={BlogPostContent.metadata.permalink}
|
|
46
|
-
frontMatter={BlogPostContent.frontMatter}
|
|
47
|
-
assets={BlogPostContent.assets}
|
|
48
|
-
metadata={BlogPostContent.metadata}
|
|
49
|
-
truncated={BlogPostContent.metadata.truncated}>
|
|
50
|
-
<BlogPostContent />
|
|
51
|
-
</BlogPostItem>
|
|
52
|
-
))}
|
|
43
|
+
<BlogPostItems items={items} />
|
|
53
44
|
<BlogListPaginator metadata={metadata} />
|
|
54
45
|
</BlogLayout>
|
|
55
46
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
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 {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
10
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import type {Props} from '@theme/BlogPostItem/Container';
|
|
12
|
+
|
|
13
|
+
export default function BlogPostItemContainer({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
}: Props): JSX.Element {
|
|
17
|
+
const {frontMatter, assets} = useBlogPost();
|
|
18
|
+
const {withBaseUrl} = useBaseUrlUtils();
|
|
19
|
+
const image = assets.image ?? frontMatter.image;
|
|
20
|
+
return (
|
|
21
|
+
<article
|
|
22
|
+
className={className}
|
|
23
|
+
itemProp="blogPost"
|
|
24
|
+
itemScope
|
|
25
|
+
itemType="http://schema.org/BlogPosting">
|
|
26
|
+
{image && (
|
|
27
|
+
<meta itemProp="image" content={withBaseUrl(image, {absolute: true})} />
|
|
28
|
+
)}
|
|
29
|
+
{children}
|
|
30
|
+
</article>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 {blogPostContainerID} from '@docusaurus/utils-common';
|
|
11
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
12
|
+
import MDXContent from '@theme/MDXContent';
|
|
13
|
+
import type {Props} from '@theme/BlogPostItem/Content';
|
|
14
|
+
|
|
15
|
+
export default function BlogPostItemContent({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
}: Props): JSX.Element {
|
|
19
|
+
const {isBlogPostPage} = useBlogPost();
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
// This ID is used for the feed generation to locate the main content
|
|
23
|
+
id={isBlogPostPage ? blogPostContainerID : undefined}
|
|
24
|
+
className={clsx('markdown', className)}
|
|
25
|
+
itemProp="articleBody">
|
|
26
|
+
<MDXContent>{children}</MDXContent>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -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 Translate, {translate} from '@docusaurus/Translate';
|
|
10
|
+
import Link from '@docusaurus/Link';
|
|
11
|
+
import type {Props} from '@theme/BlogPostItem/Footer/ReadMoreLink';
|
|
12
|
+
|
|
13
|
+
function ReadMoreLabel() {
|
|
14
|
+
return (
|
|
15
|
+
<b>
|
|
16
|
+
<Translate
|
|
17
|
+
id="theme.blog.post.readMore"
|
|
18
|
+
description="The label used in blog post item excerpts to link to full blog posts">
|
|
19
|
+
Read More
|
|
20
|
+
</Translate>
|
|
21
|
+
</b>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function BlogPostItemFooterReadMoreLink(
|
|
26
|
+
props: Props,
|
|
27
|
+
): JSX.Element {
|
|
28
|
+
const {blogPostTitle, ...linkProps} = props;
|
|
29
|
+
return (
|
|
30
|
+
<Link
|
|
31
|
+
aria-label={translate(
|
|
32
|
+
{
|
|
33
|
+
message: 'Read more about {title}',
|
|
34
|
+
id: 'theme.blog.post.readMoreLabel',
|
|
35
|
+
description:
|
|
36
|
+
'The ARIA label for the link to full blog posts from excerpts',
|
|
37
|
+
},
|
|
38
|
+
{title: blogPostTitle},
|
|
39
|
+
)}
|
|
40
|
+
{...linkProps}>
|
|
41
|
+
<ReadMoreLabel />
|
|
42
|
+
</Link>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -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
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import EditThisPage from '@theme/EditThisPage';
|
|
12
|
+
import TagsListInline from '@theme/TagsListInline';
|
|
13
|
+
import ReadMoreLink from '@theme/BlogPostItem/Footer/ReadMoreLink';
|
|
14
|
+
|
|
15
|
+
import styles from './styles.module.css';
|
|
16
|
+
|
|
17
|
+
export default function BlogPostItemFooter(): JSX.Element | null {
|
|
18
|
+
const {metadata, isBlogPostPage} = useBlogPost();
|
|
19
|
+
const {tags, title, editUrl, hasTruncateMarker} = metadata;
|
|
20
|
+
|
|
21
|
+
// A post is truncated if it's in the "list view" and it has a truncate marker
|
|
22
|
+
const truncatedPost = !isBlogPostPage && hasTruncateMarker;
|
|
23
|
+
|
|
24
|
+
const tagsExists = tags.length > 0;
|
|
25
|
+
|
|
26
|
+
const renderFooter = tagsExists || truncatedPost || editUrl;
|
|
27
|
+
|
|
28
|
+
if (!renderFooter) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<footer
|
|
34
|
+
className={clsx(
|
|
35
|
+
'row docusaurus-mt-lg',
|
|
36
|
+
isBlogPostPage && styles.blogPostFooterDetailsFull,
|
|
37
|
+
)}>
|
|
38
|
+
{tagsExists && (
|
|
39
|
+
<div className={clsx('col', {'col--9': truncatedPost})}>
|
|
40
|
+
<TagsListInline tags={tags} />
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
|
|
44
|
+
{isBlogPostPage && editUrl && (
|
|
45
|
+
<div className="col margin-top--sm">
|
|
46
|
+
<EditThisPage editUrl={editUrl} />
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
|
|
50
|
+
{truncatedPost && (
|
|
51
|
+
<div
|
|
52
|
+
className={clsx('col text--right', {
|
|
53
|
+
'col--3': tagsExists,
|
|
54
|
+
})}>
|
|
55
|
+
<ReadMoreLink blogPostTitle={title} to={metadata.permalink} />
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
</footer>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
9
10
|
import Link, {type Props as LinkProps} from '@docusaurus/Link';
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
import type {Props} from '@theme/BlogPostItem/Header/Author';
|
|
11
13
|
|
|
12
14
|
function MaybeLink(props: LinkProps): JSX.Element {
|
|
13
15
|
if (props.href) {
|
|
@@ -16,11 +18,14 @@ function MaybeLink(props: LinkProps): JSX.Element {
|
|
|
16
18
|
return <>{props.children}</>;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
export default function
|
|
21
|
+
export default function BlogPostItemHeaderAuthor({
|
|
22
|
+
author,
|
|
23
|
+
className,
|
|
24
|
+
}: Props): JSX.Element {
|
|
20
25
|
const {name, title, url, imageURL, email} = author;
|
|
21
26
|
const link = url || (email && `mailto:${email}`) || undefined;
|
|
22
27
|
return (
|
|
23
|
-
<div className=
|
|
28
|
+
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
24
29
|
{imageURL && (
|
|
25
30
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
26
31
|
<img className="avatar__photo" src={imageURL} alt={name} />
|
package/{lib/theme/BlogPostAuthors/index.js → src/theme/BlogPostItem/Header/Authors/index.tsx}
RENAMED
|
@@ -4,12 +4,22 @@
|
|
|
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
|
+
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import clsx from 'clsx';
|
|
9
|
-
import
|
|
10
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
11
|
+
import BlogPostItemHeaderAuthor from '@theme/BlogPostItem/Header/Author';
|
|
12
|
+
import type {Props} from '@theme/BlogPostItem/Header/Authors';
|
|
10
13
|
import styles from './styles.module.css';
|
|
14
|
+
|
|
11
15
|
// Component responsible for the authors layout
|
|
12
|
-
export default function
|
|
16
|
+
export default function BlogPostItemHeaderAuthors({
|
|
17
|
+
className,
|
|
18
|
+
}: Props): JSX.Element | null {
|
|
19
|
+
const {
|
|
20
|
+
metadata: {authors},
|
|
21
|
+
assets,
|
|
22
|
+
} = useBlogPost();
|
|
13
23
|
const authorsCount = authors.length;
|
|
14
24
|
if (authorsCount === 0) {
|
|
15
25
|
return null;
|
|
@@ -20,6 +30,7 @@ export default function BlogPostAuthors({authors, assets}) {
|
|
|
20
30
|
className={clsx(
|
|
21
31
|
'margin-top--md margin-bottom--sm',
|
|
22
32
|
imageOnly ? styles.imageOnlyAuthorRow : 'row',
|
|
33
|
+
className,
|
|
23
34
|
)}>
|
|
24
35
|
{authors.map((author, idx) => (
|
|
25
36
|
<div
|
|
@@ -28,7 +39,7 @@ export default function BlogPostAuthors({authors, assets}) {
|
|
|
28
39
|
imageOnly ? styles.imageOnlyAuthorCol : styles.authorCol,
|
|
29
40
|
)}
|
|
30
41
|
key={idx}>
|
|
31
|
-
<
|
|
42
|
+
<BlogPostItemHeaderAuthor
|
|
32
43
|
author={{
|
|
33
44
|
...author,
|
|
34
45
|
// Handle author images using relative paths
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
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 {translate} from '@docusaurus/Translate';
|
|
11
|
+
import {usePluralForm} from '@docusaurus/theme-common';
|
|
12
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
13
|
+
import type {Props} from '@theme/BlogPostItem/Header/Info';
|
|
14
|
+
|
|
15
|
+
import styles from './styles.module.css';
|
|
16
|
+
|
|
17
|
+
// Very simple pluralization: probably good enough for now
|
|
18
|
+
function useReadingTimePlural() {
|
|
19
|
+
const {selectMessage} = usePluralForm();
|
|
20
|
+
return (readingTimeFloat: number) => {
|
|
21
|
+
const readingTime = Math.ceil(readingTimeFloat);
|
|
22
|
+
return selectMessage(
|
|
23
|
+
readingTime,
|
|
24
|
+
translate(
|
|
25
|
+
{
|
|
26
|
+
id: 'theme.blog.post.readingTime.plurals',
|
|
27
|
+
description:
|
|
28
|
+
'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)',
|
|
29
|
+
message: 'One min read|{readingTime} min read',
|
|
30
|
+
},
|
|
31
|
+
{readingTime},
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ReadingTime({readingTime}: {readingTime: number}) {
|
|
38
|
+
const readingTimePlural = useReadingTimePlural();
|
|
39
|
+
return <>{readingTimePlural(readingTime)}</>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function Date({date, formattedDate}: {date: string; formattedDate: string}) {
|
|
43
|
+
return (
|
|
44
|
+
<time dateTime={date} itemProp="datePublished">
|
|
45
|
+
{formattedDate}
|
|
46
|
+
</time>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function Spacer() {
|
|
51
|
+
return <>{' · '}</>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default function BlogPostItemHeaderInfo({
|
|
55
|
+
className,
|
|
56
|
+
}: Props): JSX.Element {
|
|
57
|
+
const {metadata} = useBlogPost();
|
|
58
|
+
const {date, formattedDate, readingTime} = metadata;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className={clsx(styles.container, 'margin-vert--md', className)}>
|
|
62
|
+
<Date date={date} formattedDate={formattedDate} />
|
|
63
|
+
{typeof readingTime !== 'undefined' && (
|
|
64
|
+
<>
|
|
65
|
+
<Spacer />
|
|
66
|
+
<ReadingTime readingTime={readingTime} />
|
|
67
|
+
</>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 Link from '@docusaurus/Link';
|
|
11
|
+
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
12
|
+
import type {Props} from '@theme/BlogPostItem/Header/Title';
|
|
13
|
+
|
|
14
|
+
import styles from './styles.module.css';
|
|
15
|
+
|
|
16
|
+
export default function BlogPostItemHeaderTitle({
|
|
17
|
+
className,
|
|
18
|
+
}: Props): JSX.Element {
|
|
19
|
+
const {metadata, isBlogPostPage} = useBlogPost();
|
|
20
|
+
const {permalink, title} = metadata;
|
|
21
|
+
const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
|
|
22
|
+
return (
|
|
23
|
+
<TitleHeading className={clsx(styles.title, className)} itemProp="headline">
|
|
24
|
+
{isBlogPostPage ? (
|
|
25
|
+
title
|
|
26
|
+
) : (
|
|
27
|
+
<Link itemProp="url" to={permalink}>
|
|
28
|
+
{title}
|
|
29
|
+
</Link>
|
|
30
|
+
)}
|
|
31
|
+
</TitleHeading>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
.
|
|
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
|
-
.
|
|
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,21 @@
|
|
|
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 BlogPostItemHeaderTitle from '@theme/BlogPostItem/Header/Title';
|
|
10
|
+
import BlogPostItemHeaderInfo from '@theme/BlogPostItem/Header/Info';
|
|
11
|
+
import BlogPostItemHeaderAuthors from '@theme/BlogPostItem/Header/Authors';
|
|
12
|
+
|
|
13
|
+
export default function BlogPostItemHeader(): JSX.Element {
|
|
14
|
+
return (
|
|
15
|
+
<header>
|
|
16
|
+
<BlogPostItemHeaderTitle />
|
|
17
|
+
<BlogPostItemHeaderInfo />
|
|
18
|
+
<BlogPostItemHeaderAuthors />
|
|
19
|
+
</header>
|
|
20
|
+
);
|
|
21
|
+
}
|