suna/frontend/src/components/sidebar/kortix-logo.tsx

33 lines
747 B
TypeScript
Raw Normal View History

'use client';
2025-04-16 04:45:46 +08:00
import Image from 'next/image';
import { useTheme } from 'next-themes';
import { useEffect, useState } from 'react';
2025-04-16 04:45:46 +08:00
2025-06-01 04:53:53 +08:00
interface KortixLogoProps {
size?: number;
}
export function KortixLogo({ size = 24 }: KortixLogoProps) {
2025-07-05 04:56:08 +08:00
const { theme, systemTheme } = useTheme();
const [mounted, setMounted] = useState(false);
2025-04-16 08:04:04 +08:00
// After mount, we can access the theme
useEffect(() => {
setMounted(true);
}, []);
2025-07-05 04:56:08 +08:00
const shouldInvert = mounted && (
theme === 'dark' || (theme === 'system' && systemTheme === 'dark')
);
2025-04-16 04:45:46 +08:00
return (
2025-06-01 04:53:53 +08:00
<Image
2025-04-16 04:45:46 +08:00
src="/kortix-symbol.svg"
alt="Kortix"
2025-06-01 04:53:53 +08:00
width={size}
height={size}
2025-07-05 04:56:08 +08:00
className={`${shouldInvert ? 'invert' : ''} flex-shrink-0`}
2025-04-16 04:45:46 +08:00
/>
);
}