openrag/frontend/components/label-wrapper.tsx
Lucas Oliveira 28dbca4ba0
fix: make onboarding match designs (#163)
* implement custom value when custom is active on model selector

* changed ibm logo to watsonx

* set endpoint selector as custom

* changed IBM to IBM watsonx.ai

* upload copies on ibm onboarding

* disable select on disabled button

* changed use env open ai api key style

* Changed width to match designs

* disable default tag

* made selector full width and made default disappear

* removed !

* removed onboarding toast

* fix card border radius
2025-10-01 16:49:33 -03:00

61 lines
1.6 KiB
TypeScript

import { Info } from "lucide-react";
import { cn } from "@/lib/utils";
import { Label } from "./ui/label";
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
export function LabelWrapper({
label,
description,
helperText,
id,
required,
flex,
start,
children,
}: {
label: string;
description?: string;
helperText?: string | React.ReactNode;
id: string;
required?: boolean;
flex?: boolean;
start?: boolean;
children: React.ReactNode;
}) {
return (
<div
className={cn(
"flex w-full items-center",
start ? "justify-start flex-row-reverse gap-3" : "justify-between",
)}
>
<div
className={cn(
"flex flex-1 flex-col items-start",
flex ? "gap-3" : "gap-2",
)}
>
<Label
htmlFor={id}
className={cn("font-medium flex items-center gap-1.5", description ? "!text-sm" : "!text-mmd")}
>
{label}
{required && <span className="text-red-500">*</span>}
{helperText && (
<Tooltip>
<TooltipTrigger>
<Info className="w-3.5 h-3.5 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent side="right">{helperText}</TooltipContent>
</Tooltip>
)}
</Label>
{!flex && <div className="relative w-full">{children}</div>}
{description && (
<p className="text-mmd text-muted-foreground">{description}</p>
)}
</div>
{flex && <div className="relative items-center flex">{children}</div>}
</div>
);
}