Skip to content

Commit 2a821d3

Browse files
feat: migrate HorizontalCard to tailwind
1 parent dfe8d57 commit 2a821d3

File tree

5 files changed

+26
-32
lines changed

5 files changed

+26
-32
lines changed

src/components/HorizontalCard.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
import React, { ReactNode } from "react"
2-
import { Box, Flex, FlexProps } from "@chakra-ui/react"
32

43
import { cn } from "@/lib/utils/cn"
54

65
import Emoji from "./Emoji"
7-
import Text from "./OldText"
86

9-
export type HorizontalCardProps = Omit<FlexProps, "title"> & {
7+
export interface HorizontalCardProps
8+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
109
emoji: string
10+
emojiClassName?: string
1111
title?: ReactNode
1212
description: ReactNode
13+
children?: ReactNode
1314
}
1415

1516
const HorizontalCard = ({
1617
emoji,
18+
emojiClassName,
1719
title,
1820
description,
1921
children,
2022
className,
21-
...rest
22-
}: HorizontalCardProps) => (
23-
<Flex borderRadius="base" {...rest}>
24-
<Emoji className={cn("text-5xl", className)} text={emoji} />
25-
<Box flexGrow="0" flexShrink="1" flexBasis="75%" ms="8">
26-
<Text fontSize="lg">{title}</Text>
27-
<Text mt="-4" mb="2">
28-
{description}
29-
</Text>
30-
<>{children}</>
31-
</Box>
32-
</Flex>
33-
)
23+
...props
24+
}: HorizontalCardProps) => {
25+
return (
26+
<div className={cn("my-2 flex items-start gap-8", className)} {...props}>
27+
<Emoji text={emoji} className={cn("text-5xl", emojiClassName)} />
28+
<div className="flex-shrink flex-grow-0 basis-3/4 space-y-2">
29+
<div className="text-lg">{title}</div>
30+
<div className="text-base">{description}</div>
31+
{children}
32+
</div>
33+
</div>
34+
)
35+
}
3436

3537
export default HorizontalCard

src/pages/eth.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ const CardContainer = (props: FlexProps) => (
212212
)
213213

214214
const TokenCard = (props: ComponentProps<typeof HorizontalCard>) => (
215-
<HorizontalCard minW="full" my={2} mx={0} borderRadius={0} {...props} />
215+
<HorizontalCard {...props} className="mx-0 my-2 min-w-full rounded-none" />
216216
)
217217

218218
const TextDivider = () => (

src/pages/gas.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ const GasPage = () => {
303303
key={benefit.emoji}
304304
emoji={benefit.emoji}
305305
description={benefit.description}
306-
className="text-5xl"
307-
align="center"
306+
emojiClassName="text-5xl"
307+
className="flex items-center py-2"
308308
/>
309309
</Box>
310310
))}

src/pages/stablecoins.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ const StablecoinsPage = ({ markets, marketsHasError }) => {
458458
<HorizontalCard
459459
emoji={token.emoji}
460460
description={token.description}
461-
className="text-5xl"
461+
emojiClassName="text-5xl"
462462
/>
463463
</Box>
464464
))}

src/pages/wallets/index.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,8 @@ export const StyledCard = (props: ComponentPropsWithRef<typeof Card>) => (
117117
)
118118
const ChecklistItem = (props: HorizontalCardProps) => (
119119
<HorizontalCard
120-
border={0}
121-
display="flex"
122-
className="text-2xl"
123-
alignItems="flex-start"
124-
mb={4}
120+
emojiClassName="text-2xl"
121+
className="flex-start mb-4 flex border-0"
125122
{...props}
126123
/>
127124
)
@@ -362,16 +359,11 @@ const WalletsPage = () => {
362359
<Box>
363360
{types.map((type, idx) => (
364361
<HorizontalCard
365-
minWidth="100%"
366-
marginTop={2}
367-
marginBottom={2}
368-
ms={0}
369-
me={0}
370362
key={idx}
371363
emoji={type.emoji}
372364
description={type.description}
373-
className="text-[2.5rem]"
374-
alignItems="center"
365+
className="my-0.5 w-[100%] items-center"
366+
emojiClassName={"text-[2.5rem]"}
375367
/>
376368
))}
377369
</Box>

0 commit comments

Comments
 (0)