1
0

style: 优化前端样式,提升现代化设计感

- ConfigProvider 注入全局配置(动画、表格尺寸)
- CSS Variables 主题微调(页面背景、圆角、字体栈)
- AppLayout Menu 支持 logo/operations/collapsed
- Statistic 组件增加 color/prefix/suffix/animation
- Card 组件启用 hoverShadow/headerBordered
- Table 组件启用 stripe 斑马纹
- Tag 组件使用 variant="light" + shape="round"
- Dialog 居中显示并设置固定宽度
- 布局样式硬编码颜色替换为 TDesign Token
- UsageChart 改用 AreaChart + 渐变填充
- 更新 frontend spec 同步样式体系要求
This commit is contained in:
2026-04-22 18:09:22 +08:00
parent f5e45d032e
commit 5ae9d85272
16 changed files with 479 additions and 321 deletions

View File

@@ -1,5 +1,6 @@
import { Layout, Menu } from 'tdesign-react';
import { ServerIcon, ChartLineIcon, SettingIcon } from 'tdesign-icons-react';
import { useState } from 'react';
import { Layout, Menu, Button } from 'tdesign-react';
import { ServerIcon, ChartLineIcon, SettingIcon, ChevronLeftIcon, ChevronRightIcon } from 'tdesign-icons-react';
import { Outlet, useLocation, useNavigate } from 'react-router';
const { MenuItem } = Menu;
@@ -7,6 +8,7 @@ const { MenuItem } = Menu;
export function AppLayout() {
const location = useLocation();
const navigate = useNavigate();
const [collapsed, setCollapsed] = useState(false);
const getPageTitle = () => {
if (location.pathname === '/providers') return '供应商管理';
@@ -15,10 +17,12 @@ export function AppLayout() {
return 'AI Gateway';
};
const asideWidth = collapsed ? '64px' : '232px';
return (
<Layout style={{ minHeight: '100vh' }}>
<Layout.Aside
width="232px"
width={asideWidth}
style={{
overflow: 'hidden',
height: '100vh',
@@ -28,45 +32,52 @@ export function AppLayout() {
bottom: 0,
}}
>
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
<div
style={{
<Menu
value={location.pathname}
onChange={(value) => navigate(value as string)}
collapsed={collapsed}
width={['232px', '64px']}
logo={
<div style={{
height: 64,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: '1.25rem',
fontWeight: 600,
flexShrink: 0,
}}
>
AI Gateway
</div>
<Menu
value={location.pathname}
onChange={(value) => navigate(value as string)}
style={{ flex: 1, overflow: 'auto' }}
>
<MenuItem value="/providers" icon={<ServerIcon />}>
</MenuItem>
<MenuItem value="/stats" icon={<ChartLineIcon />}>
</MenuItem>
<MenuItem value="/settings" icon={<SettingIcon />}>
</MenuItem>
</Menu>
</div>
}}>
{!collapsed && 'AI Gateway'}
</div>
}
operations={
<Button
variant="text"
shape="square"
icon={collapsed ? <ChevronRightIcon /> : <ChevronLeftIcon />}
onClick={() => setCollapsed(!collapsed)}
/>
}
style={{ height: '100%' }}
>
<MenuItem value="/providers" icon={<ServerIcon />}>
</MenuItem>
<MenuItem value="/stats" icon={<ChartLineIcon />}>
</MenuItem>
<MenuItem value="/settings" icon={<SettingIcon />}>
</MenuItem>
</Menu>
</Layout.Aside>
<Layout style={{ marginLeft: 232 }}>
<Layout style={{ marginLeft: asideWidth }}>
<Layout.Header
style={{
padding: '0 2rem',
background: '#fff',
background: 'var(--td-bg-color-container)',
display: 'flex',
alignItems: 'center',
borderBottom: '1px solid #e7e7e7',
borderBottom: '1px solid var(--td-component-stroke)',
}}
>
<h1 style={{ margin: 0, fontSize: '1.25rem' }}>{getPageTitle()}</h1>