Skip to content

Commit 1d1f65b

Browse files
feat(MergeInfographic): migrate to Tailwind
1 parent 7a2ad0f commit 1d1f65b

File tree

1 file changed

+43
-59
lines changed

1 file changed

+43
-59
lines changed

src/components/MergeInfographic/index.tsx

Lines changed: 43 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,83 @@
11
import { useTranslation } from "next-i18next"
2-
import { AspectRatio, Box, chakra, Icon } from "@chakra-ui/react"
2+
import type { SVGTextElementAttributes } from "react"
33

44
import Translation from "@/components/Translation"
55

6+
import { cn } from "@/lib/utils/cn"
7+
8+
import { createIconBase } from "../icons/icon-base"
9+
import { HStack } from "../ui/flex"
10+
611
import { Background } from "./Background"
712

8-
const Text = chakra("text", {
9-
baseStyle: {
10-
textAnchor: "start",
11-
fill: "currentColor",
12-
},
13-
})
13+
const Text = ({
14+
className,
15+
...rest
16+
}: SVGTextElementAttributes<SVGTextElement>) => (
17+
<text
18+
className={cn("fill-current [text-anchor:start]", className)}
19+
{...rest}
20+
/>
21+
)
1422

15-
const SvgText = () => {
23+
const SvgTextInternal = () => {
1624
const { t } = useTranslation(["page-upgrades-index"])
17-
const [sm, lg] = ["7px", "8px"]
25+
const [sm, lg] = ["text-[7px]", "text-[8px]"]
1826

1927
return (
20-
<Icon
21-
position="absolute"
22-
zIndex={1}
23-
width="100%"
24-
height="100%"
25-
viewBox="0 0 250 110"
26-
version="1.1"
27-
xmlns="http://www.w3.org/2000/svg"
28-
xmlnsXlink="http://www.w3.org/1999/xlink"
29-
aria-hidden="true"
30-
>
31-
<Text x="2%" y="35%" fontSize={lg}>
28+
<>
29+
<Text className={lg} x="2%" y="35%">
3230
{t("page-upgrades-index:docs-nav-proof-of-work")}
3331
</Text>
34-
<Text x="47%" y="35%" fontSize={lg}>
32+
<Text className={lg} x="47%" y="35%">
3533
🌱 {t("page-upgrades-index:docs-nav-proof-of-stake")}
3634
</Text>
37-
<Text x="11%" y="70%" fontSize={sm}>
35+
<Text className={sm} x="11%" y="70%">
3836
🚀 {t("common:beacon-chain")}
3937
</Text>
40-
<Text x="43%" y="12.5%" fontSize={sm}>
38+
<Text className={sm} x="43%" y="12.5%">
4139
🐼 {t("page-upgrades-index:page-upgrades-get-involved-ethresearch-2")}
4240
</Text>
43-
<Text x="63%" y="95%" fontSize={sm}>
41+
<Text className={sm} x="63%" y="95%">
4442
🌳 {t("page-upgrades-index:page-upgrades-get-involved-ethresearch-1")}
4543
</Text>
46-
</Icon>
44+
</>
4745
)
4846
}
4947

48+
const SvgText = createIconBase({
49+
displayName: "SvgText",
50+
viewBox: "0 0 250 110",
51+
version: "1.1",
52+
xmlns: "http://www.w3.org/2000/svg",
53+
xmlnsXlink: "http://www.w3.org/1999/xlink",
54+
"aria-hidden": true,
55+
className: "absolute size-full z-[1]",
56+
children: <SvgTextInternal />,
57+
})
58+
5059
const MergeInfographic = () => {
5160
const { t } = useTranslation()
5261

5362
return (
54-
<AspectRatio
63+
<div
64+
className="relative isolate aspect-[25/11] w-full"
5565
role="img"
5666
aria-label={t(
5767
"page-upgrades-index:page-upgrades-merge-infographic-alt-text"
5868
)}
59-
position="relative"
60-
width="100%"
61-
ratio={25 / 11}
62-
sx={{
63-
isolation: "isolate",
64-
}}
6569
>
66-
<Box>
67-
<Box
68-
position="absolute"
69-
top="40%"
70-
insetInlineStart="2%"
71-
width="81%"
72-
height="18%"
73-
margin={0}
74-
padding={0}
75-
zIndex={2}
76-
display="flex"
77-
justifyContent="center"
78-
alignItems="center"
79-
lineHeight="1em"
80-
textAlign="center"
81-
maxHeight="2em"
82-
color="background.base"
83-
fontSize={{
84-
base: "0.625em",
85-
sm: "0.875em",
86-
md: "1.125em",
87-
lg: "1.375em",
88-
}}
70+
<div>
71+
<HStack
72+
className="absolute left-[2%] top-[40%] z-[2] h-[18%] max-h-[2em] w-[81%] justify-center text-center text-[0.625em] leading-[1em] text-background sm:text-[0.875em] md:text-[1.125em] lg:text-[1.375em]"
8973
aria-hidden="true"
9074
>
9175
<Translation id="page-upgrades:page-upgrades-merge-infographic-el" />
92-
</Box>
76+
</HStack>
9377
<SvgText />
9478
<Background className="absolute z-0 size-full" aria-hidden="true" />
95-
</Box>
96-
</AspectRatio>
79+
</div>
80+
</div>
9781
)
9882
}
9983

0 commit comments

Comments
 (0)