Skip to content

Commit

Permalink
Update packages/smarthr-ui/src/components/Dropdown/SortDropdown/useSo…
Browse files Browse the repository at this point in the history
…rtDropdown.ts

Co-authored-by: たふみ <[email protected]>
  • Loading branch information
AtsushiM and Qs-F authored Feb 5, 2025
1 parent 2da43ca commit 4d49707
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,18 @@ export const useSortDropdown = ({ sortFields, defaultOrder, onApply, decorators
const select = e.currentTarget
const newLabel = select.options[select.selectedIndex].label
const newFields = innerFields.map((field) => {
if (field.label === newLabel) {
if (!field.selected) {
return {
...field,
selected: true,
}
}
} else if (field.selected) {
if (field.label !== newLabel && field.selected) {
return {
...field,
selected: false,
}
}
if (field.label === newLabel && !field.selected) {
return {
...field,
selected: true,
}
}

return field
})
Expand Down

0 comments on commit 4d49707

Please sign in to comment.