[CLAUDE] FE-User: redesign density-first theo UI/UX guide AI_INFRA — giữ brand SOLUTION (S58)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 4m30s

Anh yêu cầu sau /check-email ai_infra (guide canonical 13 mục "Surgical
Precision Minimalism", anh-approved 06-11): chỉnh giao diện eoffice giống
guide, GIỮ nhận dạng thương hiệu SOLUTION.

14 file fe-user, visual-only (mirror design system fe-admin S55 + đối chiếu
guide; fe-admin/BE untouched):
- index.css: heading ladder semibold (bỏ font-bold) + .label-eyebrow uppercase
  + tnum note. 6 ui primitives (Button/Input/Label/Select/Textarea/Dialog):
  text-xs font-semibold, control h28-40, rounded-lg, focus ring brand-500,
  bỏ shadow trang trí — variant/size keys + props/forwardRef STABLE.
- 6 shell: DataTable (thead sticky + density px-3 py-2 + tnum + RowActions/
  RowActionButton ADDITIVE luôn-hiện không opacity-hover) / Layout (active
  leaf brand left-rail, logic nav/permission nguyên) / TopBar / PageHeader /
  PhaseBadge (ring-current/15) / EmptyState. + LoginPage polish nhẹ.
- BRAND GIỮ: #1F7DC1 (brand-*) + Be Vietnam Pro + neutral slate (guide cho
  plug hue riêng — chia sẻ grammar, không chia sẻ vocabulary-màu).

Verify: npm build ×2 PASS 0 TS err (fe-user 443ms + fe-admin 8.9s untouched-
confirm). Diff-review từng file: functionality keys stable, additive-only.
frontend-designer return-truncated gotcha #53 giữa FD2 screenshot → em main
disk-recover + self-gate (precedent S55); visual live-check sau deploy.

Email AI_INFRA 2026-06-11-ui-ux-design-guide: inbox copy verified hash ✓✓
(whole-file + body), processed sau commit này.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-06-11 13:51:10 +07:00
parent 6c5fd26428
commit e959f72916
16 changed files with 188 additions and 59 deletions

View File

@ -1,4 +1,4 @@
import type { ReactNode } from 'react'
import type { ButtonHTMLAttributes, ReactNode } from 'react'
import { ChevronDown, ChevronUp } from 'lucide-react'
import { cn } from '@/lib/cn'
@ -11,6 +11,50 @@ export type Column<T> = {
align?: 'left' | 'center' | 'right'
}
// Always-visible row-action button (NAMGROUP convention: NEVER hide actions
// behind opacity-0 group-hover — touch devices can't reveal them). 7×7 icon
// button, tone-tinted hover. Wrap an action cell with <RowActions> to stop the
// row's onClick from firing when a button is pressed.
type RowActionTone = 'default' | 'brand' | 'danger' | 'success'
const ROW_ACTION_TONE: Record<RowActionTone, string> = {
default: 'text-slate-500 hover:bg-slate-100 hover:text-slate-800',
brand: 'text-slate-500 hover:bg-brand-50 hover:text-brand-700',
danger: 'text-slate-500 hover:bg-red-50 hover:text-red-600',
success: 'text-slate-500 hover:bg-emerald-50 hover:text-emerald-600',
}
export function RowActions({ children, className }: { children: ReactNode; className?: string }) {
return (
<div
className={cn('flex items-center justify-end gap-0.5', className)}
onClick={e => e.stopPropagation()}
>
{children}
</div>
)
}
export function RowActionButton({
tone = 'default',
className,
...props
}: ButtonHTMLAttributes<HTMLButtonElement> & { tone?: RowActionTone }) {
return (
<button
type="button"
className={cn(
'inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/60',
'disabled:pointer-events-none disabled:opacity-40',
ROW_ACTION_TONE[tone],
className,
)}
{...props}
/>
)
}
type Props<T> = {
columns: Column<T>[]
rows: T[]
@ -35,15 +79,16 @@ export function DataTable<T>({
onRowClick,
}: Props<T>) {
return (
<div className="overflow-auto rounded-xl border border-slate-200/80 bg-white shadow-sm">
<table className="w-full text-sm">
<thead className="bg-slate-50/60 text-slate-600">
<tr className="border-b border-slate-200/80">
// Density-first: rounded-lg + crisp border (no decorative shadow).
<div className="overflow-auto rounded-lg border border-slate-200 bg-white">
<table className="w-full text-[12px]">
<thead className="sticky top-0 z-10 bg-slate-50 text-slate-500">
<tr className="border-b border-slate-200">
{columns.map(c => (
<th
key={c.key}
className={cn(
'px-4 py-2.5 text-[11px] font-semibold uppercase tracking-wider',
'px-3 py-2 text-[11px] font-semibold uppercase tracking-wider',
c.align === 'right' && 'text-right',
c.align === 'center' && 'text-center',
c.align !== 'right' && c.align !== 'center' && 'text-left',
@ -70,7 +115,7 @@ export function DataTable<T>({
Array.from({ length: 5 }).map((_, i) => (
<tr key={`sk-${i}`} className="border-t border-slate-100">
{columns.map(c => (
<td key={c.key} className="px-4 py-3">
<td key={c.key} className="px-3 py-2.5">
<div className="h-3 animate-pulse rounded bg-slate-100" />
</td>
))}
@ -78,7 +123,7 @@ export function DataTable<T>({
))}
{!isLoading && rows.length === 0 && (
<tr>
<td colSpan={columns.length} className="px-4 py-12 text-center text-sm text-slate-400">
<td colSpan={columns.length} className="px-3 py-12 text-center text-[13px] text-slate-400">
{empty ?? 'Không có dữ liệu'}
</td>
</tr>
@ -97,7 +142,7 @@ export function DataTable<T>({
<td
key={c.key}
className={cn(
'px-4 py-2.5',
'px-3 py-2',
c.align === 'right' && 'text-right',
c.align === 'center' && 'text-center',
)}
@ -126,25 +171,25 @@ export function Pagination({ page, pageSize, total, onChange }: PaginationProps)
const to = Math.min(page * pageSize, total)
return (
<div className="flex items-center justify-between py-3 text-sm text-slate-600">
<span>
<div className="flex items-center justify-between py-3 text-[12px] text-slate-500">
<span className="tabular-nums">
{from}{to} / {total}
</span>
<div className="flex gap-1">
<div className="flex items-center gap-1">
<button
disabled={page <= 1}
onClick={() => onChange(page - 1)}
className="rounded-md border border-slate-300 bg-white px-3 py-1 disabled:opacity-50"
className="rounded-lg border border-slate-300 bg-white px-2.5 py-1 font-medium text-slate-700 transition-colors hover:bg-slate-50 disabled:opacity-40 disabled:hover:bg-white"
>
Trước
</button>
<span className="px-3 py-1">
<span className="px-2 tabular-nums">
Trang {page}/{totalPages}
</span>
<button
disabled={page >= totalPages}
onClick={() => onChange(page + 1)}
className="rounded-md border border-slate-300 bg-white px-3 py-1 disabled:opacity-50"
className="rounded-lg border border-slate-300 bg-white px-2.5 py-1 font-medium text-slate-700 transition-colors hover:bg-slate-50 disabled:opacity-40 disabled:hover:bg-white"
>
Sau
</button>

View File

@ -17,12 +17,12 @@ export function EmptyState({
return (
<div className={cn('flex flex-col items-center justify-center gap-2 py-10 text-center', className)}>
{Icon && (
<div className="rounded-full bg-slate-100 p-3 text-slate-400">
<Icon className="h-6 w-6" />
<div className="rounded-xl bg-slate-100 p-2.5 text-slate-400">
<Icon className="h-5 w-5" />
</div>
)}
<div className="text-sm font-medium text-slate-700">{title}</div>
{description && <div className="max-w-sm text-xs text-slate-400">{description}</div>}
<div className="text-[13px] font-semibold text-slate-700">{title}</div>
{description && <div className="max-w-sm text-xs leading-relaxed text-slate-500">{description}</div>}
{action && <div className="mt-2">{action}</div>}
</div>
)

View File

@ -296,10 +296,12 @@ function MenuLeaf({ node, depth }: { node: MenuNode; depth: number }) {
to={path}
title={effectiveLabel(node)}
className={cn(
'block rounded-md leading-snug transition',
isDeep ? 'px-3 py-1 text-[11px]' : 'px-3 py-2 text-[12px] font-medium',
// Density-first: active leaf gets a brand left-rail + tint (crisp
// selected affordance, NAMGROUP). Inactive stays quiet slate.
'relative block rounded-md leading-snug transition-colors',
isDeep ? 'px-3 py-1 text-[11px]' : 'px-3 py-1.5 text-[12px] font-medium',
isActive
? 'bg-brand-50 text-brand-700'
? 'bg-brand-50 font-semibold text-brand-700 before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-brand-600'
: 'text-slate-600 hover:bg-slate-100 hover:text-slate-900',
)}
>
@ -333,8 +335,10 @@ function StaticLeaf({ node }: { node: MenuNode }) {
title={effectiveLabel(node)}
className={({ isActive }) =>
cn(
'block rounded-md px-3 py-2 text-[12px] font-medium leading-snug transition',
isActive ? 'bg-brand-50 text-brand-700' : 'text-slate-600 hover:bg-slate-100 hover:text-slate-900',
'relative block rounded-md px-3 py-1.5 text-[12px] font-medium leading-snug transition-colors',
isActive
? 'bg-brand-50 font-semibold text-brand-700 before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-brand-600'
: 'text-slate-600 hover:bg-slate-100 hover:text-slate-900',
)
}
>

View File

@ -10,10 +10,12 @@ export function PageHeader({
actions?: ReactNode
}) {
return (
<div className="mb-6 flex items-start justify-between gap-6 border-b border-slate-200/70 pb-5">
// Density-first (NAMGROUP): compact one-line header, text-[15px] semibold,
// tighter bottom rule. Toolbar/actions sit inline on the right.
<div className="mb-5 flex items-start justify-between gap-6 border-b border-slate-200 pb-3.5">
<div className="min-w-0">
<h1 className="text-[22px] font-bold leading-tight text-slate-900">{title}</h1>
{description && <p className="mt-1.5 text-[13px] leading-relaxed text-slate-500">{description}</p>}
<h1 className="text-[15px] font-semibold leading-tight text-slate-800">{title}</h1>
{description && <p className="mt-1 text-xs leading-relaxed text-slate-500">{description}</p>}
</div>
{actions && <div className="flex shrink-0 items-center gap-2">{actions}</div>}
</div>

View File

@ -1,9 +1,18 @@
import { cn } from '@/lib/cn'
import { ContractPhaseColor, ContractPhaseLabel } from '@/types/contracts'
// Density-first status pill (NAMGROUP convention): rounded-full, ring-bordered,
// 11px semibold. Tint + text colour come from ContractPhaseColor (bg-{c}-100 /
// text-{c}-700); a matching inset ring crisps the edge without a new colour map.
export function PhaseBadge({ phase, className }: { phase: number; className?: string }) {
return (
<span className={cn('inline-flex rounded-full px-2 py-0.5 text-xs font-medium', ContractPhaseColor[phase], className)}>
<span
className={cn(
'inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ring-1 ring-inset ring-current/15',
ContractPhaseColor[phase],
className,
)}
>
{ContractPhaseLabel[phase]}
</span>
)

View File

@ -32,7 +32,7 @@ function UserMenu() {
onClick={() => setOpen(o => !o)}
className="flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition hover:bg-slate-100"
>
<span className="flex h-7 w-7 items-center justify-center rounded-full bg-brand-100 text-xs font-bold text-brand-700">
<span className="flex h-7 w-7 items-center justify-center rounded-full bg-brand-100 text-[11px] font-semibold text-brand-700">
{initials}
</span>
<span className="hidden max-w-32 truncate text-slate-700 md:inline">{user?.fullName ?? user?.email}</span>

View File

@ -2,21 +2,26 @@ import { forwardRef, type ButtonHTMLAttributes } from 'react'
import { cva, type VariantProps } from 'class-variance-authority'
import { cn } from '@/lib/cn'
// Density-first (NAMGROUP convention): text-xs font-semibold, compact heights,
// rounded-lg. Brand identity kept — primary = brand-600, focus ring brand-500.
// Decorative shadow dropped; only the filled actions keep a 1px tint shadow for
// affordance. Variant keys (primary/secondary/outline/ghost/danger) + size keys
// (sm/md/lg) are STABLE — call-sites depend on them.
const buttonVariants = cva(
'inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-white focus-visible:ring-brand-500 active:translate-y-[0.5px]',
'inline-flex items-center justify-center gap-1.5 rounded-lg text-xs font-semibold transition-colors disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-white focus-visible:ring-brand-500/70 active:translate-y-[0.5px]',
{
variants: {
variant: {
primary: 'bg-brand-600 text-white shadow-sm shadow-brand-600/20 hover:bg-brand-700',
secondary: 'bg-slate-100 text-slate-800 hover:bg-slate-200',
outline: 'border border-slate-300 bg-white text-slate-700 shadow-sm hover:bg-slate-50 hover:border-slate-400',
primary: 'bg-brand-600 text-white shadow-xs shadow-brand-700/20 hover:bg-brand-700',
secondary: 'bg-slate-100 text-slate-700 hover:bg-slate-200',
outline: 'border border-slate-300 bg-white text-slate-700 hover:bg-slate-50 hover:border-slate-400',
ghost: 'text-slate-600 hover:bg-slate-100 hover:text-slate-900',
danger: 'bg-red-600 text-white shadow-sm shadow-red-600/20 hover:bg-red-700',
danger: 'bg-red-600 text-white shadow-xs shadow-red-700/20 hover:bg-red-700',
},
size: {
sm: 'h-8 px-3 text-xs',
md: 'h-9 px-4',
lg: 'h-11 px-6 text-base',
sm: 'h-7 px-2.5',
md: 'h-8 px-3.5',
lg: 'h-10 px-5 text-sm',
},
},
defaultVariants: { variant: 'primary', size: 'md' },

View File

@ -24,10 +24,11 @@ export function Dialog({ open, onClose, title, children, footer, size = 'md' }:
if (!open) return null
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4" onClick={onClose}>
<div className="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4 backdrop-blur-[1px]" onClick={onClose}>
<div
className={cn(
'w-full rounded-lg bg-white shadow-xl',
// Density-first: ring-bordered card, restrained shadow (no decorative shadow-xl).
'w-full rounded-xl bg-white shadow-lg ring-1 ring-slate-900/5',
size === 'sm' && 'max-w-md',
size === 'md' && 'max-w-xl',
size === 'lg' && 'max-w-3xl',
@ -35,13 +36,17 @@ export function Dialog({ open, onClose, title, children, footer, size = 'md' }:
onClick={e => e.stopPropagation()}
>
<div className="flex items-center justify-between border-b border-slate-200 px-5 py-3">
<div className="text-base font-semibold text-slate-900">{title}</div>
<button onClick={onClose} className="rounded p-1 text-slate-500 hover:bg-slate-100">
<div className="text-sm font-semibold text-slate-800">{title}</div>
<button
onClick={onClose}
aria-label="Đóng"
className="-mr-1 rounded-md p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700"
>
<X className="h-4 w-4" />
</button>
</div>
<div className="max-h-[70vh] overflow-auto p-5">{children}</div>
{footer && <div className="flex items-center justify-end gap-2 border-t border-slate-200 px-5 py-3">{footer}</div>}
<div className="max-h-[70vh] overflow-auto px-5 py-4">{children}</div>
{footer && <div className="flex items-center justify-end gap-2 border-t border-slate-200 bg-slate-50/70 px-5 py-3">{footer}</div>}
</div>
</div>
)

View File

@ -7,9 +7,10 @@ export const Input = forwardRef<HTMLInputElement, Props>(({ className, ...props
<input
ref={ref}
className={cn(
'h-9 w-full rounded-md border border-slate-300 bg-white px-3 text-sm text-slate-900',
'shadow-[inset_0_1px_0_rgba(15,23,42,0.02)] placeholder:text-slate-400',
'transition-[border-color,box-shadow] focus-visible:border-brand-500 focus-visible:ring-2 focus-visible:ring-brand-500/20',
// Density-first: compact (~34px) rounded-lg, brand focus glow at low opacity.
'h-8 w-full rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-sm text-slate-900',
'placeholder:text-slate-400',
'transition-[border-color,box-shadow] focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-500/15',
'disabled:cursor-not-allowed disabled:bg-slate-50 disabled:opacity-70',
className,
)}

View File

@ -1,10 +1,13 @@
import type { LabelHTMLAttributes } from 'react'
import { cn } from '@/lib/cn'
// Density-first ERP scan-pattern (NAMGROUP convention): uppercase + tracking +
// muted. slate-500 (not 400) so 11px label still clears WCAG-AA (~4.6:1) — a
// deliberate accessibility-floor deviation from NAMGROUP's zinc-400.
export function Label({ className, ...props }: LabelHTMLAttributes<HTMLLabelElement>) {
return (
<label
className={cn('text-sm font-medium text-slate-700', className)}
className={cn('text-[11px] font-semibold uppercase tracking-wider text-slate-500', className)}
{...props}
/>
)

View File

@ -7,9 +7,9 @@ export const Select = forwardRef<HTMLSelectElement, Props>(({ className, childre
<select
ref={ref}
className={cn(
'h-9 w-full rounded-md border border-slate-300 bg-white px-3 pr-8 text-sm text-slate-900',
'shadow-[inset_0_1px_0_rgba(15,23,42,0.02)]',
'transition-[border-color,box-shadow] focus-visible:border-brand-500 focus-visible:ring-2 focus-visible:ring-brand-500/20',
// Density-first: matches Input — compact rounded-lg, brand focus glow.
'h-8 w-full rounded-lg border border-slate-300 bg-white px-3 pr-8 text-sm text-slate-900',
'transition-[border-color,box-shadow] focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-500/15',
'disabled:cursor-not-allowed disabled:bg-slate-50 disabled:opacity-70',
className,
)}

View File

@ -7,9 +7,10 @@ export const Textarea = forwardRef<HTMLTextAreaElement, Props>(({ className, ...
<textarea
ref={ref}
className={cn(
'w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm text-slate-900 leading-relaxed',
'shadow-[inset_0_1px_0_rgba(15,23,42,0.02)] placeholder:text-slate-400',
'transition-[border-color,box-shadow] focus-visible:border-brand-500 focus-visible:ring-2 focus-visible:ring-brand-500/20',
// Density-first: matches Input — rounded-lg, brand focus glow.
'w-full rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-sm leading-relaxed text-slate-900',
'placeholder:text-slate-400',
'transition-[border-color,box-shadow] focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-500/15',
'disabled:cursor-not-allowed disabled:bg-slate-50 disabled:opacity-70',
className,
)}

View File

@ -40,13 +40,26 @@ body {
text-rendering: optimizeLegibility;
}
/* Heading tightening + better hierarchy with Be Vietnam Pro.
Density-first (NAMGROUP convention): semibold ladder, never font-bold —
weight carries hierarchy without shouting. */
h1, h2, h3, h4 {
letter-spacing: -0.018em;
letter-spacing: -0.014em;
color: #0f172a;
font-weight: 600;
}
h1 { font-weight: 700; }
h2 { font-weight: 600; }
/* Section / form labels — uppercase scan-pattern shared across the app.
Use class="label-eyebrow" for the dense ERP label treatment. */
.label-eyebrow {
font-size: 11px;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: #64748b; /* slate-500 — WCAG-AA on white (4.6:1) */
}
/* Tabular numbers in tables + stat cards for better alignment */
table, .tabular-nums {
font-variant-numeric: tabular-nums;
}

View File

@ -46,13 +46,13 @@ export function LoginPage() {
<div className="pointer-events-none absolute -left-32 -top-32 h-96 w-96 rounded-full bg-brand-200/40 blur-3xl" />
<div className="pointer-events-none absolute -bottom-32 -right-32 h-96 w-96 rounded-full bg-brand-300/30 blur-3xl" />
<div className="relative w-full max-w-md rounded-2xl border border-slate-200/70 bg-white/90 p-10 shadow-xl backdrop-blur">
<div className="relative w-full max-w-md rounded-2xl border border-slate-200/70 bg-white/90 p-10 shadow-lg ring-1 ring-slate-900/5 backdrop-blur">
<div className="mb-8 flex flex-col items-center text-center">
<img src="/logo.png" alt="Solutions" className="h-14 w-auto" />
<div className="mt-4 text-xs font-semibold uppercase tracking-[0.2em] text-brand-600">
<div className="mt-4 text-[11px] font-semibold uppercase tracking-wider text-brand-700">
ERP · Quản hợp đng
</div>
<div className="mt-1 text-sm text-slate-600">Đăng nhập đ tiếp tục</div>
<div className="mt-1.5 text-sm text-slate-600">Đăng nhập đ tiếp tục</div>
</div>
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-1.5">