You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1009 B
37 lines
1009 B
import { Label } from "@components/UI/Label.tsx";
|
|
|
|
export interface FieldWrapperProps {
|
|
label: string;
|
|
description?: string;
|
|
disabled?: boolean;
|
|
children?: React.ReactNode;
|
|
valid?: boolean;
|
|
validationText?: string;
|
|
}
|
|
|
|
export const FieldWrapper = ({
|
|
label,
|
|
description,
|
|
children,
|
|
valid,
|
|
validationText,
|
|
}: FieldWrapperProps) => (
|
|
<div className="pt-6 sm:pt-5">
|
|
<fieldset aria-labelledby="label-notifications">
|
|
<div className="sm:grid sm:grid-cols-3 sm:items-baseline sm:gap-4">
|
|
<Label>{label}</Label>
|
|
<div className="sm:col-span-2">
|
|
<div className="max-w-lg">
|
|
<p className="text-sm text-gray-500">{description}</p>
|
|
<p hidden={valid ?? true} className="text-sm text-red-500">
|
|
{validationText}
|
|
</p>
|
|
<div className="mt-4 space-y-4">
|
|
<div className="flex items-center">{children}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
);
|
|
|