Spaces:
Running
Running
Upload pages/_app.js with huggingface_hub
Browse files- pages/_app.js +15 -0
pages/_app.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import '@/styles/globals.css';
|
| 2 |
+
import { useEffect } from 'react';
|
| 3 |
+
|
| 4 |
+
export default function App({ Component, pageProps }) {
|
| 5 |
+
useEffect(() => {
|
| 6 |
+
// Check for saved theme preference or default to dark
|
| 7 |
+
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
| 8 |
+
document.documentElement.classList.add('dark');
|
| 9 |
+
} else {
|
| 10 |
+
document.documentElement.classList.remove('dark');
|
| 11 |
+
}
|
| 12 |
+
}, []);
|
| 13 |
+
|
| 14 |
+
return <Component {...pageProps} />;
|
| 15 |
+
}
|