diff --git a/components/animate/ExportPanel.tsx b/components/animate/ExportPanel.tsx index 0401a3e..fc59ae7 100644 --- a/components/animate/ExportPanel.tsx +++ b/components/animate/ExportPanel.tsx @@ -1,10 +1,9 @@ '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 { CodeSnippet } from '@/components/ui/code-snippet'; import type { AnimationConfig } from '@/types/animate'; interface Props { @@ -13,45 +12,6 @@ interface Props { 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]); @@ -76,8 +36,8 @@ export function ExportPanel({ config }: Props) { ))} - {tab === 'css' && } - {tab === 'tailwind' && } + {tab === 'css' && } + {tab === 'tailwind' && } ); } diff --git a/components/favicon/FaviconGenerator.tsx b/components/favicon/FaviconGenerator.tsx index 5e58544..c3c24c7 100644 --- a/components/favicon/FaviconGenerator.tsx +++ b/components/favicon/FaviconGenerator.tsx @@ -4,7 +4,7 @@ import * as React from 'react'; import { Download, Loader2, Code2, Globe, Layout, FileImage } from 'lucide-react'; import { FaviconFileUpload } from './FaviconFileUpload'; import { ColorInput } from '@/components/ui/color-input'; -import { CodeSnippet } from './CodeSnippet'; +import { CodeSnippet } from '@/components/ui/code-snippet'; import { generateFaviconSet } from '@/lib/favicon/faviconService'; import { downloadBlobsAsZip } from '@/lib/media/utils/fileUtils'; import type { FaviconSet, FaviconOptions } from '@/types/favicon'; diff --git a/components/favicon/CodeSnippet.tsx b/components/ui/code-snippet.tsx similarity index 74% rename from components/favicon/CodeSnippet.tsx rename to components/ui/code-snippet.tsx index e084577..fb4bd95 100644 --- a/components/favicon/CodeSnippet.tsx +++ b/components/ui/code-snippet.tsx @@ -6,9 +6,10 @@ import { toast } from 'sonner'; interface CodeSnippetProps { code: string; + maxHeight?: string; } -export function CodeSnippet({ code }: CodeSnippetProps) { +export function CodeSnippet({ code, maxHeight }: CodeSnippetProps) { const [copied, setCopied] = React.useState(false); const handleCopy = () => { @@ -22,12 +23,15 @@ export function CodeSnippet({ code }: CodeSnippetProps) {
-
+      
         {code}