Spaces:
Runtime error
Runtime error
File size: 1,545 Bytes
ca28016 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
"use client"
import * as React from "react"
import { useTheme } from "next-themes"
import { cn } from "@/lib/utils"
interface AetherLogoProps {
className?: string
width?: number
height?: number
collapsedWidth?: number
collapsedHeight?: number
}
export function AetherLogo({ className, width = 20, height = 20, collapsedWidth, collapsedHeight }: AetherLogoProps) {
const { resolvedTheme } = useTheme()
const [mounted, setMounted] = React.useState(false)
// Only render after hydration to avoid SSR mismatch
React.useEffect(() => {
setMounted(true)
}, [])
// Show a simple fallback during SSR/hydration
if (!mounted) {
return (
<div className={cn("object-contain", className)} style={{ width, height }}>
<div className="w-full h-full bg-blue-500 rounded-md animate-pulse" />
</div>
)
}
// Determine which logo to show based on theme after hydration
const isDark = resolvedTheme === 'dark'
const logoSrc = isDark ? '/logo-dark.png' : '/logo-light.png'
return (
<div className={cn("object-contain", className)}>
<img
src={logoSrc}
alt="Aether AI Logo"
width={width}
height={height}
className="group-data-[collapsible=icon]:hidden"
/>
{collapsedWidth && collapsedHeight && (
<img
src={logoSrc}
alt="Aether AI Logo"
width={collapsedWidth}
height={collapsedHeight}
className="hidden group-data-[collapsible=icon]:block"
/>
)}
</div>
)
} |