shlink-web-client/test/__helpers__/TestModalWrapper.tsx
2022-11-22 20:18:11 +01:00

14 lines
385 B
TypeScript

import { FC, ReactElement } from 'react';
import { useToggle } from '../../src/utils/helpers/hooks';
interface RenderModalArgs {
isOpen: boolean;
toggle: () => void;
}
export const TestModalWrapper: FC<{ renderModal: (args: RenderModalArgs) => ReactElement }> = (
{ renderModal },
) => {
const [isOpen, toggle] = useToggle(true);
return renderModal({ isOpen, toggle });
};