1
+ import { useTranslation } from "next-i18next"
1
2
import type { ReactNode } from "react"
2
- import {
3
- Modal ,
4
- ModalBody ,
5
- ModalCloseButton ,
6
- ModalContent ,
7
- ModalHeader ,
8
- ModalOverlay ,
9
- useColorModeValue ,
10
- } from "@chakra-ui/react"
3
+ import { Modal , ModalBody , ModalContent , ModalOverlay } from "@chakra-ui/react"
4
+
5
+ import { Button } from "./ui/buttons/Button"
11
6
12
7
type CodeModalProps = {
13
8
title : string
@@ -17,17 +12,17 @@ type CodeModalProps = {
17
12
}
18
13
19
14
const CodeModal = ( { children, isOpen, setIsOpen, title } : CodeModalProps ) => {
20
- const bgColor = useColorModeValue ( "rgb(247, 247, 247)" , "rgb(25, 25, 25)" )
21
- const borderColor = useColorModeValue ( "rgb(51, 51, 51)" , "rgb(242, 242, 242)" )
15
+ const { t } = useTranslation ( )
22
16
23
17
return (
24
18
< Modal
25
19
isOpen = { isOpen }
26
20
scrollBehavior = "inside"
27
21
onClose = { ( ) => setIsOpen ( false ) }
28
22
>
29
- < ModalOverlay />
23
+ < ModalOverlay hideBelow = "md" />
30
24
< ModalContent
25
+ hideBelow = "md"
31
26
maxW = "100vw"
32
27
marginTop = "auto"
33
28
marginBottom = "0"
@@ -36,34 +31,18 @@ const CodeModal = ({ children, isOpen, setIsOpen, title }: CodeModalProps) => {
36
31
p = { { base : "0" , md : "0" } }
37
32
gap = "0"
38
33
>
39
- < ModalHeader
40
- bg = { bgColor }
41
- borderColor = { borderColor }
42
- borderTop = "1px solid"
43
- borderBottom = "1px solid"
44
- textTransform = "uppercase"
45
- fontWeight = "normal"
46
- fontSize = "md"
47
- fontFamily = "monospace"
48
- px = "6"
49
- py = "4"
50
- me = "0"
51
- >
52
- { title }
53
- </ ModalHeader >
54
- < ModalCloseButton
55
- position = "absolute"
56
- padding = "0"
57
- width = "24px"
58
- height = "24px"
59
- borderRadius = "0"
60
- color = "rgb(178, 178, 178)"
61
- fontSize = "sm"
62
- margin = "0"
63
- top = "4"
64
- insetInlineEnd = "4"
65
- bottom = "4"
66
- />
34
+ < div className = "flex items-center border-y bg-background px-6 py-3 font-monospace uppercase" >
35
+ < h2 className = "text-md font-normal" > { title } </ h2 >
36
+ < Button
37
+ variant = "ghost"
38
+ className = "ms-auto text-sm"
39
+ size = "sm"
40
+ isSecondary
41
+ onClick = { ( ) => setIsOpen ( false ) }
42
+ >
43
+ { t ( "close" ) }
44
+ </ Button >
45
+ </ div >
67
46
< ModalBody p = "0" > { children } </ ModalBody >
68
47
</ ModalContent >
69
48
</ Modal >
0 commit comments