mirror of
https://github.com/Such-Software/such.software.git
synced 2026-10-20 05:58:32 +02:00
- Home hero subhead rewritten to name commerce/websites/apps/consulting plus in-house mobile apps and games; primary CTA points to /products - Portfolio page (/products) title renamed and each product card now shows a 56px icon beside the title - Favicon served inverse to the browser color scheme so the tile contrasts with the chrome instead of blending into it
28 lines
876 B
TypeScript
28 lines
876 B
TypeScript
'use client';
|
|
|
|
import { useTheme } from 'next-themes';
|
|
import { useEffect } from 'react';
|
|
|
|
export function DynamicFavicon() {
|
|
const { resolvedTheme } = useTheme();
|
|
|
|
useEffect(() => {
|
|
if (!resolvedTheme) return;
|
|
|
|
// Favicons contrast with browser chrome, so we serve the opposite-tone tile:
|
|
// dark mode → light tile, light mode → dark tile.
|
|
const variant = resolvedTheme === 'dark' ? 'light' : 'dark';
|
|
|
|
// 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;
|
|
}
|