Skip to content

Commit 6d321ca

Browse files
Fix: Improve AuthForm design and add back button
Improved the design of the AuthForm to be more consistent with the rest of the project. Added a "back" button for users who do not want to log in or create an account.
1 parent 91a945e commit 6d321ca

1 file changed

Lines changed: 38 additions & 18 deletions

File tree

src/components/AuthForm.tsx

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com
77
import { Separator } from '@/components/ui/separator';
88
import { useAuth } from '@/hooks/useAuth';
99
import { useToast } from '@/hooks/use-toast';
10-
import { Chrome, Mail, Lock } from 'lucide-react';
10+
import { Chrome, Mail, Lock, ArrowLeft } from 'lucide-react';
1111
import { useTranslation } from 'react-i18next';
1212

1313
export const AuthForm = () => {
@@ -68,67 +68,87 @@ export const AuthForm = () => {
6868
}
6969
};
7070

71+
const handleBackToLanding = () => {
72+
window.location.href = '/';
73+
};
74+
7175
return (
72-
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 p-4">
73-
<Card className="w-full max-w-md">
74-
<CardHeader className="text-center">
75-
<CardTitle className="text-2xl font-bold text-blue-600">{t('auth.title')}</CardTitle>
76-
<CardDescription>
76+
<div className="min-h-screen bg-gradient-to-br from-blue-50/50 via-white to-purple-50/50 flex items-center justify-center p-4 relative">
77+
{/* Bouton retour */}
78+
<Button
79+
variant="ghost"
80+
onClick={handleBackToLanding}
81+
className="absolute top-6 left-6 text-slate-600 hover:text-slate-900"
82+
>
83+
<ArrowLeft className="mr-2 h-4 w-4" />
84+
Retour
85+
</Button>
86+
87+
<Card className="w-full max-w-md bg-white/80 backdrop-blur-sm border-slate-200/50 shadow-xl">
88+
<CardHeader className="text-center pb-6">
89+
<CardTitle className="text-2xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
90+
{t('auth.title')}
91+
</CardTitle>
92+
<CardDescription className="text-slate-600">
7793
{isLogin ? t('auth.loginDescription') : t('auth.signupDescription')}
7894
</CardDescription>
7995
</CardHeader>
80-
<CardContent className="space-y-4">
96+
<CardContent className="space-y-6">
8197
<Button
8298
variant="outline"
8399
onClick={handleGoogleSign}
84100
disabled={loading}
85-
className="w-full"
101+
className="w-full border-slate-200 hover:bg-slate-50 transition-colors"
86102
>
87103
<Chrome className="mr-2 h-4 w-4" />
88104
{t('auth.continueWithGoogle')}
89105
</Button>
90106

91107
<div className="relative">
92-
<Separator />
93-
<span className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white px-2 text-sm text-muted-foreground">
108+
<Separator className="bg-slate-200" />
109+
<span className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white px-3 text-sm text-slate-500">
94110
{t('auth.or')}
95111
</span>
96112
</div>
97113

98114
<form onSubmit={handleSubmit} className="space-y-4">
99115
<div className="space-y-2">
100-
<Label htmlFor="email">{t('auth.email')}</Label>
116+
<Label htmlFor="email" className="text-slate-700">{t('auth.email')}</Label>
101117
<div className="relative">
102-
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />
118+
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-slate-400" />
103119
<Input
104120
id="email"
105121
type="email"
106122
value={email}
107123
onChange={(e) => setEmail(e.target.value)}
108124
placeholder={t('auth.emailPlaceholder')}
109-
className="pl-10"
125+
className="pl-10 border-slate-200 focus:border-blue-500 focus:ring-blue-500"
110126
required
111127
/>
112128
</div>
113129
</div>
114130

115131
<div className="space-y-2">
116-
<Label htmlFor="password">{t('auth.password')}</Label>
132+
<Label htmlFor="password" className="text-slate-700">{t('auth.password')}</Label>
117133
<div className="relative">
118-
<Lock className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />
134+
<Lock className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-slate-400" />
119135
<Input
120136
id="password"
121137
type="password"
122138
value={password}
123139
onChange={(e) => setPassword(e.target.value)}
124140
placeholder={t('auth.passwordPlaceholder')}
125-
className="pl-10"
141+
className="pl-10 border-slate-200 focus:border-blue-500 focus:ring-blue-500"
126142
required
127143
/>
128144
</div>
129145
</div>
130146

131-
<Button type="submit" className="w-full" disabled={loading}>
147+
<Button
148+
type="submit"
149+
className="w-full bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white border-0 shadow-lg hover:shadow-xl transition-all duration-200"
150+
disabled={loading}
151+
>
132152
{loading ? t('auth.loading') : (isLogin ? t('auth.signIn') : t('auth.signUp'))}
133153
</Button>
134154
</form>
@@ -137,7 +157,7 @@ export const AuthForm = () => {
137157
<Button
138158
variant="link"
139159
onClick={() => setIsLogin(!isLogin)}
140-
className="text-sm"
160+
className="text-sm text-slate-600 hover:text-slate-900"
141161
>
142162
{isLogin ? t('auth.noAccount') : t('auth.hasAccount')}
143163
</Button>

0 commit comments

Comments
 (0)