diff --git a/public/scripts/theme-init.js b/public/scripts/theme-init.js index 57631ceb..217ed505 100644 --- a/public/scripts/theme-init.js +++ b/public/scripts/theme-init.js @@ -29,12 +29,37 @@ const mode = (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"); root.classList.remove("dark", "light"); + +const stylesToApply = [ + "background", + "foreground", + "primary", + "primary-foreground", + "border", + "secondary", + "secondary-foreground", + "muted", + "muted-foreground", + "radius", +]; + +// element.setAttribute( +// `style`, +// `${element.getAttribute("style") || ""}--${key}: ${value};` +// ); + if (mode === "dark") { - root.classList.add("dark"); - root.style.setProperty("--background", darkStyles.background); - root.style.setProperty("--foreground", darkStyles.foreground); + stylesToApply.forEach((style) => { + root.setAttribute( + `style`, + `${root.getAttribute("style") || ""}--${style}: ${darkStyles[style]};` + ); + }); } else { - root.classList.add("light"); - root.style.setProperty("--background", lightStyles.background); - root.style.setProperty("--foreground", lightStyles.foreground); + stylesToApply.forEach((style) => { + root.setAttribute( + `style`, + `${root.getAttribute("style") || ""}--${style}: ${lightStyles[style]};` + ); + }); } diff --git a/src/components/home/header.tsx b/src/components/home/header.tsx index e16e1ba7..3ad28043 100644 --- a/src/components/home/header.tsx +++ b/src/components/home/header.tsx @@ -6,6 +6,7 @@ import { Menu, Moon, Sun, X, ChevronRight } from "lucide-react"; import Logo from "@/assets/logo.svg?react"; import GitHubIcon from "@/assets/github.svg?react"; import { useGithubStars } from "@/hooks/use-github-stars"; +import { cn } from "@/lib/utils"; interface HeaderProps { isScrolled: boolean; @@ -39,11 +40,12 @@ export function Header({ return (
diff --git a/src/components/home/hero.tsx b/src/components/home/hero.tsx index bd391383..6c5b18e9 100644 --- a/src/components/home/hero.tsx +++ b/src/components/home/hero.tsx @@ -2,16 +2,9 @@ import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { useEditorStore } from "@/store/editor-store"; -import { motion } from "motion/react"; import { ArrowRight, Check, Copy, Circle, Eye, Palette } from "lucide-react"; import { Link } from "react-router"; -const ColorBox = ({ color }: { color: string }) => { - return ( -
- ); -}; - export function Hero() { const { themeState } = useEditorStore(); const mode = themeState.currentMode; @@ -19,54 +12,30 @@ export function Hero() { return (
- +
{/* Left Column - Text Content */}
- +
✦ Visual Theme Editor - - +
+

Design Your Perfect shadcn/ui{" "} Theme - - +

+

Customize colors, typography, and layouts with a real-time preview. No signup required. - - +

+
- - +
+
Real-time Preview @@ -100,16 +64,11 @@ export function Hero() { Beautiful Presets
- +
{/* Right Column - Preview Card */} - +
{/* Header */} @@ -159,11 +118,17 @@ export function Hero() {
- - @@ -186,8 +151,8 @@ export function Hero() {
- - +
+