@@ -2,9 +2,15 @@ import { Children, type ReactElement } from "react"
2
2
import { useTranslation } from "next-i18next"
3
3
import { IoMdCopy } from "react-icons/io"
4
4
import { MdCheck } from "react-icons/md"
5
- import { Modal , ModalBody , ModalContent , ModalOverlay } from "@chakra-ui/react"
6
5
7
6
import { Button } from "./ui/buttons/Button"
7
+ import {
8
+ Dialog ,
9
+ DialogContent ,
10
+ DialogDescription ,
11
+ DialogHeader ,
12
+ DialogTitle ,
13
+ } from "./ui/dialog-modal"
8
14
9
15
import { useClipboard } from "@/hooks/useClipboard"
10
16
@@ -23,39 +29,18 @@ const CodeModal = ({ children, isOpen, setIsOpen, title }: CodeModalProps) => {
23
29
const { onCopy, hasCopied } = useClipboard ( )
24
30
25
31
return (
26
- < Modal
27
- isOpen = { isOpen }
28
- scrollBehavior = "inside"
29
- onClose = { ( ) => setIsOpen ( false ) }
30
- >
31
- < ModalOverlay hideBelow = "md" />
32
- < ModalContent
33
- hideBelow = "md"
34
- maxW = "100vw"
35
- marginTop = "auto"
36
- marginBottom = "0"
37
- maxHeight = "50%"
38
- borderRadius = "0"
39
- p = { { base : "0" , md : "0" } }
40
- gap = "0"
41
- >
42
- < div className = "flex items-center border-y bg-background px-6 py-3 font-monospace uppercase" >
43
- < h2 className = "text-md font-normal" > { title } </ h2 >
44
- < Button
45
- variant = "ghost"
46
- className = "ms-auto text-sm"
47
- size = "sm"
48
- isSecondary
49
- onClick = { ( ) => setIsOpen ( false ) }
50
- >
51
- { t ( "close" ) }
52
- </ Button >
53
- </ div >
54
- < ModalBody p = "0" > { children } </ ModalBody >
32
+ < Dialog open = { isOpen } onOpenChange = { setIsOpen } >
33
+ < DialogContent className = "absolute inset-0 mb-0 mt-auto max-h-[50%] max-w-[100vw]" >
34
+ < DialogHeader >
35
+ < DialogTitle > { title } </ DialogTitle >
36
+ </ DialogHeader >
37
+ < DialogDescription asChild >
38
+ < div className = "overflow-y-auto" > { children } </ div >
39
+ </ DialogDescription >
55
40
< Button
56
41
variant = "outline"
57
42
onClick = { ( ) => onCopy ( codeSnippet ) }
58
- className = "absolute right-4 top-20 " // Force right, code always LTR
43
+ className = "absolute right-19 top-24 " // Force right, code always LTR
59
44
>
60
45
{ hasCopied ? (
61
46
< >
@@ -67,8 +52,8 @@ const CodeModal = ({ children, isOpen, setIsOpen, title }: CodeModalProps) => {
67
52
</ >
68
53
) }
69
54
</ Button >
70
- </ ModalContent >
71
- </ Modal >
55
+ </ DialogContent >
56
+ </ Dialog >
72
57
)
73
58
}
74
59
0 commit comments