Skip to content

Commit f51da66

Browse files
committed
fix command bar outside modal
1 parent 45f1b06 commit f51da66

File tree

1 file changed

+62
-65
lines changed

1 file changed

+62
-65
lines changed

category-images/src/admin/components/category-media/category-media-modal.tsx

Lines changed: 62 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -211,76 +211,73 @@ export const CategoryMediaModal = ({
211211
}
212212

213213
return (
214-
<>
215-
<CommandBar open={selectedImageIds.size > 0}>
216-
<CommandBar.Bar>
217-
<CommandBar.Value>
218-
{selectedImageIds.size} selected
219-
</CommandBar.Value>
220-
<CommandBar.Seperator />
221-
<CommandBar.Command
222-
action={handleSetAsThumbnail}
223-
label="Set as thumbnail"
224-
shortcut="t"
225-
disabled={selectedImageIds.size !== 1}
226-
/>
227-
<CommandBar.Seperator />
228-
<CommandBar.Command
229-
action={handleDelete}
230-
label="Delete"
231-
shortcut="d"
232-
/>
233-
</CommandBar.Bar>
234-
</CommandBar>
214+
<FocusModal open={open} onOpenChange={handleOpenChange}>
215+
<FocusModal.Trigger asChild>
216+
<Button size="small" variant="secondary">
217+
Edit
218+
</Button>
219+
</FocusModal.Trigger>
235220

236-
<FocusModal open={open} onOpenChange={handleOpenChange}>
237-
<FocusModal.Trigger asChild>
238-
<Button size="small" variant="secondary">
239-
Edit
240-
</Button>
241-
</FocusModal.Trigger>
221+
<FocusModal.Content>
222+
<FocusModal.Header>
223+
<Heading>Edit Media</Heading>
224+
</FocusModal.Header>
242225

243-
<FocusModal.Content>
244-
<FocusModal.Header>
245-
<Heading>Edit Media</Heading>
246-
</FocusModal.Header>
247-
248-
<FocusModal.Body className="flex h-full overflow-hidden">
249-
<div className="flex w-full h-full flex-col-reverse lg:grid lg:grid-cols-[1fr_560px]">
250-
<CategoryImageGallery
251-
existingImages={existingImages}
252-
uploadedFiles={uploadedFiles}
253-
imagesToDelete={imagesToDelete}
254-
currentThumbnailId={currentThumbnailId}
255-
selectedImageIds={selectedImageIds}
256-
onToggleSelect={handleImageSelection}
226+
<FocusModal.Body className="flex h-full overflow-hidden">
227+
<div className="flex w-full h-full flex-col-reverse lg:grid lg:grid-cols-[1fr_560px]">
228+
<CategoryImageGallery
229+
existingImages={existingImages}
230+
uploadedFiles={uploadedFiles}
231+
imagesToDelete={imagesToDelete}
232+
currentThumbnailId={currentThumbnailId}
233+
selectedImageIds={selectedImageIds}
234+
onToggleSelect={handleImageSelection}
235+
/>
236+
<CategoryImageUpload
237+
fileInputRef={fileInputRef}
238+
isUploading={uploadFilesMutation.isPending}
239+
onFileSelect={handleUploadFile}
240+
/>
241+
</div>
242+
<CommandBar open={selectedImageIds.size > 0}>
243+
<CommandBar.Bar>
244+
<CommandBar.Value>
245+
{selectedImageIds.size} selected
246+
</CommandBar.Value>
247+
<CommandBar.Seperator />
248+
<CommandBar.Command
249+
action={handleSetAsThumbnail}
250+
label="Set as thumbnail"
251+
shortcut="t"
252+
disabled={selectedImageIds.size !== 1}
257253
/>
258-
<CategoryImageUpload
259-
fileInputRef={fileInputRef}
260-
isUploading={uploadFilesMutation.isPending}
261-
onFileSelect={handleUploadFile}
254+
<CommandBar.Seperator />
255+
<CommandBar.Command
256+
action={handleDelete}
257+
label="Delete"
258+
shortcut="d"
262259
/>
263-
</div>
264-
</FocusModal.Body>
265-
<FocusModal.Footer>
266-
<div className="flex items-center justify-end gap-x-2">
267-
<FocusModal.Close asChild>
268-
<Button size="small" variant="secondary">
269-
Cancel
270-
</Button>
271-
</FocusModal.Close>
272-
<Button
273-
size="small"
274-
onClick={handleSave}
275-
isLoading={isSaving}
276-
>
277-
Save
260+
</CommandBar.Bar>
261+
</CommandBar>
262+
</FocusModal.Body>
263+
<FocusModal.Footer>
264+
<div className="flex items-center justify-end gap-x-2">
265+
<FocusModal.Close asChild>
266+
<Button size="small" variant="secondary">
267+
Cancel
278268
</Button>
279-
</div>
280-
</FocusModal.Footer>
281-
</FocusModal.Content>
282-
</FocusModal>
283-
</>
269+
</FocusModal.Close>
270+
<Button
271+
size="small"
272+
onClick={handleSave}
273+
isLoading={isSaving}
274+
>
275+
Save
276+
</Button>
277+
</div>
278+
</FocusModal.Footer>
279+
</FocusModal.Content>
280+
</FocusModal>
284281
)
285282
}
286283

0 commit comments

Comments
 (0)