eca619b79a
✨ Created complete atoms library (21 components): - Buttons: Button, IconButton with variants (primary, secondary, danger, ghost) - Inputs: TextInput, SearchInput, Textarea with validation support - Typography: Heading (h1-h6), Text (variants), Caption - Badges: Badge (5 variants), PriceBadge (formatted pricing) - Dividers: Horizontal/vertical separators 🎯 Updated existing components to use atoms: - CartProduct: Now uses Button, Text, Caption atoms - ReviewModal: Now uses Button, Textarea, Heading, Text atoms 📚 Added comprehensive documentation: - components/atoms/ATOMS.md: Complete atoms reference guide - Usage examples, theming, import patterns, accessibility 🏗️ Architecture improvements: - Foundation for molecules/organisms - Type-safe components with full TypeScript support - Consistent theming via CSS variables - Barrel exports for clean imports ✅ Verified: - npm run build: Success (✓ Compiled successfully) - npm run format: All files formatted - npm run lint: No new errors in atoms Next: Phase 2 - Create molecules (ProductCard, FormField, SearchBar, etc.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import type { ButtonProps } from "./Button.types";
|
|
|
|
export default function IconButton({
|
|
variant = "primary",
|
|
size = "md",
|
|
icon,
|
|
disabled = false,
|
|
className = "",
|
|
children,
|
|
...props
|
|
}: ButtonProps) {
|
|
const baseStyles =
|
|
"font-semibold rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center";
|
|
|
|
const variants = {
|
|
primary:
|
|
"bg-(--color-primary) text-white hover:bg-(--color-primary-dark) active:scale-95",
|
|
secondary:
|
|
"border border-(--color-border) hover:bg-(--color-border-light) active:scale-95",
|
|
danger: "bg-red-500 text-white hover:bg-red-600 active:scale-95",
|
|
ghost: "bg-transparent hover:bg-(--color-border-light) active:scale-95",
|
|
};
|
|
|
|
const sizes = {
|
|
sm: "h-8 w-8 text-sm",
|
|
md: "h-10 w-10 text-base",
|
|
lg: "h-12 w-12 text-lg",
|
|
};
|
|
|
|
return (
|
|
<button
|
|
className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${className}`}
|
|
disabled={disabled}
|
|
{...props}
|
|
>
|
|
{icon ? <i className={`fa-solid ${icon}`}></i> : children}
|
|
</button>
|
|
);
|
|
}
|