Merge pull request #46 from cinderblockgames/master

Fixing Theme dropdowns in Settings
This commit is contained in:
Bastian Meissner 2021-11-20 12:45:18 +01:00 committed by GitHub
commit cfbe492ef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,17 +32,27 @@ const Select = ({
data-testid={"select" + (testId ? "-" + testId : "")}
onChange={(e) => update(items, onChange, e)}
className={className}
defaultValue={current}
>
{items.map(({ label, value }, index) => (
<option
data-testid={"option-" + (testId ? testId + "-" : "") + index}
key={[label, index].join("")}
value={value.toString()}
>
{label}
</option>
))}
{items.map(({ label, value }, index) => {
if (label === current) {
return <option
data-testid={"option-" + (testId ? testId + "-" : "") + index}
key={[label, index].join("")}
value={value.toString()}
selected
>
{label}
</option>
} else {
return <option
data-testid={"option-" + (testId ? testId + "-" : "") + index}
key={[label, index].join("")}
value={value.toString()}
>
{label}
</option>
}
})}
</select>
);