mirror of
https://github.com/Such-Software/such.software.git
synced 2026-10-21 06:08:32 +02:00
fix contact form and linking and favicon
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
'use client';
|
||||
|
||||
import { useTheme } from 'next-themes';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function DynamicFavicon() {
|
||||
const { resolvedTheme } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
if (!resolvedTheme) return;
|
||||
|
||||
const variant = resolvedTheme === 'dark' ? 'dark' : 'light';
|
||||
|
||||
// Update all favicon link elements
|
||||
const links = document.querySelectorAll<HTMLLinkElement>('link[rel="icon"], link[rel="shortcut icon"], link[rel="apple-touch-icon"]');
|
||||
links.forEach((link) => {
|
||||
const href = link.getAttribute('href');
|
||||
if (href?.includes('/images/branding/favicon_')) {
|
||||
link.href = href.replace(/favicon_(dark|light)/, `favicon_${variant}`);
|
||||
}
|
||||
});
|
||||
}, [resolvedTheme]);
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user