mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-11 18:13:47 +00:00
Migrate DeleteServerModal to tailwind components
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { FC, ReactElement } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useCallback, useEffect , useState } from 'react';
|
||||
|
||||
export type RenderModalArgs = {
|
||||
open: boolean;
|
||||
@@ -12,5 +12,13 @@ export const TestModalWrapper: FC<{ renderModal: (args: RenderModalArgs) => Reac
|
||||
const [open, setOpen] = useState(true);
|
||||
const onClose = useCallback(() => setOpen(false), []);
|
||||
|
||||
// Workaround to ensure CardModals from shlink-frontend-shared can be closed, as they depend on CSS transitions
|
||||
// Since JSDOM does not support them, this dispatches the event right after the listener has been set-up
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
document.querySelector('[data-testid="transition-container"]')?.dispatchEvent(new Event('transitionend'));
|
||||
}
|
||||
}, [open]);
|
||||
|
||||
return renderModal({ open, onClose });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user