This commit is contained in:
2025-06-29 05:21:40 +09:00
parent 934225f9e8
commit 8814be9ee9
4 changed files with 61 additions and 37 deletions
+4 -10
View File
@@ -2,9 +2,9 @@ import axios from 'axios'
import toCamel from 'camelcase-keys'
import { useEffect, useState } from 'react'
import { Helmet } from 'react-helmet'
import ReactMarkdown from 'react-markdown'
import { Link, useLocation, useParams, useNavigate } from 'react-router-dom'
import WikiBody from '@/components/WikiBody'
import PageTitle from '@/components/common/PageTitle'
import MainArea from '@/components/layout/MainArea'
import { API_BASE_URL, SITE_TITLE } from '@/config'
@@ -61,15 +61,9 @@ export default () => {
</div>)}
<PageTitle>{title}</PageTitle>
<div className="prose mx-auto p-4">
{wikiPage === undefined ? 'Loading...' : (
<>
<ReactMarkdown components={{ a: (
({ href, children }) => (['/', '.'].some (e => href?.startsWith (e))
? <Link to={href!}>{children}</Link>
: <a href={href} target="_blank" rel="noopener noreferrer">{children}</a>)) }}>
{wikiPage?.body || `このページは存在しません。[新規作成してください](/wiki/new?title=${ title })。`}
</ReactMarkdown>
</>)}
{wikiPage === undefined
? 'Loading...'
: <WikiBody body={wikiPage?.body || `このページは存在しません。[新規作成してください](/wiki/new?title=${ title })。`} />}
</div>
</MainArea>)
}