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

15 lines
393 B
TypeScript
Raw Normal View History

import type { FC, ReactElement } from 'react';
2023-08-04 12:16:01 +03:00
import { useToggle } from '../../../shlink-frontend-kit/src';
interface RenderModalArgs {
isOpen: boolean;
toggle: () => void;
}
export const TestModalWrapper: FC<{ renderModal: (args: RenderModalArgs) => ReactElement }> = (
{ renderModal },
) => {
const [isOpen, toggle] = useToggle(true);
return renderModal({ isOpen, toggle });
};