| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import { Form, Head } from '@inertiajs/react';
- import { LoaderCircle } from 'lucide-react';
- import RegisteredUserController from '@/actions/App/Http/Controllers/Auth/RegisteredUserController';
- import { InputError } from '@/common/InputError';
- import { TextLink } from '@/common/TextLink';
- import AuthLayout from '@/pages/layouts/AuthLayout';
- import { login } from '@/routes';
- import { Button } from '@/shadcn/button';
- import { Input } from '@/shadcn/input';
- import { Label } from '@/shadcn/label';
- export default function RegisterPage() {
- return (
- <AuthLayout title="Create an account" description="Enter your details below to create your account">
- <Head title="Register" />
- <Form
- {...RegisteredUserController.store.form()}
- resetOnSuccess={['password', 'password_confirmation']}
- disableWhileProcessing
- className="flex flex-col gap-6"
- >
- {({ processing, errors }) => (
- <>
- <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"
- name="name"
- 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}
- autoComplete="email"
- name="email"
- placeholder="email@example.com"
- />
- <InputError message={errors.email} />
- </div>
- <div className="grid gap-2">
- <Label htmlFor="password">Password</Label>
- <Input
- id="password"
- type="password"
- required
- tabIndex={3}
- autoComplete="new-password"
- name="password"
- placeholder="Password"
- />
- <InputError message={errors.password} />
- </div>
- <div className="grid gap-2">
- <Label htmlFor="password_confirmation">Confirm password</Label>
- <Input
- id="password_confirmation"
- type="password"
- required
- tabIndex={4}
- autoComplete="new-password"
- name="password_confirmation"
- placeholder="Confirm password"
- />
- <InputError message={errors.password_confirmation} />
- </div>
- <Button type="submit" className="mt-2 w-full" tabIndex={5}>
- {processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
- Create account
- </Button>
- </div>
- <div className="text-center text-sm text-muted-foreground">
- Already have an account?{' '}
- <TextLink href={login()} tabIndex={6}>
- Log in
- </TextLink>
- </div>
- </>
- )}
- </Form>
- </AuthLayout>
- );
- }
|