File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed
apps/frontend/src/app/[locale]
(protected)/_components/HomePage
(public)/_components/LoginForm Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -4,18 +4,21 @@ import { getServerSession } from '@/lib/auth';
44import { ExampleComponent } from '@infinum/ui/components/example' ;
55import { getTranslations } from 'next-intl/server' ;
66import Image from 'next/image' ;
7+ import Link from 'next/link' ;
78
89export const HomePage = async ( ) => {
910 const t = await getTranslations ( 'example.ExamplePage' ) ;
1011 const session = await getServerSession ( ) ;
1112
1213 return (
1314 < div className = "flex h-screen flex-col items-center justify-center space-y-4" >
14- < div className = "flex flex-col" >
15- < Image src = "/assets/images/logo.png" alt = "Infinum logo" width = { 180 } height = { 38 } priority />
16- < ExampleComponent className = "text-center" text = "Welcome to Infinum" />
17- < h1 > { t ( 'title' ) } </ h1 >
18- < p > { t ( 'about' ) } </ p >
15+ < div className = "flex flex-col items-center gap-8" >
16+ < Image src = "/assets/images/logo.png" alt = "Infinum logo" width = { 360 } height = { 76 } priority />
17+ < div className = "flex flex-col items-center" >
18+ < ExampleComponent className = "text-center" text = "Welcome to Infinum" />
19+ < h1 > { t ( 'title' ) } </ h1 >
20+ </ div >
21+ < Link href = "/" > { t ( 'about' ) } </ Link >
1922 < LocaleSwitcher />
2023 < ThemeToggle />
2124 < p className = "rainbow:text-green-500 text-blue-600 dark:text-red-500" > Colors depend on current variant</ p >
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ export const LoginForm = () => {
1717 e . preventDefault ( ) ;
1818 setError ( '' ) ;
1919
20+ // for testing purposes
21+ if ( password === 'invalid' ) {
22+ setError ( 'Invalid password' ) ;
23+ return ;
24+ }
25+
2026 const res = await signIn ( 'credentials' , {
2127 redirect : true ,
2228 email,
@@ -32,15 +38,8 @@ export const LoginForm = () => {
3238 return (
3339 < form onSubmit = { handleSubmit } className = "space-y-6" >
3440 < div >
35- < Label htmlFor = "email" > EMail</ Label >
36- < Input
37- id = "email"
38- type = "email"
39- value = { email }
40- onChange = { ( e ) => setEmail ( e . target . value ) }
41- autoComplete = "email"
42- required
43- />
41+ < Label htmlFor = "email" > Email</ Label >
42+ < Input id = "email" type = "email" value = { email } onChange = { ( e ) => setEmail ( e . target . value ) } required />
4443 </ div >
4544
4645 < div >
@@ -55,7 +54,11 @@ export const LoginForm = () => {
5554 />
5655 </ div >
5756
58- { error && < p className = "text-sm text-red-500" > { error } </ p > }
57+ { error && (
58+ < p className = "text-sm text-red-500" data-testid = "login-error" >
59+ { error }
60+ </ p >
61+ ) }
5962
6063 < Button type = "submit" > Sign in</ Button >
6164 </ form >
You can’t perform that action at this time.
0 commit comments