Commit 1ad904a73a04d6c47296971286d44cc60cebf8b1

Authored by zichun
1 parent e792984d

chore(usr): replace hardcoded colors with CSS design tokens

frontend/src/components/AppShell.tsx
... ... @@ -71,7 +71,7 @@ export default function AppShell() {
71 71 <button
72 72 aria-label={`关闭 ${tab.title}`}
73 73 onClick={e => handleTabClose(e, tab.id)}
74   - style={{ marginLeft: 6, width: 14, height: 14, borderRadius: '50%', border: 'none', background: 'transparent', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontSize: 11, color: '#9aa0a8', cursor: 'pointer', padding: 0 }}
  74 + style={{ marginLeft: 6, width: 14, height: 14, borderRadius: '50%', border: 'none', background: 'transparent', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', fontSize: 11, color: 'var(--color-tab-text)', cursor: 'pointer', padding: 0 }}
75 75 >
76 76
77 77 </button>
... ...
frontend/src/components/NavOverlay.tsx
... ... @@ -41,14 +41,14 @@ export default function NavOverlay({ onClose }: Props) {
41 41 >
42 42 <div onClick={e => e.stopPropagation()} style={{ display: 'flex', flex: 1 }}>
43 43 {/* Left sidebar */}
44   - <div style={{ width: 200, background: '#2b3137', borderRight: '1px solid #1e2226', padding: '8px 0', overflowY: 'auto' }}>
  44 + <div style={{ width: 200, background: 'var(--color-nav-overlay-bg)', borderRight: '1px solid var(--color-nav-sidebar-border)', padding: '8px 0', overflowY: 'auto' }}>
45 45 {LEFT_MODULES.map(mod => (
46 46 <div
47 47 key={mod}
48 48 style={{
49 49 display: 'flex', alignItems: 'center', gap: 10, padding: '11px 18px', fontSize: 14, cursor: 'pointer',
50   - color: mod === '系统设置' ? 'var(--color-tab-active)' : '#d3d6db',
51   - background: mod === '系统设置' ? '#34393f' : 'transparent',
  50 + color: mod === '系统设置' ? 'var(--color-tab-active)' : 'var(--color-nav-item-text)',
  51 + background: mod === '系统设置' ? 'var(--color-nav-sidebar-active-bg)' : 'transparent',
52 52 }}
53 53 >
54 54 {mod}
... ... @@ -59,21 +59,21 @@ export default function NavOverlay({ onClose }: Props) {
59 59 <div style={{ flex: 1, padding: '30px 40px', display: 'grid', gridTemplateColumns: 'repeat(7, 1fr)', gap: '30px 40px', alignContent: 'start', overflowY: 'auto' }}>
60 60 {NAV_COLS.map(col => (
61 61 <div key={col.title}>
62   - <h3 style={{ fontSize: 15, color: '#e8eaee', fontWeight: 500, margin: '0 0 18px', borderBottom: '1px solid #4a4f57', paddingBottom: 10 }}>
  62 + <h3 style={{ fontSize: 15, color: 'var(--color-nav-col-header)', fontWeight: 500, margin: '0 0 18px', borderBottom: '1px solid var(--color-nav-col-divider)', paddingBottom: 10 }}>
63 63 {col.title}
64 64 </h3>
65 65 {col.items.map(item => {
66 66 if (typeof item === 'string') {
67   - return <div key={item} style={{ padding: '7px 0', color: '#cfd3da', fontSize: 14 }}>{item}</div>
  67 + return <div key={item} style={{ padding: '7px 0', color: 'var(--color-nav-item-text)', fontSize: 14 }}>{item}</div>
68 68 }
69 69 return (
70 70 <div
71 71 key={item.label}
72 72 onClick={item.go === 'userlist' ? handleUserList : undefined}
73   - style={{ display: 'flex', alignItems: 'center', gap: 6, padding: '7px 0', color: '#cfd3da', fontSize: 14, cursor: item.go === 'userlist' ? 'pointer' : 'default' }}
  73 + style={{ display: 'flex', alignItems: 'center', gap: 6, padding: '7px 0', color: 'var(--color-nav-item-text)', fontSize: 14, cursor: item.go === 'userlist' ? 'pointer' : 'default' }}
74 74 >
75 75 {item.label}
76   - {item.star && <span style={{ color: '#f3b526' }}>★</span>}
  76 + {item.star && <span style={{ color: 'var(--color-nav-item-star)' }}>★</span>}
77 77 </div>
78 78 )
79 79 })}
... ...
frontend/src/pages/usr/LoginPage.tsx
... ... @@ -43,7 +43,7 @@ export default function LoginPage() {
43 43 }
44 44  
45 45 return (
46   - <div style={{ position: 'absolute', inset: 0, background: '#eaedf2', display: 'flex', flexDirection: 'column' }}>
  46 + <div style={{ position: 'absolute', inset: 0, background: 'var(--color-login-bg)', display: 'flex', flexDirection: 'column' }}>
47 47 {/* Header */}
48 48 <div style={{ display: 'flex', alignItems: 'center', gap: 12, padding: '18px 36px' }}>
49 49 <div style={{ width: 42, height: 42, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
... ... @@ -51,11 +51,11 @@ export default function LoginPage() {
51 51 {ANTLER_PATHS.map((d, i) => <path key={i} d={d} />)}
52 52 </svg>
53 53 </div>
54   - <span style={{ fontSize: 24, fontWeight: 700, color: '#e0a020', letterSpacing: 2 }}>Antler ERP</span>
  54 + <span style={{ fontSize: 24, fontWeight: 700, color: 'var(--color-login-brand)', letterSpacing: 2 }}>Antler ERP</span>
55 55 <span style={{ color: '#444', fontSize: 14, marginLeft: 6 }}>欢迎登录EBC平台</span>
56 56 </div>
57 57 {/* Hero */}
58   - <div style={{ flex: 1, position: 'relative', background: 'radial-gradient(ellipse at center, #1a4ea0 0%, #0a1d44 60%, #050d20 100%)', overflow: 'hidden' }}>
  58 + <div style={{ flex: 1, position: 'relative', background: 'radial-gradient(ellipse at center, var(--color-login-hero-start) 0%, var(--color-login-hero-mid) 60%, var(--color-login-hero-end) 100%)', overflow: 'hidden' }}>
59 59 {/* Brand text */}
60 60 <div style={{ position: 'absolute', left: '8%', top: '35%', color: '#fff', zIndex: 2 }}>
61 61 <div style={{ fontSize: 30, fontWeight: 300, color: '#cfe1ff', marginBottom: 6 }}>Enterprise Business Capability</div>
... ... @@ -84,7 +84,7 @@ export default function LoginPage() {
84 84 </div>
85 85 </div>
86 86 {/* Footer */}
87   - <div style={{ background: '#eaedf2', textAlign: 'center', padding: '14px 8px', color: '#666', fontSize: 12, borderTop: '1px solid #d8dce2' }}>
  87 + <div style={{ background: 'var(--color-login-bg)', textAlign: 'center', padding: '14px 8px', color: 'var(--color-login-text-muted)', fontSize: 12, borderTop: '1px solid var(--color-login-border)' }}>
88 88 🛠 ©Copyright Antler Software | 印刷ERP | 400-880-6237
89 89 </div>
90 90 </div>
... ...
frontend/src/styles/tokens.css
... ... @@ -53,4 +53,21 @@
53 53 --color-table-row-alt: #f7f8fa;
54 54 --color-filterbar-bg: #ffffff;
55 55 --color-nav-overlay-bg: #2b3137;
  56 +
  57 + /* === 4. NavOverlay colors === */
  58 + --color-nav-sidebar-border: #1e2226;
  59 + --color-nav-sidebar-active-bg: #34393f;
  60 + --color-nav-col-header: #e8eaee;
  61 + --color-nav-col-divider: #4a4f57;
  62 + --color-nav-item-text: #cfd3da;
  63 + --color-nav-item-star: #f3b526;
  64 +
  65 + /* === 5. Login hero === */
  66 + --color-login-hero-start: #1a4ea0;
  67 + --color-login-hero-mid: #0a1d44;
  68 + --color-login-hero-end: #050d20;
  69 + --color-login-bg: #eaedf2;
  70 + --color-login-border: #d8dce2;
  71 + --color-login-brand: #e0a020;
  72 + --color-login-text-muted: #666666;
56 73 }
... ...