Skip to content

Commit

Permalink
fix hotkey handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
suren-atoyan committed Apr 18, 2022
1 parent 3a874c9 commit 27dd6d2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sections/HotKeys/HotKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function HotKeys() {
// But the `react-hotkeys-hook` library, which we use to handle hotkeys provides only hook (`useHotkeys`).
// And as you know we can't use hooks inside loops (read "Rules of Hooks" - https://reactjs.org/docs/hooks-rules.html).
// There is always a workaround, but sometimes it's better to avoid premature and unnecessary optimizations :)
useHotkeys('alt+s', themeActions.toggle);
useHotkeys('alt+t', sidebarActions.toggle);
useHotkeys('alt+s', sidebarActions.toggle);
useHotkeys('alt+t', themeActions.toggle);
useHotkeys('alt+/', hotKeysDialogActions.toggle);

return (
Expand All @@ -30,14 +30,14 @@ function HotKeys() {
<DialogContent>
<FlexBox alignItems="center" height={50} justifyContent="space-between">
<Typography>Toggle Theme</Typography>
<Button color="warning" variant="outlined" onClick={themeActions.toggle}>
alt + s
<Button color="warning" variant="outlined" onClick={sidebarActions.toggle}>
alt + t
</Button>
</FlexBox>
<FlexBox alignItems="center" height={50} justifyContent="space-between">
<Typography>Toggle Sidebar</Typography>
<Button color="warning" variant="outlined" onClick={sidebarActions.toggle}>
alt + t
<Button color="warning" variant="outlined" onClick={themeActions.toggle}>
alt + s
</Button>
</FlexBox>
<FlexBox alignItems="center" height={50} justifyContent="space-between">
Expand Down

0 comments on commit 27dd6d2

Please sign in to comment.