-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: migrate HorizontalCard to tailwind #14226
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
import React, { ReactNode } from "react" | ||
import { Box, Flex, FlexProps } from "@chakra-ui/react" | ||
|
||
import { cn } from "@/lib/utils/cn" | ||
|
||
import Emoji from "./Emoji" | ||
import Text from "./OldText" | ||
|
||
export type HorizontalCardProps = Omit<FlexProps, "title"> & { | ||
export interface HorizontalCardProps | ||
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> { | ||
emoji: string | ||
emojiClassName?: string | ||
title?: ReactNode | ||
description: ReactNode | ||
children?: ReactNode | ||
} | ||
|
||
const HorizontalCard = ({ | ||
emoji, | ||
emojiClassName, | ||
title, | ||
description, | ||
children, | ||
className, | ||
...rest | ||
}: HorizontalCardProps) => ( | ||
<Flex borderRadius="base" {...rest}> | ||
<Emoji className={cn("text-5xl", className)} text={emoji} /> | ||
<Box flexGrow="0" flexShrink="1" flexBasis="75%" ms="8"> | ||
<Text fontSize="lg">{title}</Text> | ||
<Text mt="-4" mb="2"> | ||
{description} | ||
</Text> | ||
<>{children}</> | ||
</Box> | ||
</Flex> | ||
) | ||
...props | ||
}: HorizontalCardProps) => { | ||
return ( | ||
<div className={cn("my-2 flex items-start gap-8", className)} {...props}> | ||
<Emoji text={emoji} className={cn("text-5xl", emojiClassName)} /> | ||
<div className="flex-shrink flex-grow-0 basis-3/4 space-y-2"> | ||
<div className="text-lg">{title}</div> | ||
<div className="text-base">{description}</div> | ||
{children} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default HorizontalCard |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -212,7 +212,7 @@ const CardContainer = (props: FlexProps) => ( | |||||
) | ||||||
|
||||||
const TokenCard = (props: ComponentProps<typeof HorizontalCard>) => ( | ||||||
<HorizontalCard minW="full" my={2} mx={0} borderRadius={0} {...props} /> | ||||||
<HorizontalCard {...props} className="mx-0 my-2 min-w-full rounded-none" /> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to use the
Suggested change
|
||||||
) | ||||||
|
||||||
const TextDivider = () => ( | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -303,8 +303,8 @@ const GasPage = () => { | |||||
key={benefit.emoji} | ||||||
emoji={benefit.emoji} | ||||||
description={benefit.description} | ||||||
className="text-5xl" | ||||||
align="center" | ||||||
emojiClassName="text-5xl" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5xl is the default size applied in
Suggested change
|
||||||
className="flex items-center py-2" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/> | ||||||
</Box> | ||||||
))} | ||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -458,7 +458,7 @@ const StablecoinsPage = ({ markets, marketsHasError }) => { | |||
<HorizontalCard | ||||
emoji={token.emoji} | ||||
description={token.description} | ||||
className="text-5xl" | ||||
emojiClassName="text-5xl" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
/> | ||||
</Box> | ||||
))} | ||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -117,11 +117,8 @@ export const StyledCard = (props: ComponentPropsWithRef<typeof Card>) => ( | |||||
) | ||||||
const ChecklistItem = (props: HorizontalCardProps) => ( | ||||||
<HorizontalCard | ||||||
border={0} | ||||||
display="flex" | ||||||
className="text-2xl" | ||||||
alignItems="flex-start" | ||||||
mb={4} | ||||||
emojiClassName="text-2xl" | ||||||
className="flex-start mb-4 flex border-0" | ||||||
{...props} | ||||||
/> | ||||||
) | ||||||
|
@@ -362,16 +359,11 @@ const WalletsPage = () => { | |||||
<Box> | ||||||
{types.map((type, idx) => ( | ||||||
<HorizontalCard | ||||||
minWidth="100%" | ||||||
marginTop={2} | ||||||
marginBottom={2} | ||||||
ms={0} | ||||||
me={0} | ||||||
key={idx} | ||||||
emoji={type.emoji} | ||||||
description={type.description} | ||||||
className="text-[2.5rem]" | ||||||
alignItems="center" | ||||||
className="my-0.5 w-[100%] items-center" | ||||||
emojiClassName={"text-[2.5rem]"} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/> | ||||||
))} | ||||||
</Box> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could still use
p
tags here to keep the semantics