Bỏ qua

Components

Cây component (feature tính tổng)

flowchart TD
    App[App] --> Form[SumForm]
    Form --> InputA["Input A (number)"]
    Form --> InputB["Input B (number)"]
    Form --> Btn["Button 'Tính tổng'"]
    App --> Result["Result display"]
    App --> Error["Error display"]

Spec component

Input (A / B)

Thuộc tính Giá trị
Kiểu number
Bắt buộc có
State default / focus / invalid
Accessible có label + aria-label

Button "Tính tổng"

Thuộc tính Giá trị
Hành động trigger GET /api/sum
State default / hover / disabled (khi đang gọi)
Màu --color-primary → hover --color-primary-hover

Result display

Thuộc tính Giá trị
Nội dung Kết quả: <sum>
Trạng thái success (xanh) / error (đỏ)
Accessible aria-live="polite"

Nguyên tắc

  • Component chỉ nhận state qua props/thuộc tính; không tự gọi API ngoài app.js.
  • Mọi màu/khoảng cách dùng token (xem design tokens), không hardcode.