Skip to content

Commit 7f53d52

Browse files
committed
feat: migrate AdoptionChart to tailwind
1 parent b7e4be2 commit 7f53d52

File tree

1 file changed

+21
-32
lines changed

1 file changed

+21
-32
lines changed

src/components/AdoptionChart.tsx

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,39 @@
11
import { useTranslation } from "next-i18next"
22
import { useTheme } from "next-themes"
3-
import { Box, type BoxProps, Flex } from "@chakra-ui/react"
43

54
import type { ChildOnlyProp } from "@/lib/types"
65

6+
import { cn } from "@/lib/utils/cn"
7+
8+
import { Flex } from "./ui/flex"
9+
10+
type CellProps = ChildOnlyProp & {
11+
color?: string
12+
className?: string
13+
}
14+
715
const Column = ({ children }: ChildOnlyProp) => (
8-
<Flex
9-
flexDirection="column-reverse"
10-
ms={{ base: 2, md: 4 }}
11-
_first={{ ms: 0 }}
12-
>
13-
{children}
14-
</Flex>
16+
<Flex className="ms-2 flex-col-reverse first:ms-0 md:ms-4">{children}</Flex>
1517
)
1618

17-
const Cell = ({ children, color, ...props }: BoxProps) => (
18-
<Box
19-
border="1px solid"
20-
borderColor={color || "text"}
21-
color={color || "text"}
22-
py="0.8rem"
23-
px={{ base: 2, md: "1.2rem" }}
24-
fontSize="0.9rem"
25-
fontWeight="bold"
26-
lineHeight="none"
27-
textAlign="center"
28-
_last={{
29-
borderTopStartRadius: "2xl",
30-
borderTopEndRadius: "2xl",
31-
}}
32-
sx={{
33-
"&:nth-child(-n + 2)": {
34-
borderBottomStartRadius: "2xl",
35-
borderBottomEndRadius: "2xl",
36-
},
19+
const Cell = ({ children, color, className, ...props }: CellProps) => (
20+
<div
21+
className={cn(
22+
"border border-solid px-2 py-[0.8rem] text-center text-[0.9rem] font-bold leading-none last:rounded-t-2xl md:px-[1.2rem] [&:nth-child(-n+2)]:rounded-bl-2xl [&:nth-child(-n+2)]:rounded-br-2xl",
23+
className
24+
)}
25+
style={{
26+
borderColor: color || "currentcolor",
27+
color: color || "currentcolor",
3728
}}
3829
{...props}
3930
>
4031
{children}
41-
</Box>
32+
</div>
4233
)
4334

4435
const ColumnName = ({ children }: ChildOnlyProp) => (
45-
<Cell border="none" pt={6}>
46-
{children}
47-
</Cell>
36+
<Cell className={"border-none pt-6"}>{children}</Cell>
4837
)
4938

5039
const AdoptionChart = () => {

0 commit comments

Comments
 (0)