diff --git a/components/login.tsx b/components/login.tsx new file mode 100644 index 0000000..a82ba5e --- /dev/null +++ b/components/login.tsx @@ -0,0 +1,203 @@ +"use client"; + +import { zodResolver } from "@hookform/resolvers/zod"; +import { useForm } from "react-hook-form"; +import { z } from "zod"; +import { cn } from "@/lib/utils"; + +import { + Form, + FormControl, + FormField, + FormItem, + FormMessage, +} from "@/components/ui/form"; + +import Link from "next/link"; + +import { IconBrandGithub } from "@tabler/icons-react"; +import Password from "./password"; +import { Button } from "./ui/button"; +import { Logo } from "./Logo"; + +const formSchema = z.object({ + email: z + .string({ + message: "Please enter email", + }) + .email("Please enter valid email") + .min(1, "Please enter email"), + password: z + .string({ + message: "Please enter password", + }) + .min(1, "Please enter password"), +}); + +export type LoginUser = z.infer; + +export function LoginForm() { + const form = useForm({ + resolver: zodResolver(formSchema), + defaultValues: { + email: "", + password: "", + }, + }); + + async function onSubmit(_values: LoginUser) { + try { + // Handle login logic here + } catch { + // Handle error silently + } + } + + return ( +
+
+
+
+
+ +
+

+ Sign in to your account +

+
+ +
+
+ +
+ ( + + + +
+ +
+
+ +
+ )} + /> +
+ +
+ ( + + + +
+ +
+
+ +
+ )} + /> +
+ +
+
+ + Forgot password? + +
+
+ +
+ +

+ Don' have an account?{" "} + + Sign up + +

+
+ +
+ +
+
+ + +
+ +
+ +

+ By clicking on sign in, you agree to our{" "} + + Terms of Service + {" "} + and{" "} + + Privacy Policy + +

+
+
+
+
+ + ); +}