fix: fixed auth form
This commit is contained in:
parent
ad66016115
commit
08ef306495
3 changed files with 14 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
import UserAuthForm from '@/components/ui/UserAuthForm';
|
import UserAuthForm from '@/components/ui/UserAuthForm';
|
||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -10,7 +10,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||||
<input
|
<input
|
||||||
type={type}
|
type={type}
|
||||||
className={cn(
|
className={cn(
|
||||||
'flex h-10 w-full rounded-md border border-highlight-primary bg-highlight-primary px-3 py-2 text-sm ring-offset-highlight-primary file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
'flex h-10 w-full rounded-md border border-primary-600 bg-highlight-primary px-3 py-2 text-sm ring-offset-highlight-primary file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted focus:bg-primary-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import cookies from 'js-cookie';
|
import cookies from 'js-cookie';
|
||||||
|
import { Loader2 } from 'lucide-react';
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
import { usePathname, useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import * as z from 'zod';
|
import * as z from 'zod';
|
||||||
import { Loader2 } from 'lucide-react';
|
|
||||||
|
|
||||||
|
import AppLink from '@/components/ui/AppLink';
|
||||||
import { Button } from '@/components/ui/Button';
|
import { Button } from '@/components/ui/Button';
|
||||||
import {
|
import {
|
||||||
Form,
|
Form,
|
||||||
|
@ -106,7 +107,10 @@ export default function UserAuthForm() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
<form
|
||||||
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
|
className="flex w-52 flex-col justify-center space-y-4 sm:w-72"
|
||||||
|
>
|
||||||
{!isSignIn && (
|
{!isSignIn && (
|
||||||
<>
|
<>
|
||||||
<FormField
|
<FormField
|
||||||
|
@ -180,6 +184,12 @@ export default function UserAuthForm() {
|
||||||
{isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
{isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
|
||||||
{isSignIn ? 'Se connecter' : "S'inscrire"}
|
{isSignIn ? 'Se connecter' : "S'inscrire"}
|
||||||
</Button>
|
</Button>
|
||||||
|
<p className="flex flex-col items-center text-sm text-muted">
|
||||||
|
{isSignIn ? "Vous n'avez pas de compte?" : 'Vous possédez un compte?'}{' '}
|
||||||
|
<AppLink className="text-brand underline" href={isSignIn ? '/sign-up' : '/sign-in'}>
|
||||||
|
{isSignIn ? "S'inscrire maintenant" : 'Se connecter'}
|
||||||
|
</AppLink>
|
||||||
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue