From ac429af922ac5584d45e4cb36a0a58559de959cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ribeiro?= Date: Wed, 12 Jun 2024 15:25:50 -0300 Subject: [PATCH] import card component from shadcn --- src/components/ui/Card.tsx | 172 +++++++++++++++---------------------- 1 file changed, 70 insertions(+), 102 deletions(-) diff --git a/src/components/ui/Card.tsx b/src/components/ui/Card.tsx index 6c6d913..7675f96 100644 --- a/src/components/ui/Card.tsx +++ b/src/components/ui/Card.tsx @@ -1,118 +1,86 @@ -import React from "react"; -import { cn } from "#/lib/utils"; +import * as React from "react"; +import { cn } from "#/lib"; -import BlurredBackgroundLogo from "./BlurredBackgroundLogo"; - -export type DivProps = React.HTMLAttributes; - -const Root = React.forwardRef( - ({ className = "", children, ...props }, ref) => ( -
- {children} -
- ) -); -Root.displayName = "CardRoot"; - -const Logo = React.forwardRef< +const Card = React.forwardRef< HTMLDivElement, - { bgLogo?: string; className?: string; src: string } ->(({ className = "", bgLogo = null, src, ...props }, ref) => ( + React.HTMLAttributes +>(({ className, ...props }, ref) => (
- - - - -
-
+ /> )); -Logo.displayName = "CardLogo"; +Card.displayName = "Card"; -const Header = React.forwardRef( - ({ className, ...props }, ref) => ( -
- ) -); -Header.displayName = "CardHeader"; +const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); +CardHeader.displayName = "CardHeader"; -const Content = React.forwardRef( - ({ className = "", children, ...props }, ref) => ( -
- {children} -
- ) -); -Content.displayName = "CardContent"; +const CardTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + // eslint-disable-next-line jsx-a11y/heading-has-content +

+)); +CardTitle.displayName = "CardTitle"; -const Title = React.forwardRef( - ({ className = "", children, ...props }, ref) => ( -
- {children} -
- ) -); -Title.displayName = "CardTitle"; +const CardDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)); +CardDescription.displayName = "CardDescription"; -const Description = React.forwardRef( - ({ className = "", children, ...props }, ref) => ( -

- {children} -
- ) -); -Description.displayName = "CardDescription"; +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); +CardContent.displayName = "CardContent"; -const Footer = React.forwardRef( - ({ className = "", children, ...props }, ref) => ( -
- {children} -
- ) -); -Footer.displayName = "CardFooter"; +const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); +CardFooter.displayName = "CardFooter"; -export const Card = { - Root, - Header, - Logo, - Content, - Title, - Description, - Footer, +export { + Card, + CardHeader, + CardFooter, + CardTitle, + CardDescription, + CardContent, };