From 74d746b0c2501da5721c197a2d0679b3f299783a Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 18 Sep 2025 15:32:21 -0300 Subject: [PATCH] changed layout of some UI components --- frontend/components/ui/card.tsx | 112 +++++++++++++++++++------------ frontend/components/ui/input.tsx | 24 ++++++- frontend/components/ui/tabs.tsx | 2 +- 3 files changed, 92 insertions(+), 46 deletions(-) diff --git a/frontend/components/ui/card.tsx b/frontend/components/ui/card.tsx index e70e64bb..210e2f19 100644 --- a/frontend/components/ui/card.tsx +++ b/frontend/components/ui/card.tsx @@ -1,52 +1,73 @@ import * as React from "react"; import { cn } from "@/lib/utils"; -const Card = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const Card = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardHeader = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardTitle = React.forwardRef>( - ({ className, ...props }, ref) => ( -

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

+)); -const CardDescription = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardContent = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardFooter = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); Card.displayName = "Card"; CardHeader.displayName = "CardHeader"; @@ -55,4 +76,11 @@ CardDescription.displayName = "CardDescription"; CardContent.displayName = "CardContent"; CardFooter.displayName = "CardFooter"; -export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }; +export { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +}; diff --git a/frontend/components/ui/input.tsx b/frontend/components/ui/input.tsx index 3dc0b5f0..5248e526 100644 --- a/frontend/components/ui/input.tsx +++ b/frontend/components/ui/input.tsx @@ -1,15 +1,32 @@ import * as React from "react"; import { cn } from "@/lib/utils"; -export interface InputProps extends React.InputHTMLAttributes { +export interface InputProps + extends React.InputHTMLAttributes { icon?: React.ReactNode; inputClassName?: string; } const Input = React.forwardRef( ({ className, inputClassName, icon, type, placeholder, ...props }, ref) => { + const [hasValue, setHasValue] = React.useState( + Boolean(props.value || props.defaultValue), + ); + + const handleChange = (e: React.ChangeEvent) => { + setHasValue(e.target.value.length > 0); + if (props.onChange) { + props.onChange(e); + } + }; + return ( -