Commit 1ad904a73a04d6c47296971286d44cc60cebf8b1
1 parent
e792984d
chore(usr): replace hardcoded colors with CSS design tokens
Showing
4 changed files
with
29 additions
and
12 deletions
frontend/src/components/AppShell.tsx
| @@ -71,7 +71,7 @@ export default function AppShell() { | @@ -71,7 +71,7 @@ export default function AppShell() { | ||
| 71 | <button | 71 | <button |
| 72 | aria-label={`关闭 ${tab.title}`} | 72 | aria-label={`关闭 ${tab.title}`} |
| 73 | onClick={e => handleTabClose(e, tab.id)} | 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 | </button> | 77 | </button> |
frontend/src/components/NavOverlay.tsx
| @@ -41,14 +41,14 @@ export default function NavOverlay({ onClose }: Props) { | @@ -41,14 +41,14 @@ export default function NavOverlay({ onClose }: Props) { | ||
| 41 | > | 41 | > |
| 42 | <div onClick={e => e.stopPropagation()} style={{ display: 'flex', flex: 1 }}> | 42 | <div onClick={e => e.stopPropagation()} style={{ display: 'flex', flex: 1 }}> |
| 43 | {/* Left sidebar */} | 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 | {LEFT_MODULES.map(mod => ( | 45 | {LEFT_MODULES.map(mod => ( |
| 46 | <div | 46 | <div |
| 47 | key={mod} | 47 | key={mod} |
| 48 | style={{ | 48 | style={{ |
| 49 | display: 'flex', alignItems: 'center', gap: 10, padding: '11px 18px', fontSize: 14, cursor: 'pointer', | 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 | {mod} | 54 | {mod} |
| @@ -59,21 +59,21 @@ export default function NavOverlay({ onClose }: Props) { | @@ -59,21 +59,21 @@ export default function NavOverlay({ onClose }: Props) { | ||
| 59 | <div style={{ flex: 1, padding: '30px 40px', display: 'grid', gridTemplateColumns: 'repeat(7, 1fr)', gap: '30px 40px', alignContent: 'start', overflowY: 'auto' }}> | 59 | <div style={{ flex: 1, padding: '30px 40px', display: 'grid', gridTemplateColumns: 'repeat(7, 1fr)', gap: '30px 40px', alignContent: 'start', overflowY: 'auto' }}> |
| 60 | {NAV_COLS.map(col => ( | 60 | {NAV_COLS.map(col => ( |
| 61 | <div key={col.title}> | 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 | {col.title} | 63 | {col.title} |
| 64 | </h3> | 64 | </h3> |
| 65 | {col.items.map(item => { | 65 | {col.items.map(item => { |
| 66 | if (typeof item === 'string') { | 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 | return ( | 69 | return ( |
| 70 | <div | 70 | <div |
| 71 | key={item.label} | 71 | key={item.label} |
| 72 | onClick={item.go === 'userlist' ? handleUserList : undefined} | 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 | {item.label} | 75 | {item.label} |
| 76 | - {item.star && <span style={{ color: '#f3b526' }}>★</span>} | 76 | + {item.star && <span style={{ color: 'var(--color-nav-item-star)' }}>★</span>} |
| 77 | </div> | 77 | </div> |
| 78 | ) | 78 | ) |
| 79 | })} | 79 | })} |
frontend/src/pages/usr/LoginPage.tsx
| @@ -43,7 +43,7 @@ export default function LoginPage() { | @@ -43,7 +43,7 @@ export default function LoginPage() { | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | return ( | 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 | {/* Header */} | 47 | {/* Header */} |
| 48 | <div style={{ display: 'flex', alignItems: 'center', gap: 12, padding: '18px 36px' }}> | 48 | <div style={{ display: 'flex', alignItems: 'center', gap: 12, padding: '18px 36px' }}> |
| 49 | <div style={{ width: 42, height: 42, display: 'flex', alignItems: 'center', justifyContent: 'center' }}> | 49 | <div style={{ width: 42, height: 42, display: 'flex', alignItems: 'center', justifyContent: 'center' }}> |
| @@ -51,11 +51,11 @@ export default function LoginPage() { | @@ -51,11 +51,11 @@ export default function LoginPage() { | ||
| 51 | {ANTLER_PATHS.map((d, i) => <path key={i} d={d} />)} | 51 | {ANTLER_PATHS.map((d, i) => <path key={i} d={d} />)} |
| 52 | </svg> | 52 | </svg> |
| 53 | </div> | 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 | <span style={{ color: '#444', fontSize: 14, marginLeft: 6 }}>欢迎登录EBC平台</span> | 55 | <span style={{ color: '#444', fontSize: 14, marginLeft: 6 }}>欢迎登录EBC平台</span> |
| 56 | </div> | 56 | </div> |
| 57 | {/* Hero */} | 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 | {/* Brand text */} | 59 | {/* Brand text */} |
| 60 | <div style={{ position: 'absolute', left: '8%', top: '35%', color: '#fff', zIndex: 2 }}> | 60 | <div style={{ position: 'absolute', left: '8%', top: '35%', color: '#fff', zIndex: 2 }}> |
| 61 | <div style={{ fontSize: 30, fontWeight: 300, color: '#cfe1ff', marginBottom: 6 }}>Enterprise Business Capability</div> | 61 | <div style={{ fontSize: 30, fontWeight: 300, color: '#cfe1ff', marginBottom: 6 }}>Enterprise Business Capability</div> |
| @@ -84,7 +84,7 @@ export default function LoginPage() { | @@ -84,7 +84,7 @@ export default function LoginPage() { | ||
| 84 | </div> | 84 | </div> |
| 85 | </div> | 85 | </div> |
| 86 | {/* Footer */} | 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 | 🛠 ©Copyright Antler Software | 印刷ERP | 400-880-6237 | 88 | 🛠 ©Copyright Antler Software | 印刷ERP | 400-880-6237 |
| 89 | </div> | 89 | </div> |
| 90 | </div> | 90 | </div> |
frontend/src/styles/tokens.css
| @@ -53,4 +53,21 @@ | @@ -53,4 +53,21 @@ | ||
| 53 | --color-table-row-alt: #f7f8fa; | 53 | --color-table-row-alt: #f7f8fa; |
| 54 | --color-filterbar-bg: #ffffff; | 54 | --color-filterbar-bg: #ffffff; |
| 55 | --color-nav-overlay-bg: #2b3137; | 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 | } |