Skip to content
This repository was archived by the owner on Sep 22, 2025. It is now read-only.

Commit c52c936

Browse files
Moving modal title before close button, modal content after close button
1 parent 31fadcc commit c52c936

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/components/modals/Modal.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as Dialog from '@radix-ui/react-dialog';
22

3-
export const Modal = ({ open, setOpen, children, className = '' }) => (
3+
export const Modal = ({ open, setOpen, title, children, className = '' }) => (
44
<Dialog.Root open={open} onOpenChange={(value) => { setOpen(value) }}>
55
<Dialog.Portal>
66
<Dialog.Overlay className="bg-[#0009] data-[state=open]:animate-overlayShow fixed inset-0" />
77
<Dialog.Content className={`data-[state=open]:animate-contentShow fixed top-[30%] left-[50%] max-h-[85vh] w-[90vw] max-w-[770px] translate-x-[-50%] translate-y-[-50%] rounded-[6px] bg-background p-[10px] sm:p-[25px] shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] focus:outline-none ${className} z-40`}>
8-
<Dialog.Description className="text-text mt-1">
9-
{children}
10-
</Dialog.Description>
8+
<Dialog.Title id='modal-title' className='text-2xl'>{title}</Dialog.Title>
119
<Dialog.Close asChild>
1210
<button
1311
className="text-text absolute top-4 right-4 inline-flex h-6 w-6 items-center justify-center hover:opacity-50"
@@ -16,6 +14,9 @@ export const Modal = ({ open, setOpen, children, className = '' }) => (
1614
{`×`}
1715
</button>
1816
</Dialog.Close>
17+
<Dialog.Description className="text-text mt-1">
18+
{children}
19+
</Dialog.Description>
1920
</Dialog.Content>
2021
</Dialog.Portal>
2122
</Dialog.Root>

src/routes/protected/reports/message-details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const MessageDetails = () => {
8787
document.querySelector(`#suggest-${suggestIndex}`)?.focus();
8888
}
8989
else {
90-
document.querySelector(`#suggest-title`)?.focus();
90+
document.querySelector(`#modal-title`)?.focus();
9191
}
9292
}, [open])
9393

@@ -211,8 +211,8 @@ const MessageDetails = () => {
211211
<Modal
212212
open={open}
213213
setOpen={setOpen}
214+
title={`Suggest Issue`}
214215
>
215-
<h1 id='suggest-title' className='text-2xl'>Suggest Issue</h1>
216216
<div role='status'>{!suggestIssueResponse ? `Generating issue... (1 min)` : `Issue generated`}</div>
217217
{suggestIssueResponse && <div className='overflow-y-scroll max-h-[500px]'>
218218
{JSON.stringify({ suggestIssueResponse: suggestIssueResponse?.how_to_implement })}

0 commit comments

Comments
 (0)