Fixed forms

This commit is contained in:
Nicolas
2025-02-23 16:48:42 +01:00
parent f5c777ca32
commit 972fb2fd15
2 changed files with 72 additions and 96 deletions

View File

@@ -1,14 +1,14 @@
import React from 'react';
import React from "react";
import {
FieldValues,
Path,
RegisterOptions,
UseFormReturn,
} from 'react-hook-form';
import { cn } from '../../../helper/cn';
} from "react-hook-form";
import { cn } from "../../../helper/cn";
interface InputProps<T extends FieldValues>
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'form'> {
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "form"> {
name: Path<T>;
form: UseFormReturn<T>;
formOptions?: RegisterOptions<T>;
@@ -26,17 +26,13 @@ export const Input = <T extends FieldValues>({
...inputProps
}: InputProps<T>) => {
return (
<label className="form-control w-full">
<div className="label">
<span className="label-text text-lg flex items-center gap-2">
{label}
</span>
</div>
<label className="floating-label w-full mt-5">
<span className="text-lg flex items-center gap-2">{label}</span>
<input
{...form.register(name, formOptions)}
type="text"
className={cn(
'input input-bordered w-full placeholder:text-neutral-600',
"input input-bordered w-full placeholder:text-neutral-600",
className
)}
placeholder={placeholder}