mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-04-19 08:06:40 +02: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…
x
Reference in New Issue
Block a user