"use client"; import Image from "next/image"; import { useTheme } from "next-themes"; import { useEffect, useState } from "react"; type SiteLogoProps = { lightLogoUrl?: string | null; darkLogoUrl?: string | null; alt: string; priority?: boolean; }; export function SiteLogo({ lightLogoUrl, darkLogoUrl, alt, priority = false, }: SiteLogoProps) { const { theme, resolvedTheme } = useTheme(); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); const activeTheme = theme === "system" ? resolvedTheme : theme; const isDark = mounted && activeTheme === "dark"; const fallbackSrc = isDark ? "/logos/dark-primary.svg" : "/logos/light-primary.svg"; const src = isDark ? darkLogoUrl || lightLogoUrl || fallbackSrc : lightLogoUrl || darkLogoUrl || fallbackSrc; return ( {alt} ); }