-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14226 from kushagrasarathe/migrateHorizontalCard
feat: migrate HorizontalCard to tailwind
- Loading branch information
Showing
6 changed files
with
39 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("flex items-center 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"> | ||
<p className="text-lg">{title}</p> | ||
<p>{description}</p> | ||
{children} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default HorizontalCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters