added all pages placeholders

This commit is contained in:
2025-09-22 16:45:50 +03:00
parent 181fe61368
commit e566bd75b8
23 changed files with 251 additions and 61 deletions

View File

@ -1,9 +1,9 @@
import React, { useState } from 'react';
import './FormField.css';
import React, { useState } from "react";
import "./FormField.css";
interface FormFieldProperties {
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search';
type?: "text" | "email" | "password" | "number" | "tel" | "url" | "search";
placeholder?: string;
value: string;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
@ -22,24 +22,24 @@ interface FormFieldProperties {
const FormField: React.FC<FormFieldProperties> = ({
type = 'text',
type = "text",
placeholder,
value,
onChange,
required = false,
errorMessage = 'Please fill out this field',
errorMessage = "Please fill out this field",
showError = false,
onBlur,
onFocus,
className = '',
className = "",
disabled = false,
autoComplete = 'off',
autoComplete = "off",
customValidator,
showErrorInitially = false,
icon: Icon,
}) => {
const [touched, setTouched] = useState<boolean>(showErrorInitially);
const [customError, setCustomError] = useState<string>('');
const [customError, setCustomError] = useState<string>("");
const validateField = (value: string): string => {
if (required && !value) {
@ -51,7 +51,7 @@ const FormField: React.FC<FormFieldProperties> = ({
return customValidation;
}
}
return '';
return "";
};
const shouldShowError = showError || (touched && validateField(value));
@ -64,7 +64,7 @@ const FormField: React.FC<FormFieldProperties> = ({
};
const handleFocus = (e: React.FocusEvent<HTMLInputElement>): void => {
setCustomError('');
setCustomError("");
onFocus?.(e);
};
@ -85,7 +85,7 @@ const FormField: React.FC<FormFieldProperties> = ({
required={required}
disabled={disabled}
autoComplete={autoComplete}
className={shouldShowError ? 'error' : ''}
className={shouldShowError ? "error" : ""}
/>
{shouldShowError && (
<div className="error-message">