mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
24 lines
557 B
TypeScript
24 lines
557 B
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
import { useSearchParams } from 'next/navigation';
|
|
|
|
export function ThemeOverride() {
|
|
const searchParams = useSearchParams();
|
|
|
|
useEffect(() => {
|
|
const themeParam = searchParams.get('theme');
|
|
|
|
if (themeParam === 'dark') {
|
|
document.documentElement.classList.add('dark');
|
|
localStorage.theme = 'dark';
|
|
} else if (themeParam === 'light') {
|
|
document.documentElement.classList.remove('dark');
|
|
localStorage.theme = 'light';
|
|
}
|
|
}, [searchParams]);
|
|
|
|
return null;
|
|
}
|
|
|