added prettierrc.yaml and reformatted the code

This commit is contained in:
Karma Riuk 2022-10-20 09:04:44 +02:00
parent 308ae6ab88
commit f8be8ba9a3
5 changed files with 59 additions and 16 deletions

3
.prettierrc.yaml Normal file
View File

@ -0,0 +1,3 @@
trailingComma: "es5"
tabWidth: 4
arrowParens: "avoid"

View File

@ -1,11 +1,10 @@
import React from 'react' import React from 'react'
import Login from "@components/Login" import Login from "@components/Login"
import ForgotPassword from "@components/ForgotPassword" // import variables from "@scss/variables.module.scss"
import variables from "@scss/variables.module.scss"
import "@scss/style.scss" import "@scss/style.scss"
export default function App() { export default function App() {
return ( return (
<ForgotPassword /> <Login />
); );
} }

View File

@ -0,0 +1,20 @@
import * as React from "react";
import { useRouteError } from "react-router-dom";
import "@scss/error.scss"
export default function ErrorPage() {
const error: any = useRouteError();
console.error(error);
return (
<main id="root">
<div id="error-page">
<h1>Oops!</h1>
<p>Sorry, an unexpected error has occurred.</p>
<p>
<i>{error.statusText || error.message}</i>
</p>
</div>
</main>
);
}

View File

@ -1,6 +1,6 @@
import React, { useState, ChangeEvent, MouseEvent } from "react"; import React, { useState, ChangeEvent, MouseEvent } from "react";
import { Card, Button, TextField } from "@mui/material" import { Card, Button, TextField } from "@mui/material";
import "@scss/forgot_password.scss" import "@scss/forgot_password.scss";
export default function ForgotPassword() { export default function ForgotPassword() {
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
@ -12,20 +12,41 @@ export default function ForgotPassword() {
function buttonSubmit(e: MouseEvent<HTMLButtonElement>) { function buttonSubmit(e: MouseEvent<HTMLButtonElement>) {
e.preventDefault(); e.preventDefault();
console.log(`Sumbitting email "${email}" to which send a link.`) console.log(`Sumbitting email "${email}" to which send a link.`);
} }
return ( return (
<main id="root"> <main id="root">
<Card className="card"> <Card className="card">
<h3>Forgot Passowrd</h3> <h3>Forgot Passowrd</h3>
<p>If you have forgot your password, we can send you an email with a link to reset it.</p> <p>
<TextField id="email" label="Email" value={email} onChange={handleEmail} /> If you have forgot your password, we can send you an email
with a link to reset it.
</p>
<TextField
className="textfield"
id="email"
label="Email"
value={email}
onChange={handleEmail}
/>
<div className="buttons"> <div className="buttons">
<Button id="cancel" variant="outlined" onClick={buttonSubmit}>Cancel</Button> <Button
<Button id="submit" variant="contained" onClick={buttonSubmit}>Login</Button> id="cancel"
variant="outlined"
onClick={buttonSubmit}
>
Cancel
</Button>
<Button
id="submit"
variant="contained"
onClick={buttonSubmit}
>
Login
</Button>
</div> </div>
</Card> </Card>
</main> </main>
) );
} }

View File

@ -29,11 +29,11 @@ export default function Login() {
<main id="root"> <main id="root">
<Card className="card"> <Card className="card">
<h3>Login</h3> <h3>Login</h3>
<TextField id="email" label="Email" value={email} onChange={handleEmail} /> <TextField className="textfield" id="email" label="Email" value={email} onChange={handleEmail} />
<TextField id="password" label="Password" type="password" value={password} onChange={handlePassword}/> <TextField className="textfield" id="password" label="Password" type="password" value={password} onChange={handlePassword}/>
<Button id="submit" variant="contained" onClick={buttonSubmit}>Login</Button> <Button id="submit" variant="contained" onClick={buttonSubmit}>Login</Button>
<p>Forgot your <a href="/">password</a>?</p> <p>Forgot your <a href="/">password</a>?</p>
</Card> </Card>
</main> </main>
) )
} }