mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -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])
|
||||
|
||||
return (
|
||||
<Modal
|
||||
{...cypressId(props)}
|
||||
show={show}
|
||||
onHide={onHide}
|
||||
animation={true}
|
||||
dialogClassName={`text-dark ${additionalClasses ?? ''}`}
|
||||
size={modalSize}>
|
||||
<Modal.Header closeButton={!!showCloseButton}>
|
||||
<Modal.Title>
|
||||
<ShowIf condition={!!titleIcon}>
|
||||
<ForkAwesomeIcon icon={titleIcon as IconName} />
|
||||
|
||||
</ShowIf>
|
||||
{titleElement}
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
{children}
|
||||
</Modal>
|
||||
<ShowIf condition={show}>
|
||||
<Modal
|
||||
{...cypressId(props)}
|
||||
show={show}
|
||||
onHide={onHide}
|
||||
animation={true}
|
||||
dialogClassName={`text-dark ${additionalClasses ?? ''}`}
|
||||
size={modalSize}>
|
||||
<Modal.Header closeButton={!!showCloseButton}>
|
||||
<Modal.Title>
|
||||
<ShowIf condition={!!titleIcon}>
|
||||
<ForkAwesomeIcon icon={titleIcon as IconName} />
|
||||
|
||||
</ShowIf>
|
||||
{titleElement}
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
{children}
|
||||
</Modal>
|
||||
</ShowIf>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue