refactor: 大量前端页面/组件样式从硬编码颜色迁移到 antd token 主题变量

This commit is contained in:
xiamuceer-j
2026-03-06 14:14:57 +08:00
parent 7c9716b485
commit f1d7975ea4
40 changed files with 1755 additions and 1375 deletions
+9 -7
View File
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { Card, Spin, Alert, Button, Space, Switch, Drawer, message, Progress } from 'antd';
import { Card, Spin, Alert, Button, Space, Switch, Drawer, message, Progress, theme } from 'antd';
import {
ArrowLeftOutlined,
EyeOutlined,
@@ -64,6 +64,8 @@ const ChapterReader: React.FC = () => {
const { chapterId } = useParams<{ chapterId: string }>();
const navigate = useNavigate();
const { token } = theme.useToken();
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [chapter, setChapter] = useState<ChapterData | null>(null);
@@ -303,7 +305,7 @@ const ChapterReader: React.FC = () => {
checkedChildren={<EyeOutlined />}
unCheckedChildren={<EyeInvisibleOutlined />}
/>
<span style={{ fontSize: 13, color: '#666' }}></span>
<span style={{ fontSize: 13, color: token.colorTextSecondary }}></span>
<Button
icon={<MenuOutlined />}
onClick={() => setSidebarVisible(true)}
@@ -319,14 +321,14 @@ const ChapterReader: React.FC = () => {
{analyzing && (
<div style={{ marginTop: 12 }}>
<Progress percent={analysisProgress} size="small" status="active" />
<span style={{ fontSize: 12, color: '#666', marginLeft: 8 }}>
<span style={{ fontSize: 12, color: token.colorTextSecondary, marginLeft: 8 }}>
...
</span>
</div>
)}
{!analyzing && hasAnnotations && annotationsData && (
<div style={{ marginTop: 12, fontSize: 12, color: '#999' }}>
<div style={{ marginTop: 12, fontSize: 12, color: token.colorTextTertiary }}>
{annotationsData.summary.total_annotations}
{annotationsData.summary.hooks > 0 && ` 🎣${annotationsData.summary.hooks}个钩子`}
{annotationsData.summary.foreshadows > 0 &&
@@ -383,7 +385,7 @@ const ChapterReader: React.FC = () => {
)}
{/* 底部翻页按钮 */}
<div style={{ marginTop: 48, paddingTop: 24, borderTop: '1px solid #f0f0f0' }}>
<div style={{ marginTop: 48, paddingTop: 24, borderTop: `1px solid ${token.colorBorderSecondary}` }}>
<Space style={{ width: '100%', justifyContent: 'space-between' }}>
<Button
size="large"
@@ -418,9 +420,9 @@ const ChapterReader: React.FC = () => {
<div
style={{
width: 400,
borderLeft: '1px solid #f0f0f0',
borderLeft: `1px solid ${token.colorBorderSecondary}`,
overflowY: 'auto',
background: '#fafafa',
background: token.colorBgLayout,
}}
>
<MemorySidebar