2022-03-02 16:44:11 +00:00
|
|
|
import { useHotkeys } from 'react-hotkeys-hook';
|
|
|
|
|
|
|
|
import { toggleSidebar } from '@/store/build/buildSlice';
|
|
|
|
import { useAppDispatch } from '@/store/hooks';
|
|
|
|
|
2022-04-30 10:58:17 +00:00
|
|
|
const HotkeysWrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
|
2022-03-02 16:44:11 +00:00
|
|
|
const dispatch = useAppDispatch();
|
|
|
|
|
|
|
|
useHotkeys('ctrl+/, cmd+/', () => {
|
|
|
|
dispatch(toggleSidebar({ sidebar: 'left' }));
|
|
|
|
dispatch(toggleSidebar({ sidebar: 'right' }));
|
|
|
|
});
|
|
|
|
|
|
|
|
return <>{children}</>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default HotkeysWrapper;
|