ui_design.md 13 KB

工业控制台与复古终端 UI 设计规范 (Industrial Command Terminal & Retro Brutalism UI Spec)

本文档定义了本项目的核心视觉语言、交互规范与组件设计体系。所有前台(用户端)与后台(管理端)页面及新组件均须严格遵循此规范,杜绝现代圆角拟物与渐变模糊风格,确保全局一致的高对比度工业硬朗质感。


1. 核心设计哲学 (Design Philosophy)

  1. 工业控制中心 (Industrial Ops Center):
    • 界面整体宛如精密任务调度台与工业终端机。
    • 所有容器边缘均使用清晰坚实的纯黑硬边框,强调结构分块与功能模块的独立性。
  2. 严禁现代柔光与大圆角 (No Soft Shadows & Rounded Corners):
    • 严禁使用 rounded-xl、rounded-2xl、rounded-3xl、rounded-full(除微型状态圆点指示灯外)。
    • 严禁使用带大模糊半径的软阴影(如 shadow-lg, shadow-xl, shadow-indigo-500/20)。
    • 全局统一使用纯黑硬投影 (Hard Drop Shadows),如 shadow-[2px_2px_0px_#000], shadow-[4px_4px_0px_#000], shadow-[8px_8px_0px_#000]。
  3. 等宽与终端美学 (Monospace & Bracket Nomenclature):
    • 标题、模块头部、状态标签、ID、关键数值和配置均使用等宽字体(font-mono)。
    • 采用大写命名与终端中括号格式,如 [ SYSTEM ACCESS // 认证鉴权 ]、[ 01 // 商品与结算状态 ]。
  4. 实体机械按压交互 (Tactile Physical Feedback):
    • 按钮在点击或激活时,位移 +1px ~ +2px 并减少投影,产生如同实体机械开关、琴键按压的即时物理反馈(active:translate-x-0.5 active:translate-y-0.5)。

2. 色彩系统 (Color Palette & Tokens)

色彩角色 Tailwind 类名 实际十六进制 语义与应用场景
基础边框与投影 border-black, shadow-[..._#000] #000000 全局外边框 (2px / 1px)、硬阴影、主要文字
主操作 / 琥珀高光 bg-amber-300, hover:bg-amber-400 #FCD34D / #FBBF24 核心 CTA 按钮、选中状态 Tab、重要指示方块、高亮字段
终端标题栏底色 bg-neutral-200 #E5E5E5 弹窗顶部栏、表格表头、卡片分组头部
模块卡片浅底 bg-neutral-50 / bg-white #FAFAFA / #FFFFFF 卡片容器、表单区块、详情内容区
代码与终端深底 bg-neutral-900 / bg-black #171717 / #000000 代码编辑器、JSON 预览区、调试日志终端
成功 / 激活状态 bg-emerald-300 / bg-emerald-100 #6EE7B7 / #D1FAE5 成功标签、正常在线状态、支付完成印章
警告 / 锁定状态 bg-amber-200 / bg-amber-100 #FDE68A / #FEF3C7 冷却锁定中、待确认、部分可用
危险 / 错误状态 bg-rose-200 / bg-rose-100 #FECDD3 / #FFE4E6 禁用、执行失败、删除确认按钮

3. 标准组件规范 (Component Specifications)

3.1 弹窗与侧边抽屉 (Modals & Drawers)

// 遮罩层 (Mask Overlay)
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-4 font-mono">
  // 弹窗本体 (Modal Box)
  <div className="bg-neutral-50 border-2 border-black shadow-[8px_8px_0px_#000] w-full max-w-lg overflow-hidden flex flex-col animate-in zoom-in-95 duration-200">
    
    {/* 顶部标题栏 */}
    <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
      <div className="flex items-center gap-2">
        <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
        <h3 className="font-black text-black text-xs md:text-sm uppercase tracking-wider">
          [ MODAL TITLE // 模块标题 ]
        </h3>
      </div>
      <button
        onClick={onClose}
        className="w-6 h-6 bg-white hover:bg-amber-300 border border-black flex items-center justify-center font-bold text-xs transition"
      >
        ✕
      </button>
    </div>

    {/* 内容区域 */}
    <div className="p-5 space-y-4 bg-white text-xs">
      {/* 内容卡片 */}
    </div>

    {/* 底部按钮栏 */}
    <div className="px-5 py-3 bg-neutral-200 border-t-2 border-black flex justify-end gap-2 shrink-0">
      <button className="px-4 py-1.5 bg-white hover:bg-neutral-100 border-2 border-black text-xs font-bold uppercase shadow-[2px_2px_0px_#000]">
        [ 取消 ]
      </button>
      <button className="px-5 py-1.5 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black text-xs font-black uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5">
        [ 确认执行 ]
      </button>
    </div>

  </div>
</div>

3.2 按钮体系 (Buttons)

  1. 主要操作按钮 (Primary Action):

    className="px-4 py-2 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 disabled:opacity-50"
    
  2. 次要操作按钮 (Secondary Action):

    className="px-4 py-2 bg-white hover:bg-neutral-100 text-black border-2 border-black font-bold text-xs uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5"
    
  3. 危险/删除按钮 (Danger Action):

    className="px-4 py-2 bg-rose-100 hover:bg-rose-200 text-rose-950 border-2 border-black font-bold text-xs uppercase shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5"
    
  4. 小型表格内操作按钮 (Table Inline Action):

    className="px-2 py-0.5 bg-white hover:bg-neutral-100 border border-black text-[10px] font-bold uppercase shadow-[1px_1px_0px_#000]"
    

3.3 输入框与下拉选择 (Inputs & Form Controls)

{/* 文本输入框 */}
<input
  type="text"
  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] placeholder:text-neutral-400"
  placeholder="请输入参数值..."
/>

{/* 下拉选择框 */}
<select
  className="w-full px-3 py-2 border-2 border-black bg-neutral-50 text-xs font-bold text-black outline-none shadow-[2px_2px_0px_#000]"
>
  <option value="active">🟢 正常可用 (Active)</option>
  <option value="disable">🔴 已禁用 (Disable)</option>
</select>

{/* 多行文本框 */}
<textarea
  rows={5}
  className="w-full p-3 border-2 border-black bg-neutral-50 focus:bg-white text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] resize-none"
/>

3.4 状态印章与标签 (Status Stamps & Badges)

{/* 成功 / 正常印章 */}
<span className="px-1.5 py-0.2 border border-black bg-emerald-300 text-black text-[10px] font-black uppercase">
  [ SUCCESS // 成功 ]
</span>

{/* 运行中 / 高亮印章 */}
<span className="px-1.5 py-0.2 border border-black bg-amber-300 text-black text-[10px] font-black uppercase">
  [ RUNNING // 运行中 ]
</span>

{/* 锁定 / 冷却印章 */}
<span className="px-1.5 py-0.2 border border-black bg-amber-100 text-black text-[10px] font-bold uppercase">
  LOCKED (15m20s)
</span>

{/* 禁用 / 失败印章 */}
<span className="px-1.5 py-0.2 border border-black bg-rose-200 text-rose-950 text-[10px] font-bold uppercase">
  [ FAILED // 失败 ]
</span>

{/* 通用属性标签 */}
<span className="px-1.5 py-0.2 border border-black bg-white text-black font-bold uppercase text-[10px]">
  HTTP
</span>

3.5 表格规范 (Data Tables)

<div className="border-2 border-black bg-white shadow-[4px_4px_0px_#000] font-mono overflow-hidden">
  <div className="overflow-x-auto">
    <table className="w-full text-left text-xs border-collapse">
      <thead>
        <tr className="border-b-2 border-black bg-neutral-200 text-black uppercase font-black">
          <th className="p-3">ID // 名称</th>
          <th className="p-3">状态</th>
          <th className="p-3 text-right">操作</th>
        </tr>
      </thead>
      <tbody className="divide-y-2 divide-black">
        <tr className="hover:bg-amber-50/50 transition">
          <td className="p-3 font-bold text-black">#001</td>
          <td className="p-3">
            <span className="px-1.5 py-0.2 border border-black bg-emerald-300 text-black font-black uppercase text-[10px]">
              正常可用
            </span>
          </td>
          <td className="p-3 text-right">
            <button className="px-2 py-0.5 bg-amber-300 hover:bg-amber-400 border border-black text-[10px] font-black uppercase shadow-[1px_1px_0px_#000]">
              编辑
            </button>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

3.6 分页控件规范 (Pagination)

<div className="flex items-center justify-between border-2 border-black bg-neutral-100 px-4 py-2.5 font-mono text-xs shadow-[2px_2px_0px_#000] mt-4">
  {/* 统计提示 */}
  <div className="text-neutral-700 font-bold">
    显示第 <span className="font-mono text-black font-black">1</span> 至 <span className="font-mono text-black font-black">20</span> 条,共 <span className="font-mono text-black font-black">100</span> 条
  </div>
  
  {/* 分页按钮组 */}
  <div className="flex items-center gap-1">
    <button className="px-2.5 py-1 bg-white hover:bg-neutral-200 border border-black font-bold uppercase shadow-[1px_1px_0px_#000] disabled:opacity-40">
      [ 上一页 ]
    </button>
    <button className="px-2.5 py-1 bg-amber-300 border border-black font-black uppercase shadow-[1px_1px_0px_#000]">
      1
    </button>
    <button className="px-2.5 py-1 bg-white hover:bg-neutral-200 border border-black font-bold uppercase shadow-[1px_1px_0px_#000]">
      2
    </button>
    <button className="px-2.5 py-1 bg-white hover:bg-neutral-200 border border-black font-bold uppercase shadow-[1px_1px_0px_#000] disabled:opacity-40">
      [ 下一页 ]
    </button>
  </div>
</div>

3.7 JSON 编辑与预览终端规范 (JSON Editor & Viewer)

// 轻量级 / 弹窗内 JSON 编辑器 (JsonEditor)
<div className="w-full font-mono text-xs select-none">
  {/* 顶部控制栏 */}
  <div className="flex items-center justify-between px-3 py-2 bg-neutral-200 border-2 border-black border-b-0">
    <div className="flex items-center gap-2">
      <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
      <span className="font-black text-black uppercase">[ JSON TERMINAL // 参数视窗 ]</span>
      <span className="px-1.5 py-0.2 border border-black text-[10px] font-black uppercase bg-emerald-300 text-black">
        VALID
      </span>
    </div>
    <div className="flex items-center gap-1">
      <button className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[11px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase">
        [ 格式化 ]
      </button>
      <button className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[11px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase">
        [ 压缩 ]
      </button>
      <button className="px-2 py-1 bg-white hover:bg-neutral-100 text-black border border-black text-[11px] font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase">
        [ 复制 ]
      </button>
    </div>
  </div>

  {/* 终端代码视窗 */}
  <div className="border-2 border-black shadow-[4px_4px_0px_#000]">
    <textarea
      className="w-full p-3 font-mono text-xs leading-relaxed outline-none bg-neutral-900 text-neutral-100 resize-y"
      rows={8}
      placeholder="{}"
    />
  </div>
</div>

4. 关键准则总结 (Do's and Don'ts)

✅ 正确做法 (DO's)

  • 所有独立卡片与弹窗一律使用 border-2 border-black 以及硬阴影 shadow-[4px_4px_0px_#000] 或 shadow-[8px_8px_0px_#000]。
  • 主视觉强调一律使用琥珀黄 #FCD34D(bg-amber-300)配合纯黑文字。
  • 代码、JSON、日志一律使用 bg-neutral-900 text-neutral-100 或 bg-neutral-950 text-emerald-400。
  • 模块标题统一格式:[ MODULE // SUBTITLE ] 或 [ 01 // SECTION NAME ]。

❌ 严禁出现 (DON'Ts)

  • ❌ 严禁使用任何形式的大圆角(如 rounded-xl, rounded-2xl)。
  • ❌ 严禁使用弥散性/模糊彩色阴影(如 shadow-lg, shadow-blue-500/20)。
  • ❌ 严禁使用渐变色文字或渐变背景(如 bg-gradient-to-r)。
  • ❌ 严禁使用过细字体(如 font-light, font-thin),正文与标签统一使用 Medium、Bold、Black。