From 5b7d84d6573d2f32c76a4713f1794efe4ddc119e Mon Sep 17 00:00:00 2001 From: Oleksandra Nedashkivska Date: Tue, 27 Aug 2024 18:48:47 +0300 Subject: [PATCH 1/2] OV-71: + asterisk to required auth fields --- .../components/common/password-input/password-input.tsx | 9 ++++++++- .../auth/components/sign-in-form/sign-in-form.tsx | 2 ++ .../auth/components/sign-up-form/sign-up-form.tsx | 4 ++++ frontend/src/bundles/common/components/input/input.tsx | 8 +++++--- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/frontend/src/bundles/auth/components/common/password-input/password-input.tsx b/frontend/src/bundles/auth/components/common/password-input/password-input.tsx index 57e8cf7ae..6c7881d4a 100644 --- a/frontend/src/bundles/auth/components/common/password-input/password-input.tsx +++ b/frontend/src/bundles/auth/components/common/password-input/password-input.tsx @@ -12,9 +12,15 @@ type Properties = { label: string; name: string; hasError: boolean; + required?: boolean; }; -const PasswordInput: React.FC = ({ label, name, hasError }) => { +const PasswordInput: React.FC = ({ + label, + name, + hasError, + required = false, +}) => { const [isPasswordVisible, setIsPasswordVisible] = useState(false); const handlePasswordIconClick = useCallback((): void => { @@ -31,6 +37,7 @@ const PasswordInput: React.FC = ({ label, name, hasError }) => { placeholder="••••••••" name={name} icon="right" + required={required} /> = ({ onSubmit }) => { label="Email" placeholder="user@gmail.com" name="email" + required={true} /> = ({ onSubmit }) => { label="Full Name" placeholder="Name" name="name" + required={true} /> = { - type?: 'text' | 'email' | 'number' | 'password'; label: string; name: FieldInputProps['name']; + type?: 'text' | 'email' | 'number' | 'password'; + required?: boolean; placeholder?: string; icon?: 'right' | 'none'; }; const Input = ({ - type = 'text', label, name, + type = 'text', + required = false, placeholder = '', icon = 'none', }: Properties): JSX.Element => { @@ -30,7 +32,7 @@ const Input = ({ const hasError = Boolean(error) && touched; return ( - + {label} Date: Tue, 27 Aug 2024 19:37:45 +0300 Subject: [PATCH 2/2] OV-71: * use boolean props shorthand --- .../bundles/auth/components/sign-in-form/sign-in-form.tsx | 4 ++-- .../bundles/auth/components/sign-up-form/sign-up-form.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/bundles/auth/components/sign-in-form/sign-in-form.tsx b/frontend/src/bundles/auth/components/sign-in-form/sign-in-form.tsx index 2475cf96a..4296fe803 100644 --- a/frontend/src/bundles/auth/components/sign-in-form/sign-in-form.tsx +++ b/frontend/src/bundles/auth/components/sign-in-form/sign-in-form.tsx @@ -70,13 +70,13 @@ const SignInForm: React.FC = ({ onSubmit }) => { label="Email" placeholder="user@gmail.com" name="email" - required={true} + required /> = ({ onSubmit }) => { label="Full Name" placeholder="Name" name="name" - required={true} + required />