Further Refactoring of the Settings

This commit is contained in:
sageTheDM 2024-10-01 12:45:21 +02:00
parent 003e353073
commit 92f880c3f8
11 changed files with 557 additions and 496 deletions

View file

@ -0,0 +1,41 @@
// ThemeDropdown.tsx
import React from 'react';
import { applyTheme, applyCustomTheme } from './theme';
const ThemeDropdown: React.FC<{
selectedTheme: string;
setSelectedTheme: (theme: string) => void;
}> = ({ selectedTheme, setSelectedTheme }) => {
const themeOptions = [
{ value: 'IOMARKET', label: 'IOMARKET' },
{ value: 'WHITE', label: 'WHITE' },
{ value: 'BLACK', label: 'BLACK' },
{ value: 'CUSTOM', label: 'CUSTOM' },
];
return (
<div className="settings-option">
<p>Select Theme</p>
<select
value={selectedTheme}
onChange={(e) => {
const theme = e.target.value;
if (theme !== 'default') {
setSelectedTheme(theme);
localStorage.setItem('selectedTheme', theme);
applyTheme(theme); // Ensure you define applyTheme
}
}}
>
<option value="default">Select your style...</option>
{themeOptions.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
</div>
);
};
export default ThemeDropdown;