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>
26 lines
557 B
TypeScript
26 lines
557 B
TypeScript
import type { HeadingProps } from "./Typography.types";
|
|
|
|
export default function Heading({
|
|
level = 2,
|
|
children,
|
|
className = "",
|
|
...props
|
|
}: HeadingProps) {
|
|
const sizes = {
|
|
1: "text-3xl font-bold",
|
|
2: "text-2xl font-bold",
|
|
3: "text-xl font-bold",
|
|
4: "text-lg font-semibold",
|
|
5: "text-base font-semibold",
|
|
6: "text-sm font-semibold",
|
|
};
|
|
|
|
const Tag = `h${level}` as keyof JSX.IntrinsicElements;
|
|
|
|
return (
|
|
<Tag className={`text-foreground ${sizes[level]} ${className}`} {...props}>
|
|
{children}
|
|
</Tag>
|
|
);
|
|
}
|