Skip to content

Commit 1ce671b

Browse files
authored
Merge pull request #14104 from Baystef/migrate/stakingstatsbox
Migrate Staking/StakingStatsBox to Shadcn/Tailwind
2 parents d60ae45 + 35cc645 commit 1ce671b

File tree

1 file changed

+16
-47
lines changed

1 file changed

+16
-47
lines changed

src/components/Staking/StakingStatsBox.tsx

Lines changed: 16 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,35 @@
11
import { useRouter } from "next/router"
22
import { useTranslation } from "next-i18next"
33
import { MdInfoOutline } from "react-icons/md"
4-
import { Box, Code, Flex, Icon, VStack } from "@chakra-ui/react"
54

65
import type { ChildOnlyProp, Lang, StakingStatsData } from "@/lib/types"
76

87
import InlineLink from "@/components/Link"
9-
import Text from "@/components/OldText"
108
import Tooltip from "@/components/Tooltip"
9+
import { Flex, VStack } from "@/components/ui/flex"
1110

1211
import { getLocaleForNumberFormat } from "@/lib/utils/translations"
1312

1413
const Cell = ({ children }: ChildOnlyProp) => (
15-
<VStack
16-
spacing={2}
17-
py={4}
18-
px={8}
19-
borderInlineStart={{ md: "1px" }}
20-
borderTop={{ base: "1px", md: "none" }}
21-
// `!important` needed to force an override of the user-agent
22-
borderColor="preBorder !important"
23-
_first={{
24-
borderInlineStart: "none",
25-
borderTop: "none",
26-
}}
27-
>
28-
{children}
29-
</VStack>
14+
<VStack className="gap-2 px-8 py-4">{children}</VStack>
3015
)
3116

3217
const Value = ({ children }: ChildOnlyProp) => (
33-
<Code
34-
fontWeight="bold"
35-
fontSize="2rem"
36-
background="none"
37-
color="primary.base"
38-
p={0}
39-
>
18+
<code className="inline-block bg-none p-0 pe-1 font-monospace text-3xl font-bold text-primary">
4019
{children}
41-
</Code>
20+
</code>
4221
)
4322

4423
const Label = ({ children }: ChildOnlyProp) => (
45-
<Flex alignItems="center" textTransform="uppercase" fontSize="sm">
24+
<Flex className="items-center justify-center gap-2 text-sm uppercase">
4625
{children}
4726
</Flex>
4827
)
4928

5029
// BeaconchainTooltip component
5130
const BeaconchainTooltip = ({ children }: ChildOnlyProp) => (
5231
<Tooltip content={children}>
53-
<Box as="span" marginInlineStart={2}>
54-
<Icon
55-
as={MdInfoOutline}
56-
color="text"
57-
_hover={{ color: "primary.base" }}
58-
_active={{ color: "primary.base" }}
59-
_focus={{ color: "primary.base" }}
60-
boxSize={4}
61-
verticalAlign="middle"
62-
/>
63-
</Box>
32+
<MdInfoOutline className="active:primary focus:primary h-4 w-4 align-middle hover:text-primary" />
6433
</Tooltip>
6534
)
6635

@@ -90,17 +59,17 @@ const StakingStatsBox = ({ data }: StakingStatsBoxProps) => {
9059
const currentApr = formatPercentage(data.apr)
9160

9261
return (
93-
<Flex direction={{ base: "column", md: "row" }}>
62+
<Flex className="flex-col md:flex-row">
9463
<Cell>
9564
<Value>{totalEth}</Value>
9665
<Label>
9766
{t("page-staking-stats-box-metric-1")}
9867
<BeaconchainTooltip>
99-
<Box textTransform="none">
100-
<Text>{t("page-staking-stats-box-metric-1-tooltip")}</Text>
68+
<div className="normal-case">
69+
<p>{t("page-staking-stats-box-metric-1-tooltip")}</p>
10170
{t("common:data-provided-by")}{" "}
10271
<InlineLink href="https://beaconcha.in/">Beaconcha.in</InlineLink>
103-
</Box>
72+
</div>
10473
</BeaconchainTooltip>
10574
</Label>
10675
</Cell>
@@ -109,11 +78,11 @@ const StakingStatsBox = ({ data }: StakingStatsBoxProps) => {
10978
<Label>
11079
{t("page-staking-stats-box-metric-2")}
11180
<BeaconchainTooltip>
112-
<Box textTransform="none">
113-
<Text>{t("page-staking-stats-box-metric-2-tooltip")}</Text>
81+
<div className="normal-case">
82+
<p>{t("page-staking-stats-box-metric-2-tooltip")}</p>
11483
{t("common:data-provided-by")}{" "}
11584
<InlineLink href="https://beaconcha.in/">Beaconcha.in</InlineLink>
116-
</Box>
85+
</div>
11786
</BeaconchainTooltip>
11887
</Label>
11988
</Cell>
@@ -122,13 +91,13 @@ const StakingStatsBox = ({ data }: StakingStatsBoxProps) => {
12291
<Label>
12392
{t("page-staking-stats-box-metric-3")}
12493
<BeaconchainTooltip>
125-
<Box textTransform="none">
126-
<Text>{t("page-staking-stats-box-metric-3-tooltip")}</Text>
94+
<div className="normal-case">
95+
<p>{t("page-staking-stats-box-metric-3-tooltip")}</p>
12796
{t("common:data-provided-by")}{" "}
12897
<InlineLink href="https://beaconcha.in/ethstore">
12998
Beaconcha.in
13099
</InlineLink>
131-
</Box>
100+
</div>
132101
</BeaconchainTooltip>
133102
</Label>
134103
</Cell>

0 commit comments

Comments
 (0)