Merge version_1 into main #2

Merged
development merged 11 commits from version_1 into main 2026-01-20 13:58:38 +00:00
Showing only changes of commit dd8b500271 - Show all commits

View File

@@ -0,0 +1,29 @@
import React, { createContext, useContext, useState } from 'react';
const ThemeContext = createContext();
export const useTheme = () => {
const context = useContext(ThemeContext);
if (!context) {
throw new Error('useTheme must be used within a ThemeProvider');
}
return context;
};
function ThemeProvider({ children }) {
const [theme, setTheme] = useState('light');
const toggleTheme = () => {
setTheme(prevTheme => prevTheme === 'light' ? 'dark' : 'light');
};
return (
<ThemeContext.Provider value={{ theme, toggleTheme }}>
<div className={theme}>
{children}
</div>
</ThemeContext.Provider>
);
}
export default ThemeProvider;