Skip to content

Commit

Permalink
Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
w3bdesign committed Aug 5, 2024
1 parent e228f32 commit 61fbe8b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/UI/InputField.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface IInputProps {
error?: FieldError | undefined;
}

const InputField: React.FC<IInputProps> = ({
const InputField = ({
inputName,
label,
inputPattern,
Expand All @@ -24,7 +24,7 @@ const InputField: React.FC<IInputProps> = ({
register,
error,
...props
}) => {
}: IInputProps) => {
const sharedClasses =
"cursor-pointer peer block text-xl w-64 p-2 bg-gray-800 text-slate-200 border-gray-500 border rounded border-opacity-50 outline-none focus:border-slate-200 placeholder-gray-300 placeholder-opacity-0 transition duration-200";

Expand All @@ -36,7 +36,7 @@ const InputField: React.FC<IInputProps> = ({
id={htmlFor}
type="text"
placeholder={label}
className={`${sharedClasses} ${error ? 'border-red-500' : ''}`}
className={`${sharedClasses} ${error ? "border-red-500" : ""}`}
{...register(inputName, {
required: isRequired,
pattern: inputPattern ? new RegExp(inputPattern) : undefined,
Expand All @@ -47,7 +47,7 @@ const InputField: React.FC<IInputProps> = ({
<textarea
id={htmlFor}
placeholder={label}
className={`${sharedClasses} ${error ? 'border-red-500' : ''}`}
className={`${sharedClasses} ${error ? "border-red-500" : ""}`}
{...register(inputName, { required: isRequired })}
{...props}
></textarea>
Expand All @@ -68,4 +68,4 @@ const InputField: React.FC<IInputProps> = ({
);
};

export default InputField;
export default InputField;

0 comments on commit 61fbe8b

Please sign in to comment.