From 2875d39f2c7feb8c9e9990ac08ba57246c9b4d8b Mon Sep 17 00:00:00 2001 From: Thanh Quy - wolf <524H0124@student.tdtu.edu.vn> Date: Fri, 17 Apr 2026 18:31:33 +0700 Subject: [PATCH] Refactor README and component documentation for clarity and consistency; update layout and formatting across various components; enhance analytics charts and payment summary card functionality; improve login form imports and structure; optimize product card button implementation; ensure consistent styling and spacing in manager products tab. --- .../skills/frontend-atomic-design/SKILL.md | 198 +++++++++--------- .../frontend-atomic-design/manifest.json | 2 +- .claude/skills/prompt-optimizer/SKILL.md | 44 +++- .claude/skills/ui-ux-testing/SKILL.md | 94 ++++++--- .../website-creation-automation/SKILL.md | 92 +++++--- README.md | 52 +++-- app/(main)/login/page.tsx | 4 +- app/(main)/page.tsx | 9 +- app/(main)/payment/page.tsx | 21 +- components/COMPONENTS.md | 67 +++--- components/atoms/ATOMS.md | 19 ++ .../molecules/cards/PaymentSummaryCard.tsx | 11 +- components/molecules/cards/ProductCard.tsx | 8 +- components/organisms/analytics/BarChart.tsx | 10 +- components/organisms/analytics/LineChart.tsx | 122 +++++++++-- components/organisms/analytics/PieChart.tsx | 2 +- components/organisms/forms/LoginForm.tsx | 2 +- components/organisms/manager/ProductsTab.tsx | 5 +- 18 files changed, 495 insertions(+), 267 deletions(-) diff --git a/.claude/skills/frontend-atomic-design/SKILL.md b/.claude/skills/frontend-atomic-design/SKILL.md index aaafd8e..dd2a708 100644 --- a/.claude/skills/frontend-atomic-design/SKILL.md +++ b/.claude/skills/frontend-atomic-design/SKILL.md @@ -5,7 +5,8 @@ description: Create modern, responsive frontend components and layouts using ato # Atomic Design Frontend System with Tailwind CSS -A comprehensive guide for building modern, responsive frontend applications using atomic design principles and Tailwind CSS. +A comprehensive guide for building modern, responsive frontend applications +using atomic design principles and Tailwind CSS. ## Core Principles @@ -14,20 +15,25 @@ A comprehensive guide for building modern, responsive frontend applications usin Atomic Design breaks UI into five distinct levels: #### **Atoms** -Smallest, indivisible UI elements that cannot be broken down without losing functionality. + +Smallest, indivisible UI elements that cannot be broken down without losing +functionality. + - Buttons, input fields, labels, icons, text styles - Color variables, spacing units, typography scales - Simple, pure, reusable building blocks ```jsx // Example: Button Atom - ``` #### **Molecules** + Groups of atoms bonded together, forming simple functional units. + - Search bars (input + button + icon) - Form fields (label + input + error message) - Card headers (avatar + title + subtitle) @@ -35,18 +41,16 @@ Groups of atoms bonded together, forming simple functional units. ```jsx // Example: Search Molecule -
- - +
+ +
``` #### **Organisms** + Complex functional units made of groups of molecules and/or atoms. + - Header/Navigation bars - Form sections (multiple form molecules) - Card layouts with multiple sections @@ -55,28 +59,33 @@ Complex functional units made of groups of molecules and/or atoms. ```jsx // Example: Product Card Organism -
- +
+
-

Product Name

-

Description

-
- $99 - +

Product Name

+

Description

+
+ $99 +
``` #### **Templates** -Page-level wireframes showing layout and component placement without final content. + +Page-level wireframes showing layout and component placement without final +content. + - Single-column layouts - Two-column layouts (sidebar + main) - Grid-based layouts - Hero + content sections #### **Pages** + Specific instances of templates populated with real content and data. + - Homepage with actual products - User profile with real user data - Dashboard with live metrics @@ -86,6 +95,7 @@ Specific instances of templates populated with real content and data. ## Design System Variables (Reusable Values) ### Color Palette + ```css /* Define in Tailwind config or use CSS variables */ Primary: #2563eb (blue-600) @@ -97,6 +107,7 @@ Neutral: #6b7280 (gray-500) ``` ### Typography Scale + ```css H1: 32px (2rem) - font-bold H2: 24px (1.5rem) - font-bold @@ -107,6 +118,7 @@ Tiny: 12px (0.75rem) - font-normal ``` ### Spacing Scale + ```css xs: 4px (0.25rem) sm: 8px (0.5rem) @@ -117,6 +129,7 @@ xl: 32px (2rem) ``` ### Border Radius + ```css Subtle: 4px (rounded-sm) Standard: 8px (rounded-lg) @@ -125,6 +138,7 @@ Full: 9999px (rounded-full) ``` ### Box Shadows + ```css Subtle: 0 1px 2px rgba(0,0,0,0.05) Soft: 0 4px 6px rgba(0,0,0,0.07) @@ -137,6 +151,7 @@ Strong: 0 20px 25px rgba(0,0,0,0.15) ## Responsive Design Strategy ### Breakpoints (Tailwind Default) + ``` Mobile: < 640px (sm) Tablet: 640px (md, lg) @@ -144,15 +159,17 @@ Desktop: 1024px+ (xl, 2xl) ``` ### Mobile-First Approach + 1. **Start with mobile styles** (default, no prefix) 2. **Layer tablet styles** (md: prefix) 3. **Layer desktop styles** (lg:, xl: prefix) ### Example: Responsive Layout + ```jsx // Mobile: 1 column, Tablet: 2 columns, Desktop: 3 columns -
- {items.map(item => ( +
+ {items.map((item) => ( ))}
@@ -161,39 +178,42 @@ Desktop: 1024px+ (xl, 2xl) ### Common Responsive Patterns **Responsive Typography** + ```jsx -

+

Responsive Heading

``` **Responsive Padding/Margins** + ```jsx -
- Content with responsive spacing -
+
Content with responsive spacing
``` **Responsive Grid** + ```jsx -
+
{/* Grid items */}
``` **Responsive Flexbox** + ```jsx -
+
Main content
``` **Responsive Images** + ```jsx -Responsive image ``` @@ -203,6 +223,7 @@ Desktop: 1024px+ (xl, 2xl) ## Modern Design Patterns ### 1. Consistency & Visual Hierarchy + - **Use consistent spacing**: Apply spacing scale uniformly - **Establish clear hierarchy**: Size, weight, color for emphasis - **Group related content**: Use whitespace to separate sections @@ -211,16 +232,15 @@ Desktop: 1024px+ (xl, 2xl) ```jsx
-

Section Title

+

Section Title

Description text

-
- {/* Related items with consistent spacing */} -
+
{/* Related items with consistent spacing */}
``` ### 2. Interactive Feedback + - **Hover states**: Subtle color/shadow changes - **Active states**: Indicate current selection - **Focus states**: Keyboard navigation support @@ -228,35 +248,26 @@ Desktop: 1024px+ (xl, 2xl) - **Transitions**: Smooth animations (200-300ms) ```jsx - ``` ### 3. Depth & Layering + - **Subtle shadows**: Create depth without heaviness - **Elevation levels**: Consistent shadow progression - **Overlays**: Semi-transparent backgrounds for modals - **Z-index strategy**: Clear layering hierarchy ```jsx -
+
Card content
``` ### 4. Color Usage + - **Primary action**: Most frequent call-to-action - **Secondary action**: Alternative actions - **Semantic colors**: Status indicators (success, warning, danger) @@ -264,16 +275,15 @@ Desktop: 1024px+ (xl, 2xl) - **Limited palette**: 3-5 colors maximum in most designs ### 5. Whitespace & Breathing Room + - Don't crowd elements - Use consistent gap values (gap-4, gap-6, gap-8) - Separate sections with vertical rhythm - Generous padding in cards and containers ```jsx -
-
- {/* Sections with good breathing room */} -
+
+
{/* Sections with good breathing room */}
``` @@ -282,6 +292,7 @@ Desktop: 1024px+ (xl, 2xl) ## Tailwind CSS Best Practices ### 1. Use Utility Classes Effectively + ```jsx // Good: Semantic, reusable, organized
@@ -452,8 +448,8 @@ export const ComponentName = ({ prop1, prop2, className = '' }) => { 6. **Touch targets**: Minimum 44x44px for interactive elements ```jsx -
- + {/* Login Form */} diff --git a/app/(main)/page.tsx b/app/(main)/page.tsx index b5f0978..7dba76b 100644 --- a/app/(main)/page.tsx +++ b/app/(main)/page.tsx @@ -1,10 +1,10 @@ "use client"; +import { SearchBar } from "@/components/molecules/search-bar"; import { CategorySidebar } from "@/components/organisms/navigation"; import { ProductGrid } from "@/components/organisms/product-grid"; -import { SearchBar } from "@/components/molecules/search-bar"; -import { useMenu } from "@/lib/menu-context"; import { MENU_CATEGORIES } from "@/lib/constants"; +import { useMenu } from "@/lib/menu-context"; import { useEffect, useState } from "react"; /** @@ -75,10 +75,7 @@ export default function Home() {
{/* ── Product grid (organism handles mobile category menu + grid) ── */} - +
); diff --git a/app/(main)/payment/page.tsx b/app/(main)/payment/page.tsx index 76ead1e..653c83e 100644 --- a/app/(main)/payment/page.tsx +++ b/app/(main)/payment/page.tsx @@ -48,10 +48,19 @@ export default function PaymentPage() { Tên sản phẩm - Giá tiền - Mô tả - Số lượng - + + Giá tiền + + + Mô tả + + + Số lượng + + Xóa @@ -75,7 +84,7 @@ export default function PaymentPage() {
diff --git a/components/molecules/cards/PaymentSummaryCard.tsx b/components/molecules/cards/PaymentSummaryCard.tsx index fb561ef..adc8505 100644 --- a/components/molecules/cards/PaymentSummaryCard.tsx +++ b/components/molecules/cards/PaymentSummaryCard.tsx @@ -13,14 +13,13 @@ export default function PaymentSummaryCard({ isCustomer = false, backHref, }: PaymentSummaryCardProps) { - - const [isReviewOpen, setIsReviewOpen] = useState(false); - const handlePayment = () => { + const [isReviewOpen, setIsReviewOpen] = useState(false); + const handlePayment = () => { // UI-only: open review modal after "payment" if (isCustomer) { - setIsReviewOpen(true); - } -}; + setIsReviewOpen(true); + } + }; return (
); diff --git a/components/organisms/analytics/PieChart.tsx b/components/organisms/analytics/PieChart.tsx index 726a7b3..e096084 100644 --- a/components/organisms/analytics/PieChart.tsx +++ b/components/organisms/analytics/PieChart.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useMemo } from "react"; +import { useMemo, useState } from "react"; export interface PieSlice { label: string; diff --git a/components/organisms/forms/LoginForm.tsx b/components/organisms/forms/LoginForm.tsx index b9eaddc..28606a8 100644 --- a/components/organisms/forms/LoginForm.tsx +++ b/components/organisms/forms/LoginForm.tsx @@ -1,10 +1,10 @@ +import Button from "@/components/atoms/buttons/Button"; import ErrorMessageLogin from "@/components/atoms/errors/ErrorMessageLogin"; import LoginInput from "@/components/atoms/inputs/LoginInput"; import { useAuth } from "@/lib/auth-context"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { FormEvent, useState } from "react"; -import Button from "@/components/atoms/buttons/Button"; export default function LoginForm() { const router = useRouter(); diff --git a/components/organisms/manager/ProductsTab.tsx b/components/organisms/manager/ProductsTab.tsx index 9d5c27c..12f7fbf 100644 --- a/components/organisms/manager/ProductsTab.tsx +++ b/components/organisms/manager/ProductsTab.tsx @@ -152,7 +152,10 @@ export default function ProductsTab() { ) : ( filtered.map((p) => ( - +

{p.name}