diff --git a/PROJECT_SOP.md b/PROJECT_SOP.md index 206aefa..a267ce5 100644 --- a/PROJECT_SOP.md +++ b/PROJECT_SOP.md @@ -260,6 +260,59 @@ When updating an existing module to follow this pattern: ``` +#### Toolbar Button Standards + +All CRUD list pages MUST use consistent button styling in the toolbar: + +**Button Types:** + +| Button Type | Classes | Use Case | +|-------------|---------|----------| +| **Delete (Destructive)** | `border rounded-md px-3 py-2 text-sm bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 inline-flex items-center gap-2` | Bulk delete action | +| **Refresh** | `border rounded-md px-3 py-2 text-sm hover:bg-accent disabled:opacity-50 inline-flex items-center gap-2` | Refresh data | +| **Export/Secondary** | `border rounded-md px-3 py-2 text-sm hover:bg-accent disabled:opacity-50 inline-flex items-center gap-2` | Secondary actions | + +**Button Structure:** +```tsx + +``` + +**Rules:** +1. ✅ **Delete button** - Always use `bg-red-600` (NOT `bg-black`) +2. ✅ **Icon placement** - Use `inline-flex items-center gap-2` (NOT `inline mr-2`) +3. ✅ **Destructive actions** - Only show when items selected (conditional render) +4. ✅ **Non-destructive actions** - Can be always visible (use `disabled` state) +5. ✅ **Consistent spacing** - Use `gap-2` between icon and text +6. ✅ **Hover states** - Destructive: `hover:bg-red-700`, Secondary: `hover:bg-accent` +7. ❌ **Never use `bg-black`** for delete buttons +8. ❌ **Never use `inline mr-2`** - use `inline-flex gap-2` instead + +**Toolbar Layout:** +```tsx +
+ {/* Bulk Actions - Show only when items selected */} + {selectedIds.length > 0 && ( + + )} + + {/* Always-visible actions */} + +
+``` + #### Table/List UI Standards All CRUD list pages MUST follow these consistent UI patterns: diff --git a/admin-spa/src/routes/Products/index.tsx b/admin-spa/src/routes/Products/index.tsx index 33b852c..643cc01 100644 --- a/admin-spa/src/routes/Products/index.tsx +++ b/admin-spa/src/routes/Products/index.tsx @@ -226,21 +226,23 @@ export default function Products() {
- + {selectedIds.length > 0 && ( + + )}