-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web-client): Add chakra ui to authentication pages, sidebar and …
…dashboard (#210) * feat(web-client): Add chakra ui to authentication pages * feat(web-client): Add chakra ui to sidebar * feat(web-client): Add chakra ui to dashboard
- Loading branch information
1 parent
6a5d622
commit 0277b39
Showing
7 changed files
with
225 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Flex, Text, Button } from '@chakra-ui/react'; | ||
import Link from 'next/link'; | ||
|
||
export default function P404() { | ||
return ( | ||
<Flex | ||
height="100vh" | ||
width="100vw" | ||
direction="column" | ||
alignItems="center" | ||
justifyContent="center" | ||
> | ||
<Text fontSize="9xl" fontWeight="bold"> | ||
404 | ||
</Text> | ||
|
||
<Button> | ||
<Link href="/">Back home</Link> | ||
</Button> | ||
</Flex> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,79 @@ | ||
import React, { useState } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import Link from 'next/link'; | ||
|
||
import useLocalStorage from '@/hooks/useLocalStorage'; | ||
import { loginService } from '@/services/authenticationService'; | ||
|
||
import { | ||
Button, | ||
Box, | ||
Card, | ||
CardBody, | ||
FormControl, | ||
FormLabel, | ||
Input, | ||
Flex, | ||
Text, | ||
} from '@chakra-ui/react'; | ||
|
||
export default function Login() { | ||
const router = useRouter(); | ||
|
||
const [loading, setLoading] = useState(false); | ||
|
||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
|
||
const [token, setToken] = useLocalStorage('token', null); | ||
|
||
const handleSubmit = async (e) => { | ||
e.preventDefault(); | ||
setLoading(true); | ||
if (await loginService({ email, password })) router.push('/organizations'); | ||
else console.error('Error when logging in'); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<form onSubmit={handleSubmit}> | ||
<label> | ||
Email: | ||
<input | ||
type="text" | ||
name="email" | ||
onChange={(e) => { | ||
setEmail(e.target.value); | ||
}} | ||
/> | ||
</label> | ||
<label> | ||
Password: | ||
<input | ||
type="passwor" | ||
name="password" | ||
onChange={(e) => { | ||
setPassword(e.target.value); | ||
}} | ||
/> | ||
</label> | ||
<input type="submit" value="Submit" /> | ||
</form> | ||
</div> | ||
<Flex direction="column" height="100vh" alignItems="center" justifyContent="center" gap={8}> | ||
<Box textAlign="center"> | ||
<Text fontSize="3xl" fontWeight="bold"> | ||
Login to your account | ||
</Text> | ||
<Text> | ||
Don't have an account?{' '} | ||
<Text as="span" color="blue" fontWeight="semibold"> | ||
<Link href="/signup">Sign up</Link> | ||
</Text> | ||
</Text> | ||
</Box> | ||
<Card width="100%" maxWidth="400px" height="auto"> | ||
<CardBody> | ||
<form onSubmit={handleSubmit}> | ||
<FormControl isRequired my={4}> | ||
<FormLabel>Email address</FormLabel> | ||
<Input | ||
type="email" | ||
name="email" | ||
onChange={(e) => { | ||
setEmail(e.target.value); | ||
}} | ||
/> | ||
</FormControl> | ||
<FormControl isRequired my={4}> | ||
<FormLabel>Password</FormLabel> | ||
<Input | ||
type="password" | ||
name="password" | ||
onChange={(e) => { | ||
setPassword(e.target.value); | ||
}} | ||
/> | ||
</FormControl> | ||
|
||
<Button type="submit" width="100%" my="4" isLoading={loading} loadingText="Please Wait"> | ||
Login | ||
</Button> | ||
</form> | ||
</CardBody> | ||
</Card> | ||
</Flex> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.