1
0

feat: 实现多主题系统,支持6套主题切换和设置页面

重构 ThemeContext 为多主题模型(themeId + followSystem + systemIsDark),
新增设置页面(主题下拉栏 + 跟随系统开关),移除旧 ThemeToggle 按钮,
引入 antd-style 和 clsx 依赖支持 MUI/shadcn/Bootstrap/玻璃主题。
This commit is contained in:
2026-04-17 00:06:08 +08:00
parent c5b3d9dfc7
commit ddd284c1ca
21 changed files with 1609 additions and 153 deletions

View File

@@ -0,0 +1,40 @@
import { Card, Select, Switch, Space, Typography } from 'antd';
import { useTheme } from '@/contexts/ThemeContext';
import { themeOptions, type ThemeId } from '@/themes';
const { Text } = Typography;
export function SettingsPage() {
const { themeId, followSystem, setThemeId, setFollowSystem } = useTheme();
return (
<Space direction="vertical" size="large" style={{ width: '100%' }}>
<Card title="主题">
<Space direction="vertical" size="middle" style={{ width: '100%' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<Text strong></Text>
</div>
<Select
value={themeId}
onChange={(value: ThemeId) => setThemeId(value)}
style={{ width: 180 }}
options={themeOptions.map((opt) => ({
value: opt.id,
label: opt.label,
}))}
/>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div>
<Text strong></Text>
<br />
<Text type="secondary"></Text>
</div>
<Switch checked={followSystem} onChange={setFollowSystem} />
</div>
</Space>
</Card>
</Space>
);
}