diff options
author | Kristóf Marussy <kristof@marussy.com> | 2024-08-14 02:09:19 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2024-08-14 02:09:19 +0200 |
commit | ed1e6a393166dd25f45c76ecdf8e7b6287d39e3b (patch) | |
tree | 897ca8739ed62b5a6b51b900ae8ff4e6bb7a32c6 /src/theme/Blog/Components | |
parent | Add MODELS '24 paper (diff) | |
download | blog-ed1e6a393166dd25f45c76ecdf8e7b6287d39e3b.tar.gz blog-ed1e6a393166dd25f45c76ecdf8e7b6287d39e3b.tar.zst blog-ed1e6a393166dd25f45c76ecdf8e7b6287d39e3b.zip |
chore(deps): bump dependencies
Diffstat (limited to 'src/theme/Blog/Components')
-rw-r--r-- | src/theme/Blog/Components/Author.tsx | 26 | ||||
-rw-r--r-- | src/theme/Blog/Components/Author/Socials.tsx | 13 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/theme/Blog/Components/Author.tsx b/src/theme/Blog/Components/Author.tsx new file mode 100644 index 0000000..61f7dc7 --- /dev/null +++ b/src/theme/Blog/Components/Author.tsx | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2024 Kristóf Marussy | ||
3 | * | ||
4 | * SPDX-License-Identifier: MIT | ||
5 | */ | ||
6 | |||
7 | import Author from '@theme-original/Blog/Components/Author'; | ||
8 | import type { Props } from '@theme/Blog/Components/Author'; | ||
9 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
10 | |||
11 | export default function AuthorWrapper(props: Props): JSX.Element { | ||
12 | const { | ||
13 | siteConfig: { url }, | ||
14 | } = useDocusaurusContext(); | ||
15 | const newProps = { ...props }; | ||
16 | const { author } = props; | ||
17 | if (author.url !== undefined && author.url.startsWith(url)) { | ||
18 | const newURL = author.url.substring(url.length); | ||
19 | newProps.author.url = newURL === '' ? '/' : newURL; | ||
20 | } | ||
21 | if (author.imageURL !== undefined && author.imageURL.startsWith(url)) { | ||
22 | const newImageURL = author.imageURL.substring(url.length); | ||
23 | newProps.author.imageURL = newImageURL.replace(/\.jpg$/, '.webp'); | ||
24 | } | ||
25 | return <Author {...newProps} />; | ||
26 | } | ||
diff --git a/src/theme/Blog/Components/Author/Socials.tsx b/src/theme/Blog/Components/Author/Socials.tsx new file mode 100644 index 0000000..851d6f9 --- /dev/null +++ b/src/theme/Blog/Components/Author/Socials.tsx | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2024 Kristóf Marussy | ||
3 | * | ||
4 | * SPDX-License-Identifier: MIT | ||
5 | */ | ||
6 | |||
7 | import Socials from '@theme-original/Blog/Components/Author/Socials'; | ||
8 | import type { Props } from '@theme/Blog/Components/Author/Socials'; | ||
9 | |||
10 | export default function AuthorWrapper(props: Props): React.ReactNode { | ||
11 | // Do not reserve space for socials if they are not provided.. | ||
12 | return props.author.socials ? <Socials {...props} /> : null; | ||
13 | } | ||