1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

sort all select options alphabetically

This commit is contained in:
Matthias Kretschmann 2019-03-04 13:50:24 -03:00
parent 05b3cfcc74
commit 49efed73c7
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -76,16 +76,18 @@ export default class Input extends PureComponent<InputProps, InputState> {
>
<option value="">---</option>
{options &&
options.map((option: string, index: number) => (
<option
key={index}
value={slugify(option, {
lower: true
})}
>
{option}
</option>
))}
options
.sort((a, b) => a.localeCompare(b))
.map((option: string, index: number) => (
<option
key={index}
value={slugify(option, {
lower: true
})}
>
{option}
</option>
))}
</select>
</div>
)