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 : "")} data-testid={"select" + (testId ? "-" + testId : "")}
onChange={(e) => update(items, onChange, e)} onChange={(e) => update(items, onChange, e)}
className={className} className={className}
defaultValue={current}
> >
{items.map(({ label, value }, index) => ( {items.map(({ label, value }, index) => {
<option if (label === current) {
data-testid={"option-" + (testId ? testId + "-" : "") + index} return <option
key={[label, index].join("")} data-testid={"option-" + (testId ? testId + "-" : "") + index}
value={value.toString()} key={[label, index].join("")}
> value={value.toString()}
{label} selected
</option> >
))} {label}
</option>
} else {
return <option
data-testid={"option-" + (testId ? testId + "-" : "") + index}
key={[label, index].join("")}
value={value.toString()}
>
{label}
</option>
}
})}
</select> </select>
); );