diff --git a/package-lock.json b/package-lock.json index 053de78..a0aa5ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "b2d-ventures": "file:", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "dotenv": "^16.4.5", "embla-carousel-react": "^8.2.0", "lucide-react": "^0.428.0", "next": "14.2.5", @@ -2653,6 +2654,17 @@ "csstype": "^3.0.2" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", diff --git a/package.json b/package.json index 42fa25b..c784239 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "b2d-ventures": "file:", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "dotenv": "^16.4.5", "embla-carousel-react": "^8.2.0", "lucide-react": "^0.428.0", "next": "14.2.5", diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx index 8cf2725..254c835 100644 --- a/src/app/auth/page.tsx +++ b/src/app/auth/page.tsx @@ -3,6 +3,7 @@ import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { LoginButton } from "@/components/auth/loginButton"; +import { LoginForm } from "@/components/auth/loginForm"; export default function Login() { return ( @@ -18,6 +19,8 @@ export default function Login() {

Continue With

+ +
diff --git a/src/components/auth/loginForm.tsx b/src/components/auth/loginForm.tsx new file mode 100644 index 0000000..536b59d --- /dev/null +++ b/src/components/auth/loginForm.tsx @@ -0,0 +1,31 @@ +"use client"; + +import { createSupabaseClient } from "@/lib/supabase/clientComponentClient"; +import { useState } from "react"; +import { Input } from "@/components/ui/input"; +import { Button } from "@/components/ui/button"; +import { useRouter } from "next/navigation"; + +export function LoginForm() { + const router = useRouter(); + const supabase = createSupabaseClient(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + + const handleLogin = async (event: React.MouseEvent) => { + event.preventDefault(); + await supabase.auth.signInWithPassword({ + email, + password, + }); + router.push("/"); + }; + + return ( +
+ setEmail(e.target.value)} placeholder="Email" /> + setPassword(e.target.value)} placeholder="Password" /> + +
+ ); +} diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx new file mode 100644 index 0000000..a921025 --- /dev/null +++ b/src/components/ui/input.tsx @@ -0,0 +1,25 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +export interface InputProps + extends React.InputHTMLAttributes {} + +const Input = React.forwardRef( + ({ className, type, ...props }, ref) => { + return ( + + ) + } +) +Input.displayName = "Input" + +export { Input }