Skip to content

Commit 8da55ef

Browse files
authored
Merge pull request #14844 from ashiskumar-1999/Migrate-StakingConsiderations-to-Shadcn/Tailwind
feat: Migrate the StakingConsiderations to Tailwind.
2 parents fec8b9a + ef22355 commit 8da55ef

File tree

1 file changed

+20
-51
lines changed
  • src/components/Staking/StakingConsiderations

1 file changed

+20
-51
lines changed

src/components/Staking/StakingConsiderations/index.tsx

Lines changed: 20 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { Box, Flex, List, ListItem, useToken, VStack } from "@chakra-ui/react"
2-
31
import type { StakingPage } from "@/lib/types"
42

53
import ButtonDropdown from "@/components/ButtonDropdown"
@@ -8,10 +6,11 @@ import {
86
GreenCheckProductGlyphIcon,
97
WarningProductGlyphIcon,
108
} from "@/components/icons/staking"
11-
import OldHeading from "@/components/OldHeading"
12-
import Text from "@/components/OldText"
139
import Translation from "@/components/Translation"
10+
import { Flex, VStack } from "@/components/ui/flex"
11+
import { List, ListItem } from "@/components/ui/list"
1412

13+
import { cn } from "@/lib/utils/cn"
1514
import { trackCustomEvent } from "@/lib/utils/matomo"
1615

1716
import { useStakingConsiderations } from "@/hooks/useStakingConsiderations"
@@ -37,11 +36,11 @@ const IndicatorGroup = ({
3736
return <WarningProductGlyphIcon style={style} />
3837
}
3938
return (
40-
<VStack spacing={2} flex={1}>
39+
<VStack className="flex-1 gap-2">
4140
<IndicatorIcon style={styleObj} />
42-
<Text fontSize="xs" textAlign="center" maxW="{40}">
41+
<p className="max-w-[10rem] text-center text-xs">
4342
<Translation id={label} />
44-
</Text>
43+
</p>
4544
</VStack>
4645
)
4746
}
@@ -51,9 +50,6 @@ export type StakingConsiderationsProps = {
5150
}
5251

5352
const StakingConsiderations = ({ page }: StakingConsiderationsProps) => {
54-
// TODO: Replace with direct token implementation after UI migration is completed
55-
const mdBp = useToken("breakpoints", "md")
56-
5753
const {
5854
StyledSvg,
5955
caution,
@@ -68,19 +64,13 @@ const StakingConsiderations = ({ page }: StakingConsiderationsProps) => {
6864
activeIndex,
6965
} = useStakingConsiderations({ page })
7066

71-
const activeStyles = {
72-
bg: "background.highlight",
73-
color: "body.base",
74-
transition: "background 0.5s, color 0.5s",
75-
}
76-
7767
return (
78-
<Flex flexDir={{ base: "column", md: "row" }}>
68+
<Flex className="flex-col md:flex-row">
7969
<ButtonDropdown list={dropdownLinks} className="mb-4 md:hidden" />
8070
{/* TODO: Improve a11y */}
81-
<Box flex={1} hideBelow={mdBp}>
71+
<div className="hidden flex-1 md:block">
8272
{!!pageData && (
83-
<List m={0}>
73+
<List className="m-0">
8474
{/* TODO: Make mobile responsive */}
8575
{pageData.map(({ title, matomo }, idx) => (
8676
<ListItem
@@ -89,45 +79,24 @@ const StakingConsiderations = ({ page }: StakingConsiderationsProps) => {
8979
handleSelection(idx)
9080
trackCustomEvent(matomo)
9181
}}
92-
py={1}
93-
cursor="pointer"
94-
display="table"
95-
w="full"
96-
h={8}
97-
p="3"
98-
mb="0"
99-
_hover={activeStyles}
100-
position="relative"
101-
{...(idx === activeIndex
102-
? activeStyles
103-
: { color: "primary.base" })}
82+
className={cn(
83+
"transition-background relative mb-0 table h-8 w-full cursor-pointer p-3 duration-500 hover:bg-background-highlight hover:text-body",
84+
idx === activeIndex
85+
? "bg-background-highlight text-body"
86+
: "text-primary"
87+
)}
10488
>
10589
{title}
10690
</ListItem>
10791
))}
10892
</List>
10993
)}
110-
</Box>
111-
<Flex
112-
alignItems="center"
113-
flexDir="column"
114-
bg="background.highlight"
115-
flex={2}
116-
minH="410px"
117-
p={6}
118-
>
94+
</div>
95+
<Flex className="min-h-[410px] flex-[2] flex-col items-center bg-background-highlight p-6">
11996
<StyledSvg />
120-
<OldHeading
121-
as="h3"
122-
fontWeight={700}
123-
fontSize="27px"
124-
lineHeight={1.4}
125-
mt={10}
126-
>
127-
{title}
128-
</OldHeading>
129-
<Text>{description}</Text>
130-
<Flex gap={8} justifyContent="center" mt="auto">
97+
<h3 className="mt-10 text-2xl font-bold leading-[1.4]">{title}</h3>
98+
<p>{description}</p>
99+
<Flex className="mt-auto justify-center gap-8">
131100
{!!valid && (
132101
<IndicatorGroup
133102
label={valid}

0 commit comments

Comments
 (0)