feat: expand theme options and update theme handling in ThemeProvider and layout

This commit is contained in:
2025-06-25 18:27:38 -05:00
parent 779ed06e35
commit 99bccf4444
6 changed files with 187 additions and 12 deletions

View File

@@ -2,7 +2,8 @@
import React, { createContext, useContext, useEffect, useState } from 'react';
type Theme = 'blue' | 'violet';
type Theme = 'blue' | 'violet' | 'red' | 'rose' | 'orange' | 'green' | 'yellow';
interface ThemeContextType {
theme: Theme;
@@ -30,11 +31,11 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
// Load theme settings from localStorage on component mount
useEffect(() => {
setMounted(true);
const savedTheme = localStorage.getItem('theme');
const validThemes: Theme[] = ['blue', 'violet', 'red', 'rose', 'orange', 'green', 'yellow'];
const savedTheme = localStorage.getItem('theme') as Theme | null;
if (savedTheme && (savedTheme === 'blue' || savedTheme === 'violet')) {
setTheme(savedTheme);
if (savedTheme && validThemes.includes(savedTheme as Theme)) {
setTheme(savedTheme as Theme);
}
}, []);