mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-26 03:33:58 -05:00
Add condition to modal
This way we prevent unwanted data loading, invisible updates and visual artifacts when the modal isn't visible. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
89eac12a38
commit
9500887ee6
1 changed files with 20 additions and 18 deletions
|
@ -48,23 +48,25 @@ export const CommonModal: React.FC<CommonModalProps> = ({
|
||||||
}, [title, titleIsI18nKey])
|
}, [title, titleIsI18nKey])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<ShowIf condition={show}>
|
||||||
{...cypressId(props)}
|
<Modal
|
||||||
show={show}
|
{...cypressId(props)}
|
||||||
onHide={onHide}
|
show={show}
|
||||||
animation={true}
|
onHide={onHide}
|
||||||
dialogClassName={`text-dark ${additionalClasses ?? ''}`}
|
animation={true}
|
||||||
size={modalSize}>
|
dialogClassName={`text-dark ${additionalClasses ?? ''}`}
|
||||||
<Modal.Header closeButton={!!showCloseButton}>
|
size={modalSize}>
|
||||||
<Modal.Title>
|
<Modal.Header closeButton={!!showCloseButton}>
|
||||||
<ShowIf condition={!!titleIcon}>
|
<Modal.Title>
|
||||||
<ForkAwesomeIcon icon={titleIcon as IconName} />
|
<ShowIf condition={!!titleIcon}>
|
||||||
|
<ForkAwesomeIcon icon={titleIcon as IconName} />
|
||||||
</ShowIf>
|
|
||||||
{titleElement}
|
</ShowIf>
|
||||||
</Modal.Title>
|
{titleElement}
|
||||||
</Modal.Header>
|
</Modal.Title>
|
||||||
{children}
|
</Modal.Header>
|
||||||
</Modal>
|
{children}
|
||||||
|
</Modal>
|
||||||
|
</ShowIf>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue