From 1780160c45d740d0ddc107f408f8d5126b136c69 Mon Sep 17 00:00:00 2001 From: Anand Suthar Date: Wed, 24 Jul 2024 23:45:40 +0530 Subject: [PATCH] refactor : remove showtoast and use errorMessage, isInvalid properties of Input components --- app/components/ProfileSettings/index.tsx | 47 +++++++++++++++--------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/app/components/ProfileSettings/index.tsx b/app/components/ProfileSettings/index.tsx index 54e0e4ea..8a5d0527 100644 --- a/app/components/ProfileSettings/index.tsx +++ b/app/components/ProfileSettings/index.tsx @@ -390,7 +390,8 @@ export default function ProfileSettings({ user }: ProfileSettingsProps) { value={firstname} className="max-w-xs" onChange={handleFirstNameChange} - onBlur={() => formValidator.showToast("firstname")} + isInvalid={!!formValidator.getError("firstname")} + errorMessage={formValidator.getError("firstname")} /> formValidator.showToast("lastname")} + isInvalid={!!formValidator.getError("lastname")} + errorMessage={formValidator.getError("lastname")} /> formValidator.showToast("username")} + isInvalid={!!formValidator.getError("username")} + errorMessage={formValidator.getError("username")} /> formValidator.showToast("email")} + isInvalid={!!formValidator.getError("email")} + errorMessage={formValidator.getError("email")} />