This commit is contained in:
ct
2025-06-13 17:11:59 +08:00
parent 248a717898
commit 61923f4e1f
17 changed files with 515 additions and 41 deletions

View File

@@ -10,7 +10,6 @@ import { Label } from '@/components/ui/label';
import AuthLayout from '@/layouts/auth-layout';
type RegisterForm = {
name: string;
email: string;
password: string;
password_confirmation: string;
@@ -18,7 +17,6 @@ type RegisterForm = {
export default function Register() {
const { data, setData, post, processing, errors, reset } = useForm<Required<RegisterForm>>({
name: '',
email: '',
password: '',
password_confirmation: '',
@@ -36,30 +34,14 @@ export default function Register() {
<Head title="Register" />
<form className="flex flex-col gap-6" onSubmit={submit}>
<div className="grid gap-6">
<div className="grid gap-2">
<Label htmlFor="name">Name</Label>
<Input
id="name"
type="text"
required
autoFocus
tabIndex={1}
autoComplete="name"
value={data.name}
onChange={(e) => setData('name', e.target.value)}
disabled={processing}
placeholder="Full name"
/>
<InputError message={errors.name} className="mt-2" />
</div>
<div className="grid gap-2">
<Label htmlFor="email">Email address</Label>
<Input
id="email"
type="email"
required
tabIndex={2}
autoFocus
tabIndex={1}
autoComplete="email"
value={data.email}
onChange={(e) => setData('email', e.target.value)}
@@ -75,7 +57,7 @@ export default function Register() {
id="password"
type="password"
required
tabIndex={3}
tabIndex={2}
autoComplete="new-password"
value={data.password}
onChange={(e) => setData('password', e.target.value)}
@@ -91,7 +73,7 @@ export default function Register() {
id="password_confirmation"
type="password"
required
tabIndex={4}
tabIndex={3}
autoComplete="new-password"
value={data.password_confirmation}
onChange={(e) => setData('password_confirmation', e.target.value)}
@@ -101,7 +83,7 @@ export default function Register() {
<InputError message={errors.password_confirmation} />
</div>
<Button type="submit" className="mt-2 w-full" tabIndex={5} disabled={processing}>
<Button type="submit" className="mt-2 w-full" tabIndex={4} disabled={processing}>
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
Create account
</Button>
@@ -109,7 +91,7 @@ export default function Register() {
<div className="text-muted-foreground text-center text-sm">
Already have an account?{' '}
<TextLink href={route('login')} tabIndex={6}>
<TextLink href={route('login')} tabIndex={5}>
Log in
</TextLink>
</div>