'use client'; import { useMemo, useState } from 'react'; import { Copy, Download } from 'lucide-react'; import { toast } from 'sonner'; import { cn } from '@/lib/utils/cn'; import { buildCSS, buildTailwindCSS } from '@/lib/animate/cssBuilder'; import type { AnimationConfig } from '@/types/animate'; interface Props { config: AnimationConfig; } type ExportTab = 'css' | 'tailwind'; const actionBtn = 'flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs glass rounded-md border border-border/30 text-muted-foreground hover:text-primary hover:border-primary/30 hover:bg-primary/10 transition-all'; function CodeBlock({ code, filename }: { code: string; filename: string }) { const copy = () => { navigator.clipboard.writeText(code); toast.success('Copied to clipboard!'); }; const download = () => { const blob = new Blob([code], { type: 'text/css' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; a.click(); URL.revokeObjectURL(url); toast.success(`Downloaded ${filename}`); }; return (
          {code}
        
); } export function ExportPanel({ config }: Props) { const [tab, setTab] = useState('css'); const css = useMemo(() => buildCSS(config), [config]); const tailwind = useMemo(() => buildTailwindCSS(config), [config]); return (
Export
{(['css', 'tailwind'] as ExportTab[]).map((t) => ( ))}
{tab === 'css' && } {tab === 'tailwind' && }
); }