Skip to content

Commit

Permalink
Fix the layout toggle keyboard shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
manojVivek committed Jan 19, 2025
1 parent 00bfd22 commit f5b0ca6
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ const PreviewLayoutSelector = () => {
dispatch(setLayout(newLayout));
};

useKeyboardShortcut(SHORTCUT_CHANNEL.PREVIEW_LAYOUT, handleLayout);
const toggleNextLayout = () => {
const layouts = Object.values(PREVIEW_LAYOUTS);
const currentIndex = layouts.findIndex((l) => l === layout);
const nextIndex = (currentIndex + 1) % layouts.length;
dispatch(setLayout(layouts[nextIndex]));
};

useKeyboardShortcut(SHORTCUT_CHANNEL.PREVIEW_LAYOUT, toggleNextLayout);

return (
<div className="flex flex-row items-center justify-start px-4">
Expand Down

0 comments on commit f5b0ca6

Please sign in to comment.