fix icon theme if theme is system

This commit is contained in:
Krishav Raj Singh 2025-07-05 02:26:08 +05:30
parent b703dd8121
commit 4e669a6b75
1 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ interface KortixLogoProps {
size?: number;
}
export function KortixLogo({ size = 24 }: KortixLogoProps) {
const { theme } = useTheme();
const { theme, systemTheme } = useTheme();
const [mounted, setMounted] = useState(false);
// After mount, we can access the theme
@ -16,13 +16,17 @@ export function KortixLogo({ size = 24 }: KortixLogoProps) {
setMounted(true);
}, []);
const shouldInvert = mounted && (
theme === 'dark' || (theme === 'system' && systemTheme === 'dark')
);
return (
<Image
src="/kortix-symbol.svg"
alt="Kortix"
width={size}
height={size}
className={`${mounted && theme === 'dark' ? 'invert' : ''} flex-shrink-0`}
className={`${shouldInvert ? 'invert' : ''} flex-shrink-0`}
/>
);
}