-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #281 from ShivanshPlays/admin-BE
- Loading branch information
Showing
7 changed files
with
207 additions
and
30 deletions.
There are no files selected for viewing
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,7 @@ | ||
const AdminPage = () => { | ||
return ( | ||
<div> hi from admin</div> | ||
); | ||
} | ||
|
||
export default AdminPage; |
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,69 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Input } from "@/components/ui/input"; | ||
import { Label } from "@/components/ui/label"; | ||
import { Spinner } from "@/components/ui/spinner"; | ||
import { cn } from "@/lib/utils"; | ||
import toast, { Toaster } from "react-hot-toast"; | ||
|
||
interface AdminAuthFormProps extends React.HTMLAttributes<HTMLDivElement> { | ||
authType: "signup" | "login"; | ||
} | ||
|
||
export function AdminLoginForm({ | ||
className, | ||
authType, | ||
...props | ||
}: AdminAuthFormProps) { | ||
const [isLoading, setIsLoading] = React.useState<boolean>(false); | ||
const [email, setEmail] = React.useState(""); | ||
|
||
async function onSubmit(event: React.SyntheticEvent) { | ||
event.preventDefault(); | ||
setIsLoading(true); | ||
|
||
setIsLoading(false); | ||
} | ||
|
||
return ( | ||
<div className={cn("grid gap-6", className)} {...props}> | ||
<Toaster /> | ||
|
||
<form onSubmit={onSubmit}> | ||
<div className="grid gap-2"> | ||
<div className="grid gap-1"> | ||
<Label className="sr-only" htmlFor="email"> | ||
</Label> | ||
<Input | ||
id="email" | ||
placeholder="[email protected]" | ||
type="email" | ||
autoCapitalize="none" | ||
autoComplete="email" | ||
autoCorrect="off" | ||
disabled={isLoading} | ||
value={email} | ||
onChange={(e) => setEmail(e.target.value)} | ||
/> | ||
</div> | ||
<Button | ||
type="submit" | ||
className="bg-gradient-to-r from-purple-600 via-blue-600 to-indigo-600" | ||
disabled={isLoading} | ||
> | ||
{isLoading ? ( | ||
<Spinner className="mr-2" /> | ||
) : authType === "signup" ? ( | ||
"Sign Up with Email" | ||
) : ( | ||
"Sign In with Email" | ||
)} | ||
</Button> | ||
</div> | ||
</form> | ||
</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,45 @@ | ||
import { Metadata } from 'next'; | ||
import Image from 'next/image'; | ||
import { AdminLoginForm } from '@/app/admin/auth/components/login-form'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Authentication', | ||
description: 'Authentication forms built using the components.', | ||
}; | ||
|
||
export default function AuthenticationPage() { | ||
return ( | ||
<> | ||
<div className="flex flex-col md:flex-row items-center justify-center min-h-screen bg-gradient-to-r from-purple-600 via-blue-600 to-indigo-600"> | ||
{/* Background Image Section for larger screens */} | ||
|
||
<Image | ||
src="/adminLogin.png" | ||
width={1280} | ||
height={843} | ||
alt="Authentication" | ||
className="object-contain w-2/4 h-2/4 rounded-xl" | ||
/> | ||
|
||
|
||
{/* Main Content Section */} | ||
<div className="z-10 w-full max-w-2xl px-6 py-8 mx-auto text-white rounded-xl bg-black bg-opacity-70"> | ||
<div className="space-y-6"> | ||
{/* Title and Description */} | ||
<div className="text-center"> | ||
<h1 className="text-3xl font-semibold">Welcome Back, Admin!</h1> | ||
<p className="text-sm text-muted-foreground">Enter your credentials to access your admin panel.</p> | ||
</div> | ||
|
||
{/* Admin Login Form */} | ||
<AdminLoginForm className='w-full' authType="login" /> | ||
|
||
{/* Alternative Links | ||
<div className="flex justify-between text-sm text-center text-white"> | ||
</div> */} | ||
</div> | ||
</div> | ||
</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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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