2026-01-13 18:47:57 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
|
import { Slot } from '@radix-ui/react-slot';
|
|
|
|
|
import { type VariantProps, cva } from 'class-variance-authority';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
2026-01-11 02:19:02 +00:00
|
|
|
|
2026-01-16 01:15:30 +00:00
|
|
|
/**
|
|
|
|
|
* Button variant styles using class-variance-authority
|
|
|
|
|
*
|
|
|
|
|
* Variants:
|
|
|
|
|
* - default: Primary action button with cyan background, subtle hover glow
|
|
|
|
|
* - destructive: Destructive actions (delete, remove) with red styling
|
|
|
|
|
* - outline: Outlined button for secondary actions
|
|
|
|
|
* - secondary: Secondary button with steel background
|
|
|
|
|
* - ghost: Minimal button with hover effect, for tertiary actions
|
|
|
|
|
*/
|
2026-01-11 02:19:02 +00:00
|
|
|
const buttonVariants = cva(
|
aesthetic-improvements: remove excessive hover effects from high-priority files
- Removed scale transforms (hover:scale-[1.02], hover:scale-110, group-hover:scale-110/105) from cards and images
- Removed decorative shadow/glow effects (hover:shadow-neon-cyan/20, hover:shadow-lg) from cards
- Removed hover-lift class (translateY + shadow) from base Card and Button components
- Replaced excessive effects with subtle hover:bg-white/5 or hover:opacity-90
- Preserved functional hover states (group-hover:opacity-100 for play overlays, hover:bg-accent/50 for interactive feedback)
- Updated 14 files: ProductCard, TrackCard, CourseCard, EquipmentCard, PostCard, ProfileView, card.tsx, SearchPage, PlayerControls, OrderSummary, DiscoverView, PlaylistCard, Sidebar, button.tsx
- Effects are now subtle and purposeful, aligning with Surgical Minimalism
- Action 11.4.1.3 complete
2026-01-16 09:34:41 +00:00
|
|
|
'inline-flex items-center justify-center whitespace-nowrap rounded-xl text-sm font-medium transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-kodo-cyan focus-visible:ring-offset-2 focus-visible:ring-offset-kodo-void disabled:pointer-events-none disabled:opacity-50',
|
2026-01-11 02:19:02 +00:00
|
|
|
{
|
|
|
|
|
variants: {
|
|
|
|
|
variant: {
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Primary action button - use for main CTAs, submit buttons */
|
2026-01-11 02:19:02 +00:00
|
|
|
default:
|
2026-01-16 01:14:52 +00:00
|
|
|
'bg-kodo-cyan text-kodo-void hover:bg-kodo-cyan-dim hover:shadow-[0_0_15px_rgba(102,252,241,0.3)] border border-transparent font-semibold tracking-tight',
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Destructive actions - use for delete, remove, clear actions */
|
2026-01-11 02:19:02 +00:00
|
|
|
destructive:
|
2026-01-16 01:14:52 +00:00
|
|
|
'bg-kodo-red/10 text-kodo-red hover:bg-kodo-red/20 border border-kodo-red/30 hover:border-kodo-red/50',
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Outlined button - use for secondary actions, cancel buttons */
|
2026-01-11 02:19:02 +00:00
|
|
|
outline:
|
2026-01-16 09:51:30 +00:00
|
|
|
'border border-kodo-steel bg-transparent text-white hover:bg-white/5 hover:border-kodo-steel/50',
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Secondary button - use for less prominent actions */
|
2026-01-11 02:19:02 +00:00
|
|
|
secondary:
|
2026-01-13 18:47:57 +00:00
|
|
|
'bg-kodo-steel/30 text-white hover:bg-kodo-steel/50 border border-white/5 hover:border-white/10',
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Ghost button - use for icon buttons, menu items, subtle actions */
|
2026-01-16 09:14:17 +00:00
|
|
|
ghost: 'hover:bg-white/5 text-white',
|
2026-01-11 02:19:02 +00:00
|
|
|
},
|
|
|
|
|
size: {
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Default size - standard buttons */
|
2026-01-13 18:47:57 +00:00
|
|
|
default: 'h-10 px-4 py-2',
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Small size - compact buttons, inline actions */
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
sm: 'h-8 rounded-lg px-4 text-xs',
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Large size - prominent CTAs */
|
2026-01-13 18:47:57 +00:00
|
|
|
lg: 'h-12 rounded-xl px-8 text-base',
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Icon size - icon-only buttons (square) */
|
2026-01-13 18:47:57 +00:00
|
|
|
icon: 'h-10 w-10',
|
2026-01-11 02:19:02 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
defaultVariants: {
|
2026-01-13 18:47:57 +00:00
|
|
|
variant: 'default',
|
|
|
|
|
size: 'default',
|
2026-01-11 02:19:02 +00:00
|
|
|
},
|
2026-01-13 18:47:57 +00:00
|
|
|
},
|
|
|
|
|
);
|
2026-01-11 02:19:02 +00:00
|
|
|
|
2026-01-16 01:15:30 +00:00
|
|
|
/**
|
|
|
|
|
* Button component props
|
|
|
|
|
*
|
|
|
|
|
* Extends standard HTML button attributes with design system variants and sizes.
|
|
|
|
|
*
|
|
|
|
|
* @example
|
|
|
|
|
* ```tsx
|
|
|
|
|
* <Button variant="default" size="lg" onClick={handleSave}>
|
|
|
|
|
* Save Changes
|
|
|
|
|
* </Button>
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* @example
|
|
|
|
|
* ```tsx
|
|
|
|
|
* <Button variant="ghost" size="icon" onClick={handleEdit}>
|
|
|
|
|
* <Edit className="w-4 h-4" />
|
|
|
|
|
* </Button>
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
2026-01-11 02:19:02 +00:00
|
|
|
export interface ButtonProps
|
|
|
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
|
|
VariantProps<typeof buttonVariants> {
|
2026-01-16 01:15:30 +00:00
|
|
|
/** Use asChild to compose with other components (e.g., Link from react-router) */
|
2026-01-13 18:47:57 +00:00
|
|
|
asChild?: boolean;
|
2025-12-03 21:56:50 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-16 01:15:30 +00:00
|
|
|
/**
|
|
|
|
|
* Button - Design system button component
|
|
|
|
|
*
|
|
|
|
|
* A versatile button component with multiple variants and sizes following the Kodo design system.
|
|
|
|
|
*
|
|
|
|
|
* @example
|
|
|
|
|
* ```tsx
|
|
|
|
|
* // Primary action
|
|
|
|
|
* <Button variant="default" onClick={handleSave}>Save</Button>
|
|
|
|
|
*
|
|
|
|
|
* // Destructive action
|
|
|
|
|
* <Button variant="destructive" onClick={handleDelete}>Delete</Button>
|
|
|
|
|
*
|
|
|
|
|
* // Secondary action
|
|
|
|
|
* <Button variant="outline" onClick={handleCancel}>Cancel</Button>
|
|
|
|
|
*
|
|
|
|
|
* // Icon button
|
|
|
|
|
* <Button variant="ghost" size="icon">
|
|
|
|
|
* <Edit className="w-4 h-4" />
|
|
|
|
|
* </Button>
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
2025-12-03 21:56:50 +00:00
|
|
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
2026-01-11 02:19:02 +00:00
|
|
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
2026-01-13 18:47:57 +00:00
|
|
|
const Comp = asChild ? Slot : 'button';
|
2025-12-03 21:56:50 +00:00
|
|
|
return (
|
2026-01-11 02:19:02 +00:00
|
|
|
<Comp
|
|
|
|
|
className={cn(buttonVariants({ variant, size, className }))}
|
2025-12-03 21:56:50 +00:00
|
|
|
ref={ref}
|
|
|
|
|
{...props}
|
2026-01-11 02:19:02 +00:00
|
|
|
/>
|
2026-01-13 18:47:57 +00:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
Button.displayName = 'Button';
|
2025-12-03 21:56:50 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export { Button, buttonVariants };
|