From e0c3b5c0c32256bf68a82e92b87f2323dcccfac7 Mon Sep 17 00:00:00 2001 From: Arnaud Fauconnet Date: Sat, 15 Oct 2022 10:40:52 +0200 Subject: [PATCH] Refactored styles and started working on the app pages --- src/components/App.tsx | 23 +++---------------- src/components/ForgotPassword.tsx | 31 ++++++++++++++++++++++++++ src/components/Login.tsx | 37 +++++++++++++++++++++++++++---- src/scss/cards.scss | 17 ++++++++++++++ src/scss/forgot_password.scss | 15 +++++++++++++ src/scss/login.scss | 3 +++ src/scss/style.scss | 35 ++++++----------------------- src/scss/variables.module.scss | 11 +++------ 8 files changed, 112 insertions(+), 60 deletions(-) create mode 100644 src/components/ForgotPassword.tsx create mode 100644 src/scss/cards.scss create mode 100644 src/scss/forgot_password.scss create mode 100644 src/scss/login.scss diff --git a/src/components/App.tsx b/src/components/App.tsx index b8df7cc..d599834 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,28 +1,11 @@ import React from 'react' -import { Button, Box } from "@mui/material" +import Login from "@components/Login" +import ForgotPassword from "@components/ForgotPassword" import variables from "@scss/variables.module.scss" import "@scss/style.scss" export default function App() { - let boxStyle = { - width: "50%", - height: "50%", - border: '1px dashed grey', - backgroundColor: variables.boxBg, - display: "flex", - alignItems: "center", - justifyContent: "center" - } - return ( -
-

React with Webpack

- -
- - This box should be centered
(and also this this text) -
-
-
+ ); } \ No newline at end of file diff --git a/src/components/ForgotPassword.tsx b/src/components/ForgotPassword.tsx new file mode 100644 index 0000000..b613ed4 --- /dev/null +++ b/src/components/ForgotPassword.tsx @@ -0,0 +1,31 @@ +import React, { useState, ChangeEvent, MouseEvent } from "react"; +import { Card, Button, TextField } from "@mui/material" +import "@scss/forgot_password.scss" + +export default function ForgotPassword() { + const [email, setEmail] = useState(""); + + function handleEmail(e: ChangeEvent) { + setEmail(e.target.value); + console.log(email); + } + + function buttonSubmit(e: MouseEvent) { + e.preventDefault(); + console.log(`Sumbitting email "${email}" to which send a link.`) + } + + return ( +
+ +

Forgot Passowrd

+

If you have forgot your password, we can send you an email with a link to reset it.

+ +
+ + +
+
+
+ ) +} \ No newline at end of file diff --git a/src/components/Login.tsx b/src/components/Login.tsx index cd8500a..bb1ec8c 100644 --- a/src/components/Login.tsx +++ b/src/components/Login.tsx @@ -1,10 +1,39 @@ -import React from "react"; -import { Card } from "@mui/material" +import React, { useState, ChangeEvent, MouseEvent } from "react"; +import { Card, Button, TextField } from "@mui/material" +import "@scss/login.scss" + +export default function Login() { + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + + function hash(s: string){ + return s; + } + + function handleEmail(e: ChangeEvent){ + setEmail(e.target.value); + console.log(email); + } + + function handlePassword(e: ChangeEvent){ + setPassword(e.target.value); + console.log(hash(password)); + } + + function buttonSubmit(e: MouseEvent){ + e.preventDefault(); + console.log(`Sumbitting username "${email}" and password "${hash(password)}"`) + } -export default function Login(){ return (
- + +

Login

+ + + +

Forgot your password?

+
) } \ No newline at end of file diff --git a/src/scss/cards.scss b/src/scss/cards.scss new file mode 100644 index 0000000..126d9ea --- /dev/null +++ b/src/scss/cards.scss @@ -0,0 +1,17 @@ +main { + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + + .card { + width: 20vw; + height: 50vh; + padding: 3em; + + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-around; + } +} \ No newline at end of file diff --git a/src/scss/forgot_password.scss b/src/scss/forgot_password.scss new file mode 100644 index 0000000..218f677 --- /dev/null +++ b/src/scss/forgot_password.scss @@ -0,0 +1,15 @@ +@use "style.scss"; +@use "cards.scss"; + + +main { + .email { + width: 100%; + } + .buttons { + width: 100%; + display: flex; + justify-content: space-between; + // align-items: center; + } +} \ No newline at end of file diff --git a/src/scss/login.scss b/src/scss/login.scss new file mode 100644 index 0000000..858d105 --- /dev/null +++ b/src/scss/login.scss @@ -0,0 +1,3 @@ +@use "@scss/style.scss"; +@use "@scss/cards.scss"; + diff --git a/src/scss/style.scss b/src/scss/style.scss index c0c54df..3fb0be3 100644 --- a/src/scss/style.scss +++ b/src/scss/style.scss @@ -1,33 +1,12 @@ @import "variables.module.scss"; -body { - background: #333; - color: #c5c8c6; + +*, body { + padding: 0; + margin: 0; } -main { - h1 { - color: $title-color; - text-align: center; - } - - - #container { - display: flex; - background-color: $container-background; - width: 100vw; - height: 50vh; - align-items: center; - justify-content: center; - - #box { - width: 50%; - height: 50%; - background-color: $box-background; - display: flex; - text-align: center; - align-items: center; - justify-content: center; - } - } +body { + background: $bg1; + color: $fg1; } \ No newline at end of file diff --git a/src/scss/variables.module.scss b/src/scss/variables.module.scss index 1a9dc5f..bd6c5b0 100644 --- a/src/scss/variables.module.scss +++ b/src/scss/variables.module.scss @@ -1,9 +1,4 @@ -$box-background: blue; -$container-background: lime; -$title-color: cyan; +$bg1: #333; +$fg1: #c5c8c6; -:export { - boxBg: $box-background; - containerBg: $container-background; - titleCol: $title-color; -} \ No newline at end of file +// :export {} \ No newline at end of file