Skip to content

Commit 325626e

Browse files
committed
Only render the modal when needed
1 parent 80ecd58 commit 325626e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

resources/scripts/components/server/files/FileDropdownMenu.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,15 @@ export default ({ file }: { file: FileObject }) => {
116116
renderToggle={onClick => (
117117
<div css={tw`p-3 hover:text-white`} onClick={onClick}>
118118
<FontAwesomeIcon icon={faEllipsisH}/>
119+
{!!modal &&
119120
<RenameFileModal
121+
visible
122+
appear
120123
files={[ file.name ]}
121-
visible={!!modal}
122124
useMoveTerminology={modal === 'move'}
123125
onDismissed={() => setModal(null)}
124126
/>
127+
}
125128
<SpinnerOverlay visible={showSpinner} fixed size={'large'}/>
126129
</div>
127130
)}

resources/scripts/components/server/files/MassActionsBar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,15 @@ const MassActionsBar = () => {
7676
>
7777
Deleting files is a permanent operation, you cannot undo this action.
7878
</ConfirmationModal>
79+
{showMove &&
7980
<RenameFileModal
8081
files={selectedFiles}
81-
visible={showMove}
82+
visible
83+
appear
8284
useMoveTerminology
8385
onDismissed={() => setShowMove(false)}
8486
/>
87+
}
8588
<div css={tw`rounded p-4 mb-6`} style={{ background: 'rgba(0, 0, 0, 0.35)' }}>
8689
<Button size={'xsmall'} css={tw`mr-4`} onClick={() => setShowMove(true)}>
8790
<FontAwesomeIcon icon={faLevelUpAlt} css={tw`mr-2`}/> Move

0 commit comments

Comments
 (0)