shlink-web-client/test/__helpers__/TestModalWrapper.tsx

15 lines
390 B
TypeScript
Raw Normal View History

import { useToggle } from '@shlinkio/shlink-frontend-kit';
2023-02-18 12:40:37 +03:00
import type { FC, ReactElement } from 'react';
2022-11-22 22:18:11 +03:00
interface RenderModalArgs {
isOpen: boolean;
toggle: () => void;
}
export const TestModalWrapper: FC<{ renderModal: (args: RenderModalArgs) => ReactElement }> = (
{ renderModal },
) => {
const [isOpen, toggle] = useToggle(true);
return renderModal({ isOpen, toggle });
};