feat: Add vertical tab layout to Coupon form

Implemented VerticalTabForm component for better UX

Created Components:
1. VerticalTabForm.tsx - Reusable vertical tab layout
   - Left sidebar with navigation (250px on desktop)
   - Right content area (scrollable)
   - Scroll spy - auto-highlights active section
   - Click to scroll to section
   - Smooth scrolling behavior
   - Icons support for tabs

2. FormSection component
   - Wrapper for form sections
   - Proper ref forwarding
   - Section ID tracking

Updated CouponForm:
- Added vertical tab navigation
- 3 sections: General, Usage restrictions, Usage limits
- Icons: Settings, ShieldCheck, BarChart3
- Narrower content area (better readability)
- Desktop-only (lg:block) - mobile keeps original layout

Features:
 Scroll spy - active tab follows scroll
 Click navigation - smooth scroll to section
 Visual hierarchy - clear section separation
 Better space utilization
 Reduced form width for readability
 Professional UI like Shopify/Stripe

Layout:
- Desktop: 250px sidebar + remaining content
- Content: max-h-[calc(100vh-200px)] scrollable
- Sticky sidebar (top-4)
- Active state: bg-primary text-primary-foreground
- Hover state: bg-muted hover:text-foreground

Next: Apply same pattern to Products form
This commit is contained in:
dwindown
2025-11-20 16:00:03 +07:00
parent 0f47c08b7a
commit 7455d99ab8
3 changed files with 169 additions and 18 deletions

View File

@@ -120,7 +120,10 @@ export function MultiSelect({
</PopoverTrigger>
<PopoverContent className="w-full p-0" align="start">
<Command>
<CommandInput placeholder="Search..." />
<CommandInput
placeholder="Search..."
className="!border-none !shadow-none !ring-0"
/>
<CommandEmpty>{emptyMessage}</CommandEmpty>
<CommandGroup className="max-h-64 overflow-auto">
{options.map((option) => (