1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-06-30 20:23:59 +00:00

Add Natural sort order for list of options

This commit is contained in:
Aleksandr Gumroian 2020-07-17 13:39:28 +02:00
parent 5eb6b90ed4
commit 597b6fcf4c
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733

View File

@ -28,10 +28,11 @@ export function Select({
}) {
const uid = useUID();
const options = Object.keys(choices).map(
const options = Object.keys(choices).sort(
(a, b) => a - b || a.toString().localeCompare(b.toString()),
).map(
(key) => <option key={key} value={key}>{choices[key]}</option>,
);
return (
<div className="form-group">
<label htmlFor={uid}>{label}</label>