aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com>2024-05-23 00:25:57 +0900
committer安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com>2024-05-23 00:25:57 +0900
commitad0c3063ba78c6eb66399d12d87de53c34ed01ba (patch)
tree6d6fb9f58aaa8d01efe8572803aa7dc48434fed2 /src
parent30121e3c4fbd33d5b85b9ddd505e2d9251b44839 (diff)
hrefがない場合はリンクしないよう修正
Diffstat (limited to 'src')
-rw-r--r--src/components/ExternalLink.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/components/ExternalLink.js b/src/components/ExternalLink.js
index 82c87300..71e09dd9 100644
--- a/src/components/ExternalLink.js
+++ b/src/components/ExternalLink.js
@@ -3,9 +3,14 @@ import React from 'react';
import ExternalLinkIcon from '@theme/Icon/ExternalLink';
export default function ExternalLink({children, href}) {
+ if(href) {
+ return (
+ <a href={href} rel={"noopener noreferrer"} target={"_blank"}>
+ {children} <ExternalLinkIcon />
+ </a>
+ );
+ }
return (
- <a href={href} rel={"noopener noreferrer"} target={"_blank"}>
- {children} <ExternalLinkIcon />
- </a>
+ <>{children}</>
);
} \ No newline at end of file