Files
iaGrowthtechnologies/apps/web/src/components/ThemeContext.jsx
T
Andres Santana ed5e152359 first commit
2026-09-30 10:08:56 -04:00

31 lines
932 B
React

import React, { createContext, useContext, useEffect } from 'react';
const ThemeContext = createContext();
// Light theme only — the site no longer supports a dark mode.
export const ThemeProvider = ({ children }) => {
useEffect(() => {
const root = window.document.documentElement;
root.classList.remove('dark');
root.classList.add('light');
// Clear any previously persisted dark preference.
localStorage.removeItem('theme-preference');
}, []);
// Kept for backward compatibility with consumers that still call useTheme.
// toggleTheme is a no-op now.
return (
<ThemeContext.Provider value={{ theme: 'light', toggleTheme: () => {} }}>
{children}
</ThemeContext.Provider>
);
};
export const useTheme = () => {
const context = useContext(ThemeContext);
if (context === undefined) {
throw new Error('useTheme must be used within a ThemeProvider');
}
return context;
};