diff --git a/frontend/components/label-input.tsx b/frontend/components/label-input.tsx new file mode 100644 index 00000000..9d8f8c6c --- /dev/null +++ b/frontend/components/label-input.tsx @@ -0,0 +1,26 @@ +import { LabelWrapper } from "./label-wrapper"; +import { Input } from "./ui/input"; + +export function LabelInput({ + label, + helperText, + id, + required, + ...props +}: { + label: string; + helperText: string; + id: string; + required: boolean; +} & React.InputHTMLAttributes) { + return ( + + + + ); +} diff --git a/frontend/components/label-wrapper.tsx b/frontend/components/label-wrapper.tsx new file mode 100644 index 00000000..75043a9e --- /dev/null +++ b/frontend/components/label-wrapper.tsx @@ -0,0 +1,43 @@ +import { Info } from "lucide-react"; +import { + DropdownMenu, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { Input } from "./ui/input"; +import { Label } from "./ui/label"; +import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip"; + +export function LabelWrapper({ + label, + helperText, + id, + required, + children, +}: { + label: string; + helperText: string; + id: string; + required: boolean; + children: React.ReactNode; +}) { + return ( +
+ +
{children}
+
+ ); +} diff --git a/frontend/components/logo/ollama-logo.tsx b/frontend/components/logo/ollama-logo.tsx index 50d8320d..ed958eed 100644 --- a/frontend/components/logo/ollama-logo.tsx +++ b/frontend/components/logo/ollama-logo.tsx @@ -9,10 +9,10 @@ export default function OllamaLogo(props: React.SVGProps) { {...props} > Ollama Logo - + 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 ( -