Component Generator Skill
Quick Start
When generating a new component:
- •Ask for the component's purpose and location
- •Generate following the patterns below
- •Include accessibility, animation, and responsive design
Component Template
Feature Section Component
tsx
"use client";
import { useReducedMotion, m } from "framer-motion";
import Image from "next/image";
interface SectionNameProps {
className?: string;
}
const containerVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1,
delayChildren: 0.2,
},
},
};
const itemVariants = {
hidden: { opacity: 0, y: 40 },
visible: {
opacity: 1,
y: 0,
transition: {
type: "spring",
stiffness: 100,
damping: 20,
mass: 1.2,
},
},
};
export function SectionName({ className }: SectionNameProps) {
const prefersReducedMotion = useReducedMotion();
return (
<section
aria-labelledby="section-heading"
className={`py-24 md:py-32 bg-[var(--color-canvas)] ${className}`}
>
<div className="container mx-auto px-4 md:px-6 lg:px-8">
<m.div
initial="hidden"
whileInView="visible"
viewport={{ once: true, margin: "-100px" }}
variants={prefersReducedMotion ? {} : containerVariants}
>
{/* Header */}
<m.div variants={prefersReducedMotion ? {} : itemVariants} className="mb-12">
<span className="text-xs font-mono uppercase tracking-[0.3em] text-[var(--color-accent-ui)]">
Label
</span>
<h2
id="section-heading"
className="text-4xl md:text-5xl lg:text-6xl font-serif mt-4"
>
Section Title
</h2>
</m.div>
{/* Content */}
<m.div
variants={prefersReducedMotion ? {} : itemVariants}
className="grid md:grid-cols-2 gap-8"
>
{/* Add content here */}
</m.div>
</m.div>
</div>
</section>
);
}
Design System Tokens
Colors (CSS Variables)
tsx
bg-[var(--color-canvas)] // Warm Bone #fffbf5 text-stone-900 // Charcoal Bronze (headings) text-[var(--color-accent-ui)] // Soft Coral #ff7850 text-stone-600 // Muted text
Typography
tsx
// Headings className="font-serif text-4xl md:text-5xl lg:text-6xl" // Labels/Overlines className="font-mono text-xs uppercase tracking-[0.3em]" // Body className="font-sans text-base md:text-lg"
Spacing
tsx
// Section padding className="py-24 md:py-32" // Container className="container mx-auto px-4 md:px-6 lg:px-8" // Grid gaps className="gap-6 md:gap-8"
Animation Spring Config
tsx
transition: {
type: "spring",
stiffness: 100, // "Heavy" feel
damping: 20,
mass: 1.2,
}
Required Patterns
1. Accessibility
- •
aria-labelledbyon sections - •Descriptive
alton images - •
aria-hidden="true"on decorative icons - •Native
<button>elements
2. Reduced Motion
tsx
const prefersReducedMotion = useReducedMotion(); // Apply to all Framer Motion variants
3. Responsive Design
tsx
// Mobile-first breakpoints text-2xl md:text-4xl lg:text-6xl grid-cols-1 md:grid-cols-2 lg:grid-cols-3
4. Image Optimization
tsx
<Image
src={image}
alt="Descriptive text"
width={800}
height={600}
sizes="(max-width: 768px) 100vw, 50vw"
loading="lazy"
placeholder="blur"
blurDataURL={blurData}
/>
File Locations
| Type | Location |
|---|---|
| Feature sections | src/components/features/ |
| UI components | src/components/ui/ |
| Home page sections | src/components/home/ |
| Layout components | src/components/layout/ |
| Figma components | src/components/features/figma-frame/ |
Checklist Before Completion
- • TypeScript interface for props
- •
aria-labelledbyon section - •
useReducedMotionfor animations - • Responsive breakpoints (md:, lg:)
- • Images use
next/image - • Alt text is descriptive
- • Mobile-first CSS
- • Uses design system tokens