Skip to content

Commit 94d12a8

Browse files
authored
Merge pull request #14233 from kushagrasarathe/migrateLayer2ProductCard
feat: migrate Layer2ProductCard to tailwind and shadcn
2 parents e8dcdfb + 9e9ed13 commit 94d12a8

File tree

1 file changed

+66
-64
lines changed

1 file changed

+66
-64
lines changed

src/components/Layer2ProductCard.tsx

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// Libraries
21
import { StaticImageData } from "next/image"
32
import { useTranslation } from "next-i18next"
4-
import { Box, Center, Flex, Heading } from "@chakra-ui/react"
53

6-
import { ButtonLink } from "@/components/Buttons"
7-
import { Image } from "@/components/Image"
8-
import InlineLink from "@/components/Link"
9-
import Text from "@/components/OldText"
4+
import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card"
5+
6+
import { ButtonLink } from "./ui/buttons/Button"
7+
import InlineLink from "./ui/Link"
8+
import { TwImage } from "./Image"
109

1110
export type Layer2ProductCardProps = {
1211
children?: React.ReactNode
@@ -38,72 +37,75 @@ const Layer2ProductCard = ({
3837
const { t } = useTranslation("page-layer-2")
3938

4039
return (
41-
<Flex
42-
color="text"
43-
boxShadow={"0px 14px 66px rgba(0, 0, 0, 0.07)"}
44-
direction="column"
45-
justify="space-between"
46-
bg="searchBackground"
47-
borderRadius="base"
48-
border={"1px solid lightBorder"}
49-
textDecoration="none"
50-
padding={2}
51-
_hover={{ transition: "transform 0.1s", transform: "scale(1.02)" }}
52-
>
53-
<Center
54-
bg={background}
55-
boxShadow="inset 0px -1px 0px rgba(0, 0, 0, 0.1)"
56-
minH="200px"
40+
<Card className="flex flex-col justify-between rounded-md border-0 bg-background-highlight p-2 shadow-lg transition-transform duration-100 hover:scale-[1.02]">
41+
<div
42+
className="mb-4 flex min-h-[200px] items-center justify-center border-b"
43+
style={{ backgroundColor: background }}
5744
>
58-
<Image
45+
<TwImage
5946
src={image}
6047
alt={alt}
6148
width={100}
62-
maxH={"257px"}
63-
style={{ objectFit: "contain" }}
49+
className="max-h-[257px] object-cover"
6450
/>
65-
</Center>
66-
<Flex p={6} h="100%" direction="column">
67-
<Box>
68-
<Heading as="h3" fontSize={{ base: "xl", md: "2xl" }} mb={3}>
69-
{name}
70-
</Heading>
71-
{children && (
72-
<Box mt={4} mb={4}>
73-
{children}
74-
</Box>
75-
)}
76-
<Text fontSize="sm" mb={2} lineHeight="140%">
77-
{description}
78-
</Text>
79-
{note.length > 0 && (
80-
<Text fontSize="sm" mb={2} lineHeight="140%">
51+
</div>
52+
53+
<CardHeader className="py-0">
54+
<div className="space-y-4">
55+
<h3 className="mb-3 text-xl font-semibold md:text-2xl">{name}</h3>
56+
{children && <div>{children}</div>}
57+
</div>
58+
</CardHeader>
59+
60+
<CardContent className="flex flex-grow flex-col gap-0 space-y-1 px-6 py-4">
61+
<div className="space-y-2">
62+
<p className="text-sm leading-snug">{description}</p>
63+
64+
{note && (
65+
<p className="text-sm leading-snug">
8166
{t("layer-2-note")} {note}
82-
</Text>
67+
</p>
8368
)}
84-
</Box>
85-
{bridge && (
86-
<InlineLink href={bridge}>
87-
{name} {t("layer-2-bridge")}
88-
</InlineLink>
89-
)}
90-
{ecosystemPortal && (
91-
<InlineLink href={ecosystemPortal}>
92-
{name} {t("layer-2-ecosystem-portal")}
93-
</InlineLink>
94-
)}
95-
{tokenLists && (
96-
<InlineLink href={tokenLists}>
97-
{name} {t("layer-2-token-lists")}
98-
</InlineLink>
69+
</div>
70+
71+
<div className="space-y-1">
72+
{bridge && (
73+
<InlineLink
74+
href={bridge}
75+
className="block text-primary underline hover:text-primary/80"
76+
>
77+
{name} {t("layer-2-bridge")}
78+
</InlineLink>
79+
)}
80+
81+
{ecosystemPortal && (
82+
<InlineLink
83+
href={ecosystemPortal}
84+
className="block text-primary underline hover:text-primary/80"
85+
>
86+
{name} {t("layer-2-ecosystem-portal")}
87+
</InlineLink>
88+
)}
89+
90+
{tokenLists && (
91+
<InlineLink
92+
href={tokenLists}
93+
className="block text-primary underline hover:text-primary/80"
94+
>
95+
{name} {t("layer-2-token-lists")}
96+
</InlineLink>
97+
)}
98+
</div>
99+
</CardContent>
100+
101+
<CardFooter className="mt-2 p-2">
102+
{url && (
103+
<ButtonLink className="w-full" href={url}>
104+
{t("layer-2-explore")} {name}
105+
</ButtonLink>
99106
)}
100-
</Flex>
101-
<Box>
102-
<ButtonLink m={2} href={url} display="flex">
103-
{t("layer-2-explore")} {name}
104-
</ButtonLink>
105-
</Box>
106-
</Flex>
107+
</CardFooter>
108+
</Card>
107109
)
108110
}
109111

0 commit comments

Comments
 (0)