Browse Source

fix(auth): update validation messages in forgot password form

- Adjust layout styles in AuthLayout and ForgotPassword components
- Enhance validation error message for email input in ForgotPasswordForm
satnaing 2 months ago
parent
commit
3798a79dab

+ 1 - 1
src/features/auth/auth-layout.tsx

@@ -7,7 +7,7 @@ type AuthLayoutProps = {
 export function AuthLayout({ children }: AuthLayoutProps) {
   return (
     <div className='container grid h-svh max-w-none items-center justify-center'>
-      <div className='mx-auto flex w-full flex-col justify-center space-y-2 py-8 sm:w-[480px] sm:p-8'>
+      <div className='mx-auto flex w-full flex-col justify-center space-y-2 py-8 sm:p-8'>
         <div className='mb-4 flex items-center justify-center'>
           <Logo className='me-2' />
           <h1 className='text-xl font-medium'>Shadcn Admin</h1>

+ 1 - 3
src/features/auth/forgot-password/components/forgot-password-form.tsx

@@ -19,7 +19,7 @@ import { Input } from '@/components/ui/input'
 
 const formSchema = z.object({
   email: z.email({
-    error: (iss) => (iss.input === '' ? 'Please enter your email' : undefined),
+    error: (iss) => (iss.input === '' ? 'Please enter your email.' : undefined),
   }),
 })
 
@@ -37,8 +37,6 @@ export function ForgotPasswordForm({
 
   function onSubmit(data: z.infer<typeof formSchema>) {
     setIsLoading(true)
-    // eslint-disable-next-line no-console
-    console.log(data)
 
     toast.promise(sleep(2000), {
       loading: 'Sending email...',

+ 1 - 1
src/features/auth/forgot-password/index.tsx

@@ -13,7 +13,7 @@ import { ForgotPasswordForm } from './components/forgot-password-form'
 export function ForgotPassword() {
   return (
     <AuthLayout>
-      <Card className='gap-4'>
+      <Card className='max-w-sm gap-4 sm:min-w-sm'>
         <CardHeader>
           <CardTitle className='text-lg tracking-tight'>
             Forgot Password