added start on label wrapper
This commit is contained in:
parent
0a1191c36c
commit
72958b3794
1 changed files with 12 additions and 5 deletions
|
|
@ -10,18 +10,25 @@ export function LabelWrapper({
|
||||||
id,
|
id,
|
||||||
required,
|
required,
|
||||||
flex,
|
flex,
|
||||||
|
start,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
label: string;
|
label: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
helperText?: string;
|
helperText?: string | React.ReactNode;
|
||||||
id: string;
|
id: string;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
flex?: boolean;
|
flex?: boolean;
|
||||||
|
start?: boolean;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full items-center justify-between">
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex w-full items-center",
|
||||||
|
start ? "justify-start flex-row-reverse gap-3" : "justify-between",
|
||||||
|
)}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex flex-1 flex-col items-start",
|
"flex flex-1 flex-col items-start",
|
||||||
|
|
@ -30,7 +37,7 @@ export function LabelWrapper({
|
||||||
>
|
>
|
||||||
<Label
|
<Label
|
||||||
htmlFor={id}
|
htmlFor={id}
|
||||||
className="!text-mmd font-medium flex items-center gap-1"
|
className="!text-mmd font-medium flex items-center gap-1.5"
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
{required && <span className="text-red-500">*</span>}
|
{required && <span className="text-red-500">*</span>}
|
||||||
|
|
@ -39,7 +46,7 @@ export function LabelWrapper({
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Info className="w-3.5 h-3.5 text-muted-foreground" />
|
<Info className="w-3.5 h-3.5 text-muted-foreground" />
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>{helperText}</TooltipContent>
|
<TooltipContent side="right">{helperText}</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Label>
|
</Label>
|
||||||
|
|
@ -48,7 +55,7 @@ export function LabelWrapper({
|
||||||
<p className="text-mmd text-muted-foreground">{description}</p>
|
<p className="text-mmd text-muted-foreground">{description}</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{flex && <div className="relative">{children}</div>}
|
{flex && <div className="relative items-center flex">{children}</div>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue