Replace react-hotkeys with updated fork for Vite compatibility

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-02-26 14:43:39 +01:00
parent 5ec0b8e3e2
commit 9174bd774a
3 changed files with 17 additions and 43 deletions

View File

@ -1,22 +1,14 @@
import { HotKeys as _HotKeys, type HotKeysProps } from '@mkljczk/react-hotkeys';
import React from 'react';
import { HotKeys as _HotKeys } from 'react-hotkeys';
type IHotKeys = React.ComponentProps<typeof _HotKeys>;
/**
* Wrapper component around `react-hotkeys`.
* `react-hotkeys` is a legacy component, so confining its import to one place is beneficial.
*
* NOTE: Temporarily disabled due to incompatibility with Vite.
*/
const HotKeys = React.forwardRef<any, IHotKeys>(({ children, ...rest }, ref) => {
// return (
// <_HotKeys {...rest} ref={ref}>
// {children}
// </_HotKeys>
// );
const HotKeys = React.forwardRef<any, HotKeysProps>(({ children, ...rest }, ref) => (
<_HotKeys {...rest} ref={ref}>
{children}
</_HotKeys>
));
return <>{children}</>;
});
export { HotKeys, type IHotKeys };
export { HotKeys, type HotKeysProps as IHotKeys };