refactor(admin): 替换硬编码 gray/white 为设计 token(login + layout)

- login/page.tsx、admin-layout.tsx 全部 Tailwind gray-* / bg-white / bg-black/50 映射至语义 token
- 深色面板(bg-gray-900/800 激活态、头像、登录按钮)映射 bg-dark-bg / bg-dark-bg-secondary,保持两模式深色
- 深色面板上的文字用 text-dark-text-primary(固定亮色),规避 text-white 在暗黑模式反色为暗的陷阱
- 遮罩 bg-black/50 → bg-overlay/50(独立 token,不随反色)
- 验证: type-check 0 / lint 0 / 产物 CSS 已含全部映射类
This commit is contained in:
2026-08-31 21:38:44 +08:00
parent 70fdb97dd8
commit 860a7f454a
2 changed files with 31 additions and 31 deletions
+11 -11
View File
@@ -30,32 +30,32 @@ export default function AdminLoginPage() {
};
return (
<div className="min-h-screen bg-gray-50 flex items-center justify-center p-4">
<div className="min-h-screen bg-bg-secondary flex items-center justify-center p-4">
<div className="w-full max-w-md">
<div className="text-center mb-8">
<h1 className="text-2xl font-bold text-gray-900">Novalon CMS</h1>
<p className="text-sm text-gray-500 mt-1">内容管理系统</p>
<h1 className="text-2xl font-bold text-text-primary">Novalon CMS</h1>
<p className="text-sm text-text-muted mt-1">内容管理系统</p>
</div>
<form
onSubmit={handleSubmit}
className="bg-white rounded-xl shadow-sm border border-gray-200 p-6 space-y-5"
className="bg-bg-primary rounded-xl shadow-sm border border-border-primary p-6 space-y-5"
>
{error && (
<div className="bg-red-50 border border-red-200 text-red-700 rounded-lg px-4 py-3 text-sm">
<div className="bg-error-bg border border-border-secondary text-error rounded-lg px-4 py-3 text-sm">
{error}
</div>
)}
<div>
<label className="block text-sm font-medium text-gray-700 mb-1.5">
<label className="block text-sm font-medium text-text-secondary mb-1.5">
用户名
</label>
<input
type="text"
value={username}
onChange={(e) => setUsername(e.target.value)}
className="w-full px-3 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-shadow"
className="w-full px-3 py-2.5 border border-border-secondary rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-border-dark focus:border-transparent transition-shadow"
placeholder="请输入用户名"
required
autoFocus
@@ -63,7 +63,7 @@ export default function AdminLoginPage() {
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1.5">
<label className="block text-sm font-medium text-text-secondary mb-1.5">
密码
</label>
<div className="relative">
@@ -71,14 +71,14 @@ export default function AdminLoginPage() {
type={showPassword ? 'text' : 'password'}
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full px-3 py-2.5 pr-10 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-shadow"
className="w-full px-3 py-2.5 pr-10 border border-border-secondary rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-border-dark focus:border-transparent transition-shadow"
placeholder="请输入密码"
required
/>
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600"
className="absolute right-3 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-tertiary"
>
{showPassword ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
</button>
@@ -88,7 +88,7 @@ export default function AdminLoginPage() {
<button
type="submit"
disabled={loading}
className="w-full flex items-center justify-center gap-2 bg-gray-900 text-white rounded-lg py-2.5 text-sm font-medium hover:bg-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
className="w-full flex items-center justify-center gap-2 bg-dark-bg text-dark-text-primary rounded-lg py-2.5 text-sm font-medium hover:bg-dark-bg-secondary disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
>
{loading ? (
<span className="animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full" />