This commit is contained in:
2026-05-12 17:35:38 +03:00
parent d9ffcb4b92
commit e3f3e62482
51 changed files with 882 additions and 3413 deletions
+18 -16
View File
@@ -1,19 +1,18 @@
'use client';
"use client";
import { lusitana } from '@/app/ui/fonts';
import { ArrowRightIcon } from "@heroicons/react/20/solid";
import {
AtSymbolIcon,
KeyIcon,
ExclamationCircleIcon,
} from '@heroicons/react/24/outline';
import { ArrowRightIcon } from '@heroicons/react/20/solid';
import { Button } from './button';
import { useFormState, useFormStatus } from 'react-dom';
import { authenticate } from '../lib/actions';
KeyIcon,
} from "@heroicons/react/24/outline";
import { useFormState, useFormStatus } from "react-dom";
import { lusitana } from "@/app/ui/fonts";
import { authenticate } from "../lib/actions";
import { Button } from "./button";
export default function LoginForm() {
const [errorMessage, dispatch] = useFormState(authenticate, undefined)
const [errorMessage, dispatch] = useFormState(authenticate, undefined);
return (
<form action={dispatch} className="space-y-3">
<div className="flex-1 rounded-lg bg-gray-50 px-6 pb-4 pt-8">
@@ -62,15 +61,18 @@ export default function LoginForm() {
</div>
</div>
<LoginButton />
<div className="flex h-8 items-end space-x-1" aria-live='polite' aria-atomic='true'>
<div
className="flex h-8 items-end space-x-1"
aria-live="polite"
aria-atomic="true"
>
{/* Add form errors here */}
{errorMessage && (
<>
<ExclamationCircleIcon className='h-5 w-5 text-red-500' />
<p className='text-sm text-red-500'>{errorMessage}</p>
<ExclamationCircleIcon className="h-5 w-5 text-red-500" />
<p className="text-sm text-red-500">{errorMessage}</p>
</>
)}
</div>
</div>
</form>
@@ -78,10 +80,10 @@ export default function LoginForm() {
}
function LoginButton() {
const {pending} = useFormStatus()
const { pending } = useFormStatus();
return (
<Button className="mt-4 w-full" aria-disabled={pending}>
Log in <ArrowRightIcon className="ml-auto h-5 w-5 text-gray-50" />
</Button>
);
}
}