Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance sign #78

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 92 additions & 74 deletions components/AuthComponent/SigninForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,84 +50,102 @@ export default function SigninForm() {
};

return (
<main className="flex min-h-screen items-center justify-center px-4">
<Card className="w-full max-w-sm rounded-2xl">
<CardHeader>
<CardTitle>Sign in</CardTitle>
<CardDescription>
Enter your credentials to access your account
</CardDescription>
</CardHeader>
<CardContent>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
<FormField
control={form.control}
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormControl>
<Input placeholder="[email protected]" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="password"
render={({ field }) => (
<FormItem>
<FormLabel>Password</FormLabel>
<FormControl>
<div className="relative">
<main className="flex min-h-screen items-center justify-center p-2 md:p-0">
<div className="w-full max-w-3xl min-h-[70vh] grid md:grid-cols-2 gap-8 bg-light-auth dark:bg-dark-auth rounded-2xl shadow-lg md:overflow-hidden">
<Card className="md:col-span-1 flex flex-col justify-center h-full md:border-none shadow-none md:bg-primary-foreground/10 backdrop-blur-3xl">
<CardHeader className="space-y-1">
<CardTitle className="text-3xl font-bold">
Log In
</CardTitle>
<CardDescription>
Enter your credentials to access your account
</CardDescription>
</CardHeader>
<CardContent>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-4"
>
<FormField
control={form.control}
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormControl>
<Input
type={showPassword ? "text" : "password"}
placeholder="••••••••"
placeholder="[email protected]"
{...field}
className="rounded-md"
/>
<Button
type="button"
variant="ghost"
size="sm"
className="absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent"
onClick={() => setShowPassword(!showPassword)}
>
{showPassword ? (
<EyeOff className="h-4 w-4" />
) : (
<Eye className="h-4 w-4" />
)}
</Button>
</div>
</FormControl>
<FormMessage />
</FormItem>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="password"
render={({ field }) => (
<FormItem>
<FormLabel>Password</FormLabel>
<FormControl>
<div className="relative">
<Input
type={showPassword ? "text" : "password"}
placeholder="••••••••"
{...field}
className="rounded-md pr-10"
/>
<Button
type="button"
variant="ghost"
size="sm"
className="absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent"
onClick={() => setShowPassword(!showPassword)}
>
{showPassword ? (
<EyeOff className="h-4 w-4" />
) : (
<Eye className="h-4 w-4" />
)}
</Button>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{signinError && (
<Alert variant="destructive">
<AlertDescription>{signinError}</AlertDescription>
</Alert>
)}
/>
{signinError && (
<Alert variant="destructive">
<AlertDescription>{signinError}</AlertDescription>
</Alert>
)}
<LoadingButton
loading={isSigningIn}
loadingTitle="Signing in"
title="Sign in"
type="submit"
/>
</form>
</Form>
</CardContent>
<CardFooter className="flex justify-center">
<AuthBottom
href="/auth/register"
title="Don't have an account? "
toTitle="Create One!"
/>
</CardFooter>
</Card>
<LoadingButton
loading={isSigningIn}
loadingTitle="Signing in"
title="Sign in"
type="submit"
/>
</form>
</Form>
</CardContent>
<CardFooter className="flex justify-center">
<AuthBottom
href="/auth/register"
title="Don't have an account?"
toTitle="Create One!"
/>
</CardFooter>
</Card>
<div className="hidden md:flex flex-col justify-center p-4">
<h1 className="text-5xl font-bold mb-4">Welcome Back</h1>
<h2 className="text-xl">
We're glad to see you again! Please sign in to continue.
</h2>
</div>
</div>
</main>
);
}
Loading
Loading