@docusaurus/theme-classic 0.0.0-5864 → 0.0.0-5866

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.
@@ -7,13 +7,20 @@
7
7
  import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import {useBlogPost} from '@docusaurus/theme-common/internal';
10
- import EditThisPage from '@theme/EditThisPage';
10
+ import {ThemeClassNames} from '@docusaurus/theme-common';
11
+ import EditMetaRow from '@theme/EditMetaRow';
11
12
  import TagsListInline from '@theme/TagsListInline';
12
13
  import ReadMoreLink from '@theme/BlogPostItem/Footer/ReadMoreLink';
13
- import styles from './styles.module.css';
14
14
  export default function BlogPostItemFooter() {
15
15
  const {metadata, isBlogPostPage} = useBlogPost();
16
- const {tags, title, editUrl, hasTruncateMarker} = metadata;
16
+ const {
17
+ tags,
18
+ title,
19
+ editUrl,
20
+ hasTruncateMarker,
21
+ lastUpdatedBy,
22
+ lastUpdatedAt,
23
+ } = metadata;
17
24
  // A post is truncated if it's in the "list view" and it has a truncate marker
18
25
  const truncatedPost = !isBlogPostPage && hasTruncateMarker;
19
26
  const tagsExists = tags.length > 0;
@@ -21,32 +28,55 @@ export default function BlogPostItemFooter() {
21
28
  if (!renderFooter) {
22
29
  return null;
23
30
  }
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
- );
31
+ // BlogPost footer - details view
32
+ if (isBlogPostPage) {
33
+ const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy);
34
+ return (
35
+ <footer className="docusaurus-mt-lg">
36
+ {tagsExists && (
37
+ <div
38
+ className={clsx(
39
+ 'row',
40
+ 'margin-top--sm',
41
+ ThemeClassNames.blog.blogFooterEditMetaRow,
42
+ )}>
43
+ <div className="col">
44
+ <TagsListInline tags={tags} />
45
+ </div>
46
+ </div>
47
+ )}
48
+ {canDisplayEditMetaRow && (
49
+ <EditMetaRow
50
+ className={clsx(
51
+ 'margin-top--sm',
52
+ ThemeClassNames.blog.blogFooterEditMetaRow,
53
+ )}
54
+ editUrl={editUrl}
55
+ lastUpdatedAt={lastUpdatedAt}
56
+ lastUpdatedBy={lastUpdatedBy}
57
+ />
58
+ )}
59
+ </footer>
60
+ );
61
+ }
62
+ // BlogPost footer - list view
63
+ else {
64
+ return (
65
+ <footer className="row docusaurus-mt-lg">
66
+ {tagsExists && (
67
+ <div className={clsx('col', {'col--9': truncatedPost})}>
68
+ <TagsListInline tags={tags} />
69
+ </div>
70
+ )}
71
+ {truncatedPost && (
72
+ <div
73
+ className={clsx('col text--right', {
74
+ 'col--3': tagsExists,
75
+ })}>
76
+ <ReadMoreLink blogPostTitle={title} to={metadata.permalink} />
77
+ </div>
78
+ )}
79
+ </footer>
80
+ );
81
+ }
52
82
  }
@@ -8,39 +8,8 @@ import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import {ThemeClassNames} from '@docusaurus/theme-common';
10
10
  import {useDoc} from '@docusaurus/theme-common/internal';
11
- import LastUpdated from '@theme/LastUpdated';
12
- import EditThisPage from '@theme/EditThisPage';
13
11
  import TagsListInline from '@theme/TagsListInline';
14
- import styles from './styles.module.css';
15
- function TagsRow(props) {
16
- return (
17
- <div
18
- className={clsx(
19
- ThemeClassNames.docs.docFooterTagsRow,
20
- 'row margin-bottom--sm',
21
- )}>
22
- <div className="col">
23
- <TagsListInline {...props} />
24
- </div>
25
- </div>
26
- );
27
- }
28
- function EditMetaRow({editUrl, lastUpdatedAt, lastUpdatedBy}) {
29
- return (
30
- <div className={clsx(ThemeClassNames.docs.docFooterEditMetaRow, 'row')}>
31
- <div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
32
-
33
- <div className={clsx('col', styles.lastUpdated)}>
34
- {(lastUpdatedAt || lastUpdatedBy) && (
35
- <LastUpdated
36
- lastUpdatedAt={lastUpdatedAt}
37
- lastUpdatedBy={lastUpdatedBy}
38
- />
39
- )}
40
- </div>
41
- </div>
42
- );
43
- }
12
+ import EditMetaRow from '@theme/EditMetaRow';
44
13
  export default function DocItemFooter() {
45
14
  const {metadata} = useDoc();
46
15
  const {editUrl, lastUpdatedAt, lastUpdatedBy, tags} = metadata;
@@ -53,9 +22,23 @@ export default function DocItemFooter() {
53
22
  return (
54
23
  <footer
55
24
  className={clsx(ThemeClassNames.docs.docFooter, 'docusaurus-mt-lg')}>
56
- {canDisplayTagsRow && <TagsRow tags={tags} />}
25
+ {canDisplayTagsRow && (
26
+ <div
27
+ className={clsx(
28
+ 'row margin-top--sm',
29
+ ThemeClassNames.docs.docFooterTagsRow,
30
+ )}>
31
+ <div className="col">
32
+ <TagsListInline tags={tags} />
33
+ </div>
34
+ </div>
35
+ )}
57
36
  {canDisplayEditMetaRow && (
58
37
  <EditMetaRow
38
+ className={clsx(
39
+ 'margin-top--sm',
40
+ ThemeClassNames.docs.docFooterEditMetaRow,
41
+ )}
59
42
  editUrl={editUrl}
60
43
  lastUpdatedAt={lastUpdatedAt}
61
44
  lastUpdatedBy={lastUpdatedBy}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { Props } from '@theme/EditMetaRow';
3
+ export default function EditMetaRow({ className, editUrl, lastUpdatedAt, lastUpdatedBy, }: Props): JSX.Element;
@@ -0,0 +1,31 @@
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 EditThisPage from '@theme/EditThisPage';
10
+ import LastUpdated from '@theme/LastUpdated';
11
+ import styles from './styles.module.css';
12
+ export default function EditMetaRow({
13
+ className,
14
+ editUrl,
15
+ lastUpdatedAt,
16
+ lastUpdatedBy,
17
+ }) {
18
+ return (
19
+ <div className={clsx('row', className)}>
20
+ <div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
21
+ <div className={clsx('col', styles.lastUpdated)}>
22
+ {(lastUpdatedAt || lastUpdatedBy) && (
23
+ <LastUpdated
24
+ lastUpdatedAt={lastUpdatedAt}
25
+ lastUpdatedBy={lastUpdatedBy}
26
+ />
27
+ )}
28
+ </div>
29
+ </div>
30
+ );
31
+ }
@@ -24,7 +24,7 @@ function LastUpdatedAtDate({lastUpdatedAt}) {
24
24
  values={{
25
25
  date: (
26
26
  <b>
27
- <time dateTime={atDate.toISOString()}>
27
+ <time dateTime={atDate.toISOString()} itemProp="dateModified">
28
28
  {formattedLastUpdatedAt}
29
29
  </time>
30
30
  </b>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5864",
3
+ "version": "0.0.0-5866",
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-5864",
24
- "@docusaurus/mdx-loader": "0.0.0-5864",
25
- "@docusaurus/module-type-aliases": "0.0.0-5864",
26
- "@docusaurus/plugin-content-blog": "0.0.0-5864",
27
- "@docusaurus/plugin-content-docs": "0.0.0-5864",
28
- "@docusaurus/plugin-content-pages": "0.0.0-5864",
29
- "@docusaurus/theme-common": "0.0.0-5864",
30
- "@docusaurus/theme-translations": "0.0.0-5864",
31
- "@docusaurus/types": "0.0.0-5864",
32
- "@docusaurus/utils": "0.0.0-5864",
33
- "@docusaurus/utils-common": "0.0.0-5864",
34
- "@docusaurus/utils-validation": "0.0.0-5864",
23
+ "@docusaurus/core": "0.0.0-5866",
24
+ "@docusaurus/mdx-loader": "0.0.0-5866",
25
+ "@docusaurus/module-type-aliases": "0.0.0-5866",
26
+ "@docusaurus/plugin-content-blog": "0.0.0-5866",
27
+ "@docusaurus/plugin-content-docs": "0.0.0-5866",
28
+ "@docusaurus/plugin-content-pages": "0.0.0-5866",
29
+ "@docusaurus/theme-common": "0.0.0-5866",
30
+ "@docusaurus/theme-translations": "0.0.0-5866",
31
+ "@docusaurus/types": "0.0.0-5866",
32
+ "@docusaurus/utils": "0.0.0-5866",
33
+ "@docusaurus/utils-common": "0.0.0-5866",
34
+ "@docusaurus/utils-validation": "0.0.0-5866",
35
35
  "@mdx-js/react": "^3.0.0",
36
36
  "clsx": "^2.0.0",
37
37
  "copy-text-to-clipboard": "^3.2.0",
@@ -61,5 +61,5 @@
61
61
  "engines": {
62
62
  "node": ">=18.0"
63
63
  },
64
- "gitHead": "05370c4a2c51890ddf0d02e4dd143a75cbc6f696"
64
+ "gitHead": "0066496d0f98e8f9e4e4636130f26723bdc8f3c7"
65
65
  }
@@ -8,15 +8,21 @@
8
8
  import React from 'react';
9
9
  import clsx from 'clsx';
10
10
  import {useBlogPost} from '@docusaurus/theme-common/internal';
11
- import EditThisPage from '@theme/EditThisPage';
11
+ import {ThemeClassNames} from '@docusaurus/theme-common';
12
+ import EditMetaRow from '@theme/EditMetaRow';
12
13
  import TagsListInline from '@theme/TagsListInline';
13
14
  import ReadMoreLink from '@theme/BlogPostItem/Footer/ReadMoreLink';
14
15
 
15
- import styles from './styles.module.css';
16
-
17
16
  export default function BlogPostItemFooter(): JSX.Element | null {
18
17
  const {metadata, isBlogPostPage} = useBlogPost();
19
- const {tags, title, editUrl, hasTruncateMarker} = metadata;
18
+ const {
19
+ tags,
20
+ title,
21
+ editUrl,
22
+ hasTruncateMarker,
23
+ lastUpdatedBy,
24
+ lastUpdatedAt,
25
+ } = metadata;
20
26
 
21
27
  // A post is truncated if it's in the "list view" and it has a truncate marker
22
28
  const truncatedPost = !isBlogPostPage && hasTruncateMarker;
@@ -29,32 +35,56 @@ export default function BlogPostItemFooter(): JSX.Element | null {
29
35
  return null;
30
36
  }
31
37
 
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
- );
38
+ // BlogPost footer - details view
39
+ if (isBlogPostPage) {
40
+ const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy);
41
+
42
+ return (
43
+ <footer className="docusaurus-mt-lg">
44
+ {tagsExists && (
45
+ <div
46
+ className={clsx(
47
+ 'row',
48
+ 'margin-top--sm',
49
+ ThemeClassNames.blog.blogFooterEditMetaRow,
50
+ )}>
51
+ <div className="col">
52
+ <TagsListInline tags={tags} />
53
+ </div>
54
+ </div>
55
+ )}
56
+ {canDisplayEditMetaRow && (
57
+ <EditMetaRow
58
+ className={clsx(
59
+ 'margin-top--sm',
60
+ ThemeClassNames.blog.blogFooterEditMetaRow,
61
+ )}
62
+ editUrl={editUrl}
63
+ lastUpdatedAt={lastUpdatedAt}
64
+ lastUpdatedBy={lastUpdatedBy}
65
+ />
66
+ )}
67
+ </footer>
68
+ );
69
+ }
70
+ // BlogPost footer - list view
71
+ else {
72
+ return (
73
+ <footer className="row docusaurus-mt-lg">
74
+ {tagsExists && (
75
+ <div className={clsx('col', {'col--9': truncatedPost})}>
76
+ <TagsListInline tags={tags} />
77
+ </div>
78
+ )}
79
+ {truncatedPost && (
80
+ <div
81
+ className={clsx('col text--right', {
82
+ 'col--3': tagsExists,
83
+ })}>
84
+ <ReadMoreLink blogPostTitle={title} to={metadata.permalink} />
85
+ </div>
86
+ )}
87
+ </footer>
88
+ );
89
+ }
60
90
  }
@@ -8,53 +8,10 @@
8
8
  import React from 'react';
9
9
  import clsx from 'clsx';
10
10
  import {ThemeClassNames} from '@docusaurus/theme-common';
11
- import {useDoc, type DocContextValue} from '@docusaurus/theme-common/internal';
12
- import LastUpdated from '@theme/LastUpdated';
13
- import EditThisPage from '@theme/EditThisPage';
14
- import TagsListInline, {
15
- type Props as TagsListInlineProps,
16
- } from '@theme/TagsListInline';
11
+ import {useDoc} from '@docusaurus/theme-common/internal';
12
+ import TagsListInline from '@theme/TagsListInline';
17
13
 
18
- import styles from './styles.module.css';
19
-
20
- function TagsRow(props: TagsListInlineProps) {
21
- return (
22
- <div
23
- className={clsx(
24
- ThemeClassNames.docs.docFooterTagsRow,
25
- 'row margin-bottom--sm',
26
- )}>
27
- <div className="col">
28
- <TagsListInline {...props} />
29
- </div>
30
- </div>
31
- );
32
- }
33
-
34
- type EditMetaRowProps = Pick<
35
- DocContextValue['metadata'],
36
- 'editUrl' | 'lastUpdatedAt' | 'lastUpdatedBy'
37
- >;
38
- function EditMetaRow({
39
- editUrl,
40
- lastUpdatedAt,
41
- lastUpdatedBy,
42
- }: EditMetaRowProps) {
43
- return (
44
- <div className={clsx(ThemeClassNames.docs.docFooterEditMetaRow, 'row')}>
45
- <div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
46
-
47
- <div className={clsx('col', styles.lastUpdated)}>
48
- {(lastUpdatedAt || lastUpdatedBy) && (
49
- <LastUpdated
50
- lastUpdatedAt={lastUpdatedAt}
51
- lastUpdatedBy={lastUpdatedBy}
52
- />
53
- )}
54
- </div>
55
- </div>
56
- );
57
- }
14
+ import EditMetaRow from '@theme/EditMetaRow';
58
15
 
59
16
  export default function DocItemFooter(): JSX.Element | null {
60
17
  const {metadata} = useDoc();
@@ -72,9 +29,23 @@ export default function DocItemFooter(): JSX.Element | null {
72
29
  return (
73
30
  <footer
74
31
  className={clsx(ThemeClassNames.docs.docFooter, 'docusaurus-mt-lg')}>
75
- {canDisplayTagsRow && <TagsRow tags={tags} />}
32
+ {canDisplayTagsRow && (
33
+ <div
34
+ className={clsx(
35
+ 'row margin-top--sm',
36
+ ThemeClassNames.docs.docFooterTagsRow,
37
+ )}>
38
+ <div className="col">
39
+ <TagsListInline tags={tags} />
40
+ </div>
41
+ </div>
42
+ )}
76
43
  {canDisplayEditMetaRow && (
77
44
  <EditMetaRow
45
+ className={clsx(
46
+ 'margin-top--sm',
47
+ ThemeClassNames.docs.docFooterEditMetaRow,
48
+ )}
78
49
  editUrl={editUrl}
79
50
  lastUpdatedAt={lastUpdatedAt}
80
51
  lastUpdatedBy={lastUpdatedBy}
@@ -0,0 +1,34 @@
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 EditThisPage from '@theme/EditThisPage';
10
+ import type {Props} from '@theme/EditMetaRow';
11
+
12
+ import LastUpdated from '@theme/LastUpdated';
13
+ import styles from './styles.module.css';
14
+
15
+ export default function EditMetaRow({
16
+ className,
17
+ editUrl,
18
+ lastUpdatedAt,
19
+ lastUpdatedBy,
20
+ }: Props): JSX.Element {
21
+ return (
22
+ <div className={clsx('row', className)}>
23
+ <div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
24
+ <div className={clsx('col', styles.lastUpdated)}>
25
+ {(lastUpdatedAt || lastUpdatedBy) && (
26
+ <LastUpdated
27
+ lastUpdatedAt={lastUpdatedAt}
28
+ lastUpdatedBy={lastUpdatedBy}
29
+ />
30
+ )}
31
+ </div>
32
+ </div>
33
+ );
34
+ }
@@ -34,7 +34,7 @@ function LastUpdatedAtDate({
34
34
  values={{
35
35
  date: (
36
36
  <b>
37
- <time dateTime={atDate.toISOString()}>
37
+ <time dateTime={atDate.toISOString()} itemProp="dateModified">
38
38
  {formattedLastUpdatedAt}
39
39
  </time>
40
40
  </b>
@@ -676,6 +676,16 @@ declare module '@theme/DocVersionSuggestions' {
676
676
  export default function DocVersionSuggestions(): JSX.Element;
677
677
  }
678
678
 
679
+ declare module '@theme/EditMetaRow' {
680
+ export interface Props {
681
+ readonly className: string;
682
+ readonly editUrl: string | null | undefined;
683
+ readonly lastUpdatedAt: number | undefined;
684
+ readonly lastUpdatedBy: string | undefined;
685
+ }
686
+ export default function EditMetaRow(props: Props): JSX.Element;
687
+ }
688
+
679
689
  declare module '@theme/EditThisPage' {
680
690
  export interface Props {
681
691
  readonly editUrl: string;
@@ -1,10 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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
- }
@@ -6,9 +6,9 @@
6
6
  */
7
7
 
8
8
  .lastUpdated {
9
- margin-top: 0.2rem;
10
- font-style: italic;
11
9
  font-size: smaller;
10
+ font-style: italic;
11
+ margin-top: 0.2rem;
12
12
  }
13
13
 
14
14
  @media (min-width: 997px) {
@@ -6,9 +6,9 @@
6
6
  */
7
7
 
8
8
  .lastUpdated {
9
- margin-top: 0.2rem;
10
- font-style: italic;
11
9
  font-size: smaller;
10
+ font-style: italic;
11
+ margin-top: 0.2rem;
12
12
  }
13
13
 
14
14
  @media (min-width: 997px) {