Files
Reactive-Resume/client/wrappers/HotkeysWrapper.tsx
Amruth Pillai 9c1380f401 🚀 release v3.0.0
2022-03-06 22:48:29 +01:00

18 lines
455 B
TypeScript

import { useHotkeys } from 'react-hotkeys-hook';
import { toggleSidebar } from '@/store/build/buildSlice';
import { useAppDispatch } from '@/store/hooks';
const HotkeysWrapper: React.FC = ({ children }) => {
const dispatch = useAppDispatch();
useHotkeys('ctrl+/, cmd+/', () => {
dispatch(toggleSidebar({ sidebar: 'left' }));
dispatch(toggleSidebar({ sidebar: 'right' }));
});
return <>{children}</>;
};
export default HotkeysWrapper;