aboutsummaryrefslogtreecommitdiffstats
path: root/src/theme/Blog/Components
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-08-14 02:09:19 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-08-14 02:09:19 +0200
commited1e6a393166dd25f45c76ecdf8e7b6287d39e3b (patch)
tree897ca8739ed62b5a6b51b900ae8ff4e6bb7a32c6 /src/theme/Blog/Components
parentAdd MODELS '24 paper (diff)
downloadblog-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.tsx26
-rw-r--r--src/theme/Blog/Components/Author/Socials.tsx13
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
7import Author from '@theme-original/Blog/Components/Author';
8import type { Props } from '@theme/Blog/Components/Author';
9import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
10
11export 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
7import Socials from '@theme-original/Blog/Components/Author/Socials';
8import type { Props } from '@theme/Blog/Components/Author/Socials';
9
10export 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}