diff options
author | 安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com> | 2024-05-11 00:16:48 +0900 |
---|---|---|
committer | 安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com> | 2024-05-11 00:16:48 +0900 |
commit | 2c67177d572ca329be2074adc06fbf915f4fa884 (patch) | |
tree | f4e9df1a91afbe352ecc77f11a457b8a8fed71bd | |
parent | 9a95f9e4f5e84436a4b129fa9ba1d832afdac176 (diff) |
hrefが空の場合はリンクしないように
-rw-r--r-- | src/components/BlockQuote.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/components/BlockQuote.js b/src/components/BlockQuote.js index 18eac100..605ae03d 100644 --- a/src/components/BlockQuote.js +++ b/src/components/BlockQuote.js @@ -4,9 +4,17 @@ import styles from './BlockQuote.module.css'; import { Icon } from '@iconify/react'; // Import the entire Iconify library. export default function BlockQuote({children, refs, href}) { + if (href) { + return ( + <blockquote className={styles.qt}> + <header><cite><ExternalLink href={href}>{refs}</ExternalLink></cite></header> + {children} + </blockquote> + ); + } return ( <blockquote className={styles.qt}> - <header><cite><ExternalLink href={href}>{refs}</ExternalLink></cite></header> + <header><cite>{refs}</cite></header> {children} </blockquote> ); |