"use client"; import { StyleData } from "@/lib/types"; import { generatePreviewStyle, generateBackgroundGradient, } from "@/lib/cssGenerator"; import { useTheme } from "next-themes"; import { useEffect, useState } from "react"; interface StylePreviewProps { style: StyleData; } export function StylePreview({ style }: StylePreviewProps) { const { theme } = useTheme(); const [mounted, setMounted] = useState(false); useEffect(() => setMounted(true), []); const isDark = mounted ? theme === "dark" : false; const cardStyle = generatePreviewStyle(style, isDark); const bgGradient = generateBackgroundGradient(style.extractedColors, isDark); const accentColor = style.extractedColors[0] || (isDark ? "#6366f1" : "#3b82f6"); return (