diff options
Diffstat (limited to 'src/theme/BlogPostItem/Header')
-rw-r--r-- | src/theme/BlogPostItem/Header/Author.tsx | 10 | ||||
-rw-r--r-- | src/theme/BlogPostItem/Header/Title.tsx | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/theme/BlogPostItem/Header/Author.tsx b/src/theme/BlogPostItem/Header/Author.tsx index 226caee..7710a98 100644 --- a/src/theme/BlogPostItem/Header/Author.tsx +++ b/src/theme/BlogPostItem/Header/Author.tsx | |||
@@ -6,14 +6,16 @@ | |||
6 | 6 | ||
7 | import Author from '@theme-original/BlogPostItem/Header/Author'; | 7 | import Author from '@theme-original/BlogPostItem/Header/Author'; |
8 | import type AuthorType from '@theme/BlogPostItem/Header/Author'; | 8 | import type AuthorType from '@theme/BlogPostItem/Header/Author'; |
9 | import type {WrapperProps} from '@docusaurus/types'; | 9 | import type { WrapperProps } from '@docusaurus/types'; |
10 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | 10 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; |
11 | 11 | ||
12 | type Props = WrapperProps<typeof AuthorType>; | 12 | type Props = WrapperProps<typeof AuthorType>; |
13 | 13 | ||
14 | export default function AuthorWrapper(props: Props): JSX.Element { | 14 | export default function AuthorWrapper(props: Props): JSX.Element { |
15 | const { siteConfig: { url } } = useDocusaurusContext(); | 15 | const { |
16 | const newProps = {...props}; | 16 | siteConfig: { url }, |
17 | } = useDocusaurusContext(); | ||
18 | const newProps = { ...props }; | ||
17 | const { author } = props; | 19 | const { author } = props; |
18 | if (author.url !== undefined && author.url.startsWith(url)) { | 20 | if (author.url !== undefined && author.url.startsWith(url)) { |
19 | const newURL = author.url.substring(url.length); | 21 | const newURL = author.url.substring(url.length); |
@@ -23,5 +25,5 @@ export default function AuthorWrapper(props: Props): JSX.Element { | |||
23 | const newImageURL = author.imageURL.substring(url.length); | 25 | const newImageURL = author.imageURL.substring(url.length); |
24 | newProps.author.imageURL = newImageURL.replace(/\.jpg$/, '.webp'); | 26 | newProps.author.imageURL = newImageURL.replace(/\.jpg$/, '.webp'); |
25 | } | 27 | } |
26 | return <Author {...newProps} /> | 28 | return <Author {...newProps} />; |
27 | } | 29 | } |
diff --git a/src/theme/BlogPostItem/Header/Title.tsx b/src/theme/BlogPostItem/Header/Title.tsx index ced0916..9e19ec9 100644 --- a/src/theme/BlogPostItem/Header/Title.tsx +++ b/src/theme/BlogPostItem/Header/Title.tsx | |||
@@ -13,16 +13,16 @@ | |||
13 | 13 | ||
14 | import clsx from 'clsx'; | 14 | import clsx from 'clsx'; |
15 | import Link from '@docusaurus/Link'; | 15 | import Link from '@docusaurus/Link'; |
16 | import {useBlogPost} from '@docusaurus/theme-common/internal'; | 16 | import { useBlogPost } from '@docusaurus/theme-common/internal'; |
17 | import type {Props} from '@theme/BlogPostItem/Header/Title'; | 17 | import type { Props } from '@theme/BlogPostItem/Header/Title'; |
18 | 18 | ||
19 | import styles from './Title.module.css'; | 19 | import styles from './Title.module.css'; |
20 | 20 | ||
21 | export default function BlogPostItemHeaderTitle({ | 21 | export default function BlogPostItemHeaderTitle({ |
22 | className, | 22 | className, |
23 | }: Props): JSX.Element { | 23 | }: Props): JSX.Element { |
24 | const {metadata, isBlogPostPage} = useBlogPost(); | 24 | const { metadata, isBlogPostPage } = useBlogPost(); |
25 | const {permalink, title} = metadata; | 25 | const { permalink, title } = metadata; |
26 | const TitleHeading = isBlogPostPage ? 'h1' : 'h2'; | 26 | const TitleHeading = isBlogPostPage ? 'h1' : 'h2'; |
27 | return ( | 27 | return ( |
28 | <TitleHeading className={clsx(styles.title, className)}> | 28 | <TitleHeading className={clsx(styles.title, className)}> |