-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathindex.tsx
More file actions
44 lines (39 loc) · 1.01 KB
/
index.tsx
File metadata and controls
44 lines (39 loc) · 1.01 KB
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
import { cn } from "@/lib/utils";
interface LogoProps {
imageUrl?: string;
altText: string;
className?: string;
imageClassName?: string;
}
const Logo: React.FC<LogoProps> = ({
imageUrl,
altText,
className,
imageClassName,
}) => {
// Get logo URL from CSS variable (theme system sets this)
const getCSSVariable = (varName: string): string => {
return getComputedStyle(document.documentElement)
.getPropertyValue(varName)
.trim()
.replace(/^"(.*)"$/, "$1"); // Remove quotes
};
const logoFromCSS = getCSSVariable("--ul-theme-widget-logo-url");
const logoSrc = imageUrl || logoFromCSS;
return (
<div className={cn("flex justify-center items-center mb-6", className)}>
<img
src={logoSrc}
alt={altText}
loading="eager"
decoding="async"
fetchPriority="high"
className={cn(
"object-contain max-w-full max-h-full aspect-square",
imageClassName,
)}
/>
</div>
);
};
export default Logo;