Skip to content

Commit 50ef950

Browse files
authored
Merge pull request #14045 from kushagrasarathe/migrateGhostCard
feat: migrate GhostCard to tailwind
2 parents 5b1caed + cfede5f commit 50ef950

File tree

4 files changed

+29
-52
lines changed

4 files changed

+29
-52
lines changed

src/components/GhostCard.tsx

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
import React from "react"
2-
import { Box, BoxProps } from "@chakra-ui/react"
32

4-
export type GhostCardProps = BoxProps
3+
import { cn } from "@/lib/utils/cn"
54

6-
const GhostCard = ({ children, ...rest }: GhostCardProps) => (
7-
<Box position="relative" alignSelf="stretch" {...rest}>
8-
<Box
9-
zIndex="hide"
10-
position="absolute"
11-
backgroundColor="ghostCardGhost"
12-
bottom="2"
13-
insetInlineStart="2"
14-
border="1px solid"
15-
borderColor="border"
16-
borderRadius="2px"
17-
height="full"
18-
width="full"
19-
/>
20-
<Box
21-
className="ghost-card-base"
22-
height="full"
23-
width="full"
24-
borderRadius="2px"
25-
zIndex={2}
26-
padding="6"
27-
background="ghostCardBackground"
28-
border="1px solid"
29-
borderColor="border"
30-
textAlign="start"
31-
>
32-
{children}
33-
</Box>
34-
</Box>
35-
)
5+
import { Card } from "./ui/card"
6+
7+
interface GhostCardProps extends React.HTMLAttributes<HTMLDivElement> {
8+
children: React.ReactNode
9+
}
10+
11+
const GhostCard: React.FC<GhostCardProps> = ({
12+
children,
13+
className,
14+
...props
15+
}) => {
16+
return (
17+
<div className={cn("relative self-stretch", className)}>
18+
<div className="absolute bottom-2 left-2 z-hide h-full w-full rounded-sm border-border-high-contrast bg-background-medium" />
19+
<Card
20+
className={cn(
21+
"text-card-foreground z-10 h-full w-full rounded-sm border bg-background-highlight p-6 text-left"
22+
)}
23+
{...props}
24+
>
25+
{children}
26+
</Card>
27+
</div>
28+
)
29+
}
3630

3731
export default GhostCard

src/pages/dapps.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,15 +1854,7 @@ const DappsPage = () => {
18541854
</FullWidthContainer>
18551855
<Content>
18561856
<ImageContainer id="what-are-dapps">
1857-
<GhostCard
1858-
mt={2}
1859-
sx={{
1860-
".ghost-card-base": {
1861-
display: "flex",
1862-
justifyContent: "center",
1863-
},
1864-
}}
1865-
>
1857+
<GhostCard className="mt-2 flex items-center">
18661858
<Image
18671859
bgSize="cover"
18681860
bgRepeat="no-repeat"

src/pages/gas.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,7 @@ const GasPage = () => {
273273
</InlineLink>
274274
</Text>
275275
</Box>
276-
<GhostCard
277-
flex="40%"
278-
maxW="640px"
279-
alignSelf="center"
280-
mt={{ base: 16, lg: 2 }}
281-
>
276+
<GhostCard className="mt-16 max-w-[640px] self-center md:w-2/5 lg:mt-2">
282277
<Emoji text=":cat:" className="text-5xl" />
283278
<H3>{t("page-gas-attack-of-the-cryptokitties-header")}</H3>
284279
<Text>{t("page-gas-attack-of-the-cryptokitties-text")}</Text>

src/pages/stablecoins.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,7 @@ const StablecoinsPage = ({ markets, marketsHasError }) => {
467467
</Box>
468468
))}
469469
</Box>
470-
<GhostCard
471-
maxW="640px"
472-
me={{ base: 0, lg: 8 }}
473-
mt={{ base: 16, lg: 2 }}
474-
>
470+
<GhostCard className="me-0 mt-16 max-w-[640px] lg:me-8 lg:mt-2">
475471
<Emoji text=":pizza:" className="text-5xl" />
476472
<H3>{t("page-stablecoins-bitcoin-pizza")}</H3>
477473
<Text>{t("page-stablecoins-bitcoin-pizza-body")} </Text>

0 commit comments

Comments
 (0)