mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-24 00:01:36 +01:00
Add Natural sort order for list of options
This commit is contained in:
parent
5eb6b90ed4
commit
597b6fcf4c
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user