-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: Auth pages, SpinLoader comp, Sheet for Cart and Mobile drawing.
Refactor: Refactored PageHeader to support more pages outside admin.
- Loading branch information
1 parent
2b368df
commit 203d17d
Showing
17 changed files
with
534 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use client"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import { useFormState, useFormStatus } from "react-dom"; | ||
import Image from "next/image"; | ||
import SpinLoader from "@/components/SpinLoader"; | ||
|
||
export function SignInForm() { | ||
//const [error, action] = useFormState(null, {}); | ||
|
||
return ( | ||
<form | ||
className="space-y-8 max-w-xl mx-auto" | ||
//action={action} | ||
> | ||
<div className="space-y-2"> | ||
<Label htmlFor="email">Email</Label> | ||
<Input type="email" id="email" name="email" required /> | ||
{/* {error.email && <div className="text-destructive">{error.email}</div>} */} | ||
</div> | ||
<div className="space-y-2"> | ||
<Label htmlFor="password">Password</Label> | ||
<Input type="password" id="password" name="password" required /> | ||
{/* {error.email && <div className="text-destructive">{error.email}</div>} */} | ||
</div> | ||
<SubmitButton /> | ||
</form> | ||
); | ||
} | ||
|
||
function SubmitButton() { | ||
const { pending } = useFormStatus(); | ||
return ( | ||
<Button type="submit" disabled={pending}> | ||
{pending ? <SpinLoader>Please wait..</SpinLoader> : "Sign in"} | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { PageHeader } from "@/components/PageHeader"; | ||
import { SignInForm } from "./_components/SignInForm"; | ||
import Link from "next/link"; | ||
|
||
export default function SignIn() { | ||
return ( | ||
<div className="mt-20 border p-2"> | ||
<PageHeader className="text-center">Sign in</PageHeader> | ||
<p className="text-center"> | ||
New to the platform?{" "} | ||
<Link href="/sign-up" className="text-blue-700 hover:underline"> | ||
Create a new account | ||
</Link> | ||
</p> | ||
<SignInForm /> | ||
|
||
<p className="text-center mt-10"> | ||
Or{" "} | ||
<Link href="/" className="text-blue-700 hover:underline"> | ||
continue browsing | ||
</Link> | ||
</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"use client"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import { Textarea } from "@/components/ui/textarea"; | ||
import { useFormState, useFormStatus } from "react-dom"; | ||
import Image from "next/image"; | ||
import SpinLoader from "@/components/SpinLoader"; | ||
|
||
export function SignUpForm() { | ||
//const [error, action] = useFormState(null, {}); | ||
|
||
return ( | ||
<form | ||
className="space-y-8 max-w-xl mx-auto" | ||
//action={action} | ||
> | ||
<div className="space-y-2"> | ||
<Label htmlFor="email">Email</Label> | ||
<Input type="email" id="email" name="email" required /> | ||
{/* {error.email && <div className="text-destructive">{error.email}</div>} */} | ||
</div> | ||
<div className="space-y-2"> | ||
<Label htmlFor="password">Password</Label> | ||
<Input type="password" id="password" name="password" required /> | ||
{/* {error.email && <div className="text-destructive">{error.email}</div>} */} | ||
</div> | ||
<SubmitButton /> | ||
</form> | ||
); | ||
} | ||
|
||
function SubmitButton() { | ||
const { pending } = useFormStatus(); | ||
return ( | ||
<Button type="submit" disabled={pending}> | ||
{pending ? <SpinLoader>Please wait..</SpinLoader> : "Sign up"} | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { PageHeader } from "@/components/PageHeader"; | ||
import { SignUpForm } from "./_components/SignUpForm"; | ||
import Link from "next/link"; | ||
|
||
export default function SignUp() { | ||
return ( | ||
<div className="mt-20 border p-2"> | ||
<PageHeader className="text-center">Sign up</PageHeader> | ||
<p className="text-center"> | ||
Have an account already?{" "} | ||
<Link href="/sign-in" className="text-blue-700 hover:underline"> | ||
Login | ||
</Link> | ||
</p> | ||
<SignUpForm /> | ||
|
||
<p className="text-center mt-10"> | ||
Or{" "} | ||
<Link href="/" className="text-blue-700 hover:underline"> | ||
continue browsing | ||
</Link> | ||
</p> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.