@@ -31,51 +31,89 @@ export default function LoginPage(props: LoginPageProps) {
3131 } ;
3232
3333 return (
34- < form onSubmit = { onSubmit } className = "space-y-2" >
35- < div className = "flex flex-col border" >
36- < label htmlFor = "username" > Username</ label >
37- < input
38- id = "username"
39- type = "text"
40- value = { username }
41- minLength = { authenticationSchema . properties . username . minLength }
42- maxLength = { authenticationSchema . properties . username . maxLength }
43- onChange = { ( e ) => setUsername ( e . target . value ) }
44- required
45- autoComplete = "username"
46- />
47- </ div >
48- < div className = "flex flex-col border" >
49- < label htmlFor = "password" > Password</ label >
50- < input
51- id = "password"
52- type = "password"
53- minLength = { authenticationSchema . properties . password . minLength }
54- maxLength = { authenticationSchema . properties . password . maxLength }
55- value = { password }
56- onChange = { ( e ) => setPassword ( e . target . value ) }
57- required
58- autoComplete = "current-password"
59- />
60- </ div >
61- < div className = "flex justify-between" >
62- < button
63- className = "bg-red-600 disabled:bg-gray-600"
64- type = "submit"
65- disabled = {
66- loginMutation . isPending ||
67- ! safeParse ( authenticationChecker , {
68- username,
69- password,
70- } ) . success
71- }
72- >
73- Login
74- </ button >
34+ < div className = "flex min-h-screen items-center justify-center p-8" >
35+ < div className = "w-full max-w-md space-y-8" >
36+ < div className = "text-center" >
37+ < h1 className = "text-3xl font-bold tracking-tight" > Login</ h1 >
38+ < p className = "mt-2 text-sm text-gray-400" >
39+ Sign in to your account
40+ </ p >
41+ </ div >
42+
43+ < form onSubmit = { onSubmit } className = "space-y-6" >
44+ < div className = "space-y-2" >
45+ < label
46+ htmlFor = "username"
47+ className = "block text-sm font-medium text-gray-300"
48+ >
49+ Username
50+ </ label >
51+ < input
52+ id = "username"
53+ type = "text"
54+ value = { username }
55+ minLength = { authenticationSchema . properties . username . minLength }
56+ maxLength = { authenticationSchema . properties . username . maxLength }
57+ onChange = { ( e ) => setUsername ( e . target . value ) }
58+ required
59+ autoComplete = "username"
60+ className = "w-full rounded-lg border border-gray-700 bg-gray-900 px-4 py-3 text-white placeholder-gray-500 transition-colors focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"
61+ placeholder = "Enter your username"
62+ />
63+ </ div >
64+
65+ < div className = "space-y-2" >
66+ < label
67+ htmlFor = "password"
68+ className = "block text-sm font-medium text-gray-300"
69+ >
70+ Password
71+ </ label >
72+ < input
73+ id = "password"
74+ type = "password"
75+ minLength = { authenticationSchema . properties . password . minLength }
76+ maxLength = { authenticationSchema . properties . password . maxLength }
77+ value = { password }
78+ onChange = { ( e ) => setPassword ( e . target . value ) }
79+ required
80+ autoComplete = "current-password"
81+ className = "w-full rounded-lg border border-gray-700 bg-gray-900 px-4 py-3 text-white placeholder-gray-500 transition-colors focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"
82+ placeholder = "Enter your password"
83+ />
84+ </ div >
85+
86+ < button
87+ type = "submit"
88+ disabled = {
89+ loginMutation . isPending ||
90+ ! safeParse ( authenticationChecker , {
91+ username,
92+ password,
93+ } ) . success
94+ }
95+ className = "w-full rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-950 disabled:cursor-not-allowed disabled:bg-gray-700 disabled:text-gray-400"
96+ >
97+ { loginMutation . isPending ? "Logging in..." : "Login" }
98+ </ button >
99+
100+ { status && (
101+ < div className = "rounded-lg border border-red-800 bg-red-950/50 px-4 py-3 text-sm text-red-400" >
102+ { status }
103+ </ div >
104+ ) }
75105
76- < Link href = "/register" > Register</ Link >
106+ < div className = "text-center text-sm text-gray-400" >
107+ Don't have an account?{ " " }
108+ < Link
109+ href = "/register"
110+ className = "font-medium text-blue-500 hover:text-blue-400 hover:underline"
111+ >
112+ Register
113+ </ Link >
114+ </ div >
115+ </ form >
77116 </ div >
78- { status && < div > { status } </ div > }
79- </ form >
117+ </ div >
80118 ) ;
81119}
0 commit comments