Skip to content

Commit ddfa10b

Browse files
chore: migrate Flex components to Shadcn/Tailwind
1 parent 760264e commit ddfa10b

File tree

1 file changed

+30
-44
lines changed

1 file changed

+30
-44
lines changed

src/components/Staking/StakingHierarchy.tsx

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { IconBase } from "react-icons"
44
import {
55
Center,
66
cssVar,
7-
Flex,
87
Heading,
98
Icon,
109
SimpleGrid,
1110
Text,
1211
useToken,
1312
VStack,
1413
} from "@chakra-ui/react"
14+
import { Flex } from "@/components/ui/flex"
1515

1616
import { ChildOnlyProp } from "@/lib/types"
1717

@@ -130,7 +130,7 @@ const Line = () => {
130130

131131
return (
132132
<aside
133-
className={`realtive after:h-[calc.subtract("100%", "50px")] after:start-[calc.subtract("50%", "2px")] after:z-1 after:border-orange col-span-1 row-span-2 hidden after:absolute after:top-[50px] after:border-s-4 md:block`}
133+
className={`realtive after:h-[calc.subtract("100%", "50px")] after:start-[calc.subtract("50%", "2px")] after:content-["] after:z-1 after:border-orange col-span-1 row-span-2 hidden after:absolute after:top-[50px] after:border-s-4 md:block`}
134134

135135
/*
136136
This value needs to be updated.
@@ -143,11 +143,8 @@ const Line = () => {
143143

144144
const Header = ({ children }: ChildOnlyProp) => (
145145
<Flex
146-
gridArea="header"
147-
flexDirection="column"
148-
justify="center"
149-
alignItems={{ base: "center", md: "initial" }}
150-
gap={2}
146+
className="flex-col justify-center gap-2 sm:items-center md:items-start"
147+
style={{ gridArea: "header" }}
151148
>
152149
{children}
153150
</Flex>
@@ -164,33 +161,9 @@ const HeadingEl = ({ children }: ChildOnlyProp) => (
164161
{children}
165162
</Heading>
166163
)
167-
164+
// Todo: The removed sx prop will be added by creating a separate function for Text like we have HeadingEl. This will also help to migrate the Text component.
168165
const Pills = ({ children }: ChildOnlyProp) => (
169-
<Flex
170-
flexWrap="wrap"
171-
gap={1}
172-
justify={{ base: "center", md: "initial" }}
173-
sx={{
174-
p: {
175-
color: $colorVar.reference,
176-
m: 0,
177-
position: "relative",
178-
py: 0.5,
179-
px: 1.5,
180-
whiteSpace: "nowrap",
181-
_after: {
182-
content: `""`,
183-
position: "absolute",
184-
top: 0,
185-
insetInlineStart: 0,
186-
boxSize: "100%",
187-
background: $colorVar.reference,
188-
opacity: 0.125,
189-
borderRadius: "sm",
190-
},
191-
},
192-
}}
193-
>
166+
<Flex className="flex-wrap gap-1 sm:justify-center md:justify-start">
194167
{children}
195168
</Flex>
196169
)
@@ -209,18 +182,17 @@ const Glyph = ({ glyphIcon }: GlyphProps) => (
209182

210183
const Content = ({ children }: ChildOnlyProp) => (
211184
<Flex
212-
flexDirection="column"
213-
gridArea="content"
214-
mt={{ md: 4 }}
215-
mb={{ md: 12 }}
216-
sx={{
185+
className="flex-col gap-4 md:mb-12 md:mt-4"
186+
style={{
187+
gridArea: "content",
188+
}}
189+
/* sx={{
217190
// For use in markdown files
218191
".gold": {
219192
color: "stakingGold",
220193
fontWeight: 600,
221194
},
222-
}}
223-
gap={4}
195+
}} */
224196
>
225197
{children}
226198
</Flex>
@@ -251,12 +223,26 @@ const StakingHierarchy = () => {
251223
<Header>
252224
<HeadingEl>{t("page-staking-hierarchy-solo-h2")}</HeadingEl>
253225
<Pills>
254-
<Text>
226+
<p
227+
className={`after:content-["] relative m-0 whitespace-nowrap px-1.5 py-0.5 text-[colorVar.reference] after:absolute after:start-0 after:top-0 after:box-content after:rounded after:bg-[var(colorVar.reference)] after:opacity-[.125]`}
228+
>
255229
<em>{t("page-staking-hierarchy-solo-pill-1")}</em>
230+
</p>
231+
<Text
232+
className={`after:content-["] relative m-0 whitespace-nowrap px-1.5 py-0.5 text-[$colorVar.reference] after:absolute after:start-0 after:top-0 after:box-content after:rounded after:bg-[$colorVar.reference] after:opacity-[.125]`}
233+
>
234+
{t("page-staking-hierarchy-solo-pill-2")}
235+
</Text>
236+
<Text
237+
className={`after:content-["] relative m-0 whitespace-nowrap px-1.5 py-0.5 text-[$colorVar.reference] after:absolute after:start-0 after:top-0 after:box-content after:rounded after:bg-[$colorVar.reference] after:opacity-[.125]`}
238+
>
239+
{t("page-staking-hierarchy-solo-pill-3")}
240+
</Text>
241+
<Text
242+
className={`after:content-["] relative m-0 whitespace-nowrap px-1.5 py-0.5 text-[$colorVar.reference] after:absolute after:start-0 after:top-0 after:box-content after:rounded after:bg-[$colorVar.reference] after:opacity-[.125]`}
243+
>
244+
{t("page-staking-hierarchy-solo-pill-4")}
256245
</Text>
257-
<Text>{t("page-staking-hierarchy-solo-pill-2")}</Text>
258-
<Text>{t("page-staking-hierarchy-solo-pill-3")}</Text>
259-
<Text>{t("page-staking-hierarchy-solo-pill-4")}</Text>
260246
</Pills>
261247
</Header>
262248
<Glyph glyphIcon={StakingGlyphCPUIcon} />

0 commit comments

Comments
 (0)