'use client'; import * as React from 'react'; import { Card } from '@/components/ui/Card'; import { Button } from '@/components/ui/Button'; import { Sparkles, ChevronDown, ChevronUp } from 'lucide-react'; import { cn } from '@/lib/utils/cn'; import { TEXT_TEMPLATES, TEMPLATE_CATEGORIES } from '@/lib/constants/templates'; export interface TextTemplatesProps { onSelectTemplate: (text: string) => void; className?: string; } export function TextTemplates({ onSelectTemplate, className }: TextTemplatesProps) { const [isExpanded, setIsExpanded] = React.useState(false); const [selectedCategory, setSelectedCategory] = React.useState('all'); const filteredTemplates = React.useMemo(() => { if (selectedCategory === 'all') return TEXT_TEMPLATES; return TEXT_TEMPLATES.filter(t => t.category === selectedCategory); }, [selectedCategory]); return (
{isExpanded && (
{/* Category Filter */}
{TEMPLATE_CATEGORIES.map((cat) => ( ))}
{/* Templates Grid */}
{filteredTemplates.map((template) => ( ))}
)}
); }