Skip to content

Commit 6ba48e4

Browse files
committed
chore: partially update CodeModal to tw
1 parent b2a7ed1 commit 6ba48e4

File tree

1 file changed

+19
-40
lines changed

1 file changed

+19
-40
lines changed

src/components/CodeModal.tsx

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1+
import { useTranslation } from "next-i18next"
12
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"
116

127
type CodeModalProps = {
138
title: string
@@ -17,17 +12,17 @@ type CodeModalProps = {
1712
}
1813

1914
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()
2216

2317
return (
2418
<Modal
2519
isOpen={isOpen}
2620
scrollBehavior="inside"
2721
onClose={() => setIsOpen(false)}
2822
>
29-
<ModalOverlay />
23+
<ModalOverlay hideBelow="md" />
3024
<ModalContent
25+
hideBelow="md"
3126
maxW="100vw"
3227
marginTop="auto"
3328
marginBottom="0"
@@ -36,34 +31,18 @@ const CodeModal = ({ children, isOpen, setIsOpen, title }: CodeModalProps) => {
3631
p={{ base: "0", md: "0" }}
3732
gap="0"
3833
>
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>
6746
<ModalBody p="0">{children}</ModalBody>
6847
</ModalContent>
6948
</Modal>

0 commit comments

Comments
 (0)