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,35 @@
import React from 'react';
interface Option {
value: string; // The actual value to be used
label: string; // The label to display for the option
}
interface DropdownSettingProps {
label: string; // The label to display
value: string; // The current selected value
setValue: (newValue: string) => void; // The method to update the state
options: Option[]; // List of options for the dropdown
}
const DropdownSetting: React.FC<DropdownSettingProps> = ({ label, value, setValue, options }) => {
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
const newValue = e.target.value;
setValue(newValue);
};
return (
<div className="settings-option">
<label>{label}</label>
<select value={value} onChange={handleSelectChange}>
{options.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
</div>
);
};
export default DropdownSetting;