Skip to content

Commit

Permalink
feat: reorderable list now saves on backout
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed Mar 29, 2023
1 parent 26fae13 commit b1591f8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/custom-components/ReorderableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export function ReorderableList<T>(props: ReorderableListProps<T>) {
}
}

function saveOnBackout(e: Event) {
const event = e as CustomEvent;
if (event.detail.button == GamepadButton.CANCEL) {
toggleReorderEnabled();
}
}

return (
<Fragment>
<div
Expand All @@ -70,6 +77,7 @@ export function ReorderableList<T>(props: ReorderableListProps<T>) {
onSecondaryButton={toggleReorderEnabled}
onSecondaryActionDescription={reorderEnabled ? 'Save Order' : 'Reorder'}
onClick={toggleReorderEnabled}
onButtonDown={saveOnBackout}
>
{entryList.map((entry: ReorderableEntry<T>) => (
<ReorderableItem
Expand Down

0 comments on commit b1591f8

Please sign in to comment.