feat(web): 整体替换 UI 框架为 Ant Design 6 并接入自定义主题
以 antd ConfigProvider + antd-style 承载 zinc 风格自定义主题(明暗双套 token), button/input/select/notification 用 createStyles 定制;三态主题经 darkAlgorithm 无刷新切换;use-toast 改基于 antd notification; 移除 shadcn/ui 组件目录与 radix 依赖;样式桥接层保证排版与多端布局不变。
This commit is contained in:
+34
-16
@@ -1,6 +1,7 @@
|
||||
import { Link, useParams } from 'react-router'
|
||||
import { Link, useNavigate, useParams } from 'react-router'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { ArrowLeft, ArrowRight, Clock, Eye } from 'lucide-react'
|
||||
import { Alert, Button, Card, Tag } from 'antd'
|
||||
import { api } from '../lib/api'
|
||||
import type { NoteDetail } from '../lib/api'
|
||||
import { useAuth } from '../lib/auth'
|
||||
@@ -10,6 +11,7 @@ import { formatDateISO, readingMinutes } from '../lib/utils'
|
||||
|
||||
export default function Note() {
|
||||
const { slug = '' } = useParams()
|
||||
const navigate = useNavigate()
|
||||
const { authenticated } = useAuth()
|
||||
const { data: note, isLoading, error } = useQuery({
|
||||
queryKey: ['note', slug],
|
||||
@@ -24,7 +26,9 @@ export default function Note() {
|
||||
<div className="pn-note-article">
|
||||
<p className="pn-home-list-empty">笔记不存在或未公开</p>
|
||||
<p style={{ textAlign: 'center', marginTop: -40 }}>
|
||||
<Link to="/" className="btn ghost pn-note-back"><ArrowLeft size={14} />返回首页</Link>
|
||||
<Button type="text" size="small" className="pn-note-back" icon={<ArrowLeft size={14} />} onClick={() => navigate('/')}>
|
||||
返回首页
|
||||
</Button>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
@@ -34,15 +38,23 @@ export default function Note() {
|
||||
|
||||
return (
|
||||
<article className="pn-note-article">
|
||||
<Link to="/" className="btn ghost pn-note-back">
|
||||
<ArrowLeft size={14} />返回首页
|
||||
</Link>
|
||||
<Button type="text" size="small" className="pn-note-back" icon={<ArrowLeft size={14} />} onClick={() => navigate('/')}>
|
||||
返回首页
|
||||
</Button>
|
||||
|
||||
{privatePreview && authenticated && (
|
||||
<div className="pn-note-private" role="note">
|
||||
<Eye size={15} />
|
||||
私有预览:此笔记未公开,仅管理员可见
|
||||
</div>
|
||||
<Alert
|
||||
role="note"
|
||||
type="info"
|
||||
showIcon={false}
|
||||
className="pn-note-preview-alert"
|
||||
message={
|
||||
<>
|
||||
<Eye size={15} />
|
||||
私有预览:此笔记未公开,仅管理员可见
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
<h1 className="pn-note-title">{note.title}</h1>
|
||||
@@ -57,7 +69,9 @@ export default function Note() {
|
||||
<>
|
||||
<span className="pn-note-meta-sep">·</span>
|
||||
{note.tags.map((t) => (
|
||||
<Link key={t} to={`/tags/${encodeURIComponent(t)}`} className="pn-note-tag">{t}</Link>
|
||||
<Tag key={t}>
|
||||
<Link className="pn-tag-link" to={`/tags/${encodeURIComponent(t)}`}>{t}</Link>
|
||||
</Tag>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
@@ -67,17 +81,21 @@ export default function Note() {
|
||||
|
||||
<nav className="pn-note-postnav" aria-label="笔记导航">
|
||||
{note.prev ? (
|
||||
<Link to={`/notes/${encodeURIComponent(note.prev.slug)}`} className="card pn-note-nav-card">
|
||||
<span className="pn-note-nav-label"><ArrowLeft size={14} />上一篇</span>
|
||||
<span className="pn-note-nav-title">{note.prev.title}</span>
|
||||
<Link to={`/notes/${encodeURIComponent(note.prev.slug)}`} className="pn-note-nav-link">
|
||||
<Card className="pn-note-nav-card" styles={{ body: { padding: 0 } }}>
|
||||
<span className="pn-note-nav-label"><ArrowLeft size={14} />上一篇</span>
|
||||
<span className="pn-note-nav-title">{note.prev.title}</span>
|
||||
</Card>
|
||||
</Link>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
{note.next ? (
|
||||
<Link to={`/notes/${encodeURIComponent(note.next.slug)}`} className="card pn-note-nav-card pn-note-nav-next">
|
||||
<span className="pn-note-nav-label">下一篇<ArrowRight size={14} /></span>
|
||||
<span className="pn-note-nav-title">{note.next.title}</span>
|
||||
<Link to={`/notes/${encodeURIComponent(note.next.slug)}`} className="pn-note-nav-link">
|
||||
<Card className="pn-note-nav-card pn-note-nav-next" styles={{ body: { padding: 0 } }}>
|
||||
<span className="pn-note-nav-label">下一篇<ArrowRight size={14} /></span>
|
||||
<span className="pn-note-nav-title">{note.next.title}</span>
|
||||
</Card>
|
||||
</Link>
|
||||
) : (
|
||||
<span />
|
||||
|
||||
Reference in New Issue
Block a user