@docusaurus/theme-classic 0.0.0-4656 → 0.0.0-4660

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,14 +7,26 @@
7
7
  import React from 'react';
8
8
  import Link from '@docusaurus/Link';
9
9
  import styles from './styles.module.css';
10
+
11
+ function MaybeLink(props) {
12
+ if (props.href) {
13
+ return <Link {...props} />;
14
+ }
15
+
16
+ return <>{props.children}</>;
17
+ }
18
+
10
19
  export default function BlogPostAuthor({author}) {
11
- const {name, title, url, imageURL} = author;
20
+ const {name, title, url, imageURL, email} = author;
21
+ const link = url || (email && `mailto:${email}`) || undefined;
12
22
  return (
13
23
  <div className="avatar margin-bottom--sm">
14
24
  {imageURL && (
15
- <Link className="avatar__photo-link avatar__photo" href={url}>
16
- <img className={styles.image} src={imageURL} alt={name} />
17
- </Link>
25
+ <span className="avatar__photo-link avatar__photo">
26
+ <MaybeLink href={link}>
27
+ <img className={styles.image} src={imageURL} alt={name} />
28
+ </MaybeLink>
29
+ </span>
18
30
  )}
19
31
 
20
32
  {name && (
@@ -24,9 +36,9 @@ export default function BlogPostAuthor({author}) {
24
36
  itemScope
25
37
  itemType="https://schema.org/Person">
26
38
  <div className="avatar__name">
27
- <Link href={url} itemProp="url">
39
+ <MaybeLink href={link} itemProp="url">
28
40
  <span itemProp="name">{name}</span>
29
- </Link>
41
+ </MaybeLink>
30
42
  </div>
31
43
  {title && (
32
44
  <small className="avatar__subtitle" itemProp="description">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4656",
3
+ "version": "0.0.0-4660",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,15 +21,15 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4656",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4656",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4656",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4656",
28
- "@docusaurus/theme-common": "0.0.0-4656",
29
- "@docusaurus/theme-translations": "0.0.0-4656",
30
- "@docusaurus/utils": "0.0.0-4656",
31
- "@docusaurus/utils-common": "0.0.0-4656",
32
- "@docusaurus/utils-validation": "0.0.0-4656",
24
+ "@docusaurus/core": "0.0.0-4660",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4660",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4660",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4660",
28
+ "@docusaurus/theme-common": "0.0.0-4660",
29
+ "@docusaurus/theme-translations": "0.0.0-4660",
30
+ "@docusaurus/utils": "0.0.0-4660",
31
+ "@docusaurus/utils-common": "0.0.0-4660",
32
+ "@docusaurus/utils-validation": "0.0.0-4660",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -42,8 +42,8 @@
42
42
  "rtlcss": "^3.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4656",
46
- "@docusaurus/types": "0.0.0-4656",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4660",
46
+ "@docusaurus/types": "0.0.0-4660",
47
47
  "@types/mdx-js__react": "^1.5.5",
48
48
  "@types/prismjs": "^1.26.0",
49
49
  "@types/rtlcss": "^3.1.2",
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=14"
61
61
  },
62
- "gitHead": "9d3c7ee0e8413fe481c1f1be202fd3ec76efb087"
62
+ "gitHead": "78417b2a5827489b7e0d8b255843800151615a7b"
63
63
  }
@@ -6,19 +6,29 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import Link from '@docusaurus/Link';
9
+ import Link, {type Props as LinkProps} from '@docusaurus/Link';
10
10
  import type {Props} from '@theme/BlogPostAuthor';
11
11
 
12
12
  import styles from './styles.module.css';
13
13
 
14
+ function MaybeLink(props: LinkProps): JSX.Element {
15
+ if (props.href) {
16
+ return <Link {...props} />;
17
+ }
18
+ return <>{props.children}</>;
19
+ }
20
+
14
21
  export default function BlogPostAuthor({author}: Props): JSX.Element {
15
- const {name, title, url, imageURL} = author;
22
+ const {name, title, url, imageURL, email} = author;
23
+ const link = url || (email && `mailto:${email}`) || undefined;
16
24
  return (
17
25
  <div className="avatar margin-bottom--sm">
18
26
  {imageURL && (
19
- <Link className="avatar__photo-link avatar__photo" href={url}>
20
- <img className={styles.image} src={imageURL} alt={name} />
21
- </Link>
27
+ <span className="avatar__photo-link avatar__photo">
28
+ <MaybeLink href={link}>
29
+ <img className={styles.image} src={imageURL} alt={name} />
30
+ </MaybeLink>
31
+ </span>
22
32
  )}
23
33
 
24
34
  {name && (
@@ -28,9 +38,9 @@ export default function BlogPostAuthor({author}: Props): JSX.Element {
28
38
  itemScope
29
39
  itemType="https://schema.org/Person">
30
40
  <div className="avatar__name">
31
- <Link href={url} itemProp="url">
41
+ <MaybeLink href={link} itemProp="url">
32
42
  <span itemProp="name">{name}</span>
33
- </Link>
43
+ </MaybeLink>
34
44
  </div>
35
45
  {title && (
36
46
  <small className="avatar__subtitle" itemProp="description">