From 4fdefd6752854c0c5fcfe848f8770aa444fd2750 Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Thu, 21 Oct 2021 13:28:33 +0200 Subject: Move Login to material-ui --- src/components/Login.js | 55 ++++++++++++++++++++++++++++--------------------- src/styles/main.css | 2 ++ 2 files changed, 34 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/components/Login.js b/src/components/Login.js index 7684703..209871e 100644 --- a/src/components/Login.js +++ b/src/components/Login.js @@ -1,6 +1,9 @@ import React from "react"; import PropTypes from "prop-types"; -import { Button, Input } from "semantic-ui-react"; + +import Button from "@mui/material/Button"; +import Paper from "@mui/material/Paper"; +import TextField from "@mui/material/TextField"; class Login extends React.Component { static propTypes = { @@ -17,7 +20,6 @@ class Login extends React.Component { error: false }; - this.handleInput = this.handleInput.bind(this); this.login = this.login.bind(this); this.logout = this.logout.bind(this); } @@ -52,44 +54,51 @@ class Login extends React.Component { localStorage.removeItem("token"); } - handleInput(e) { - this.setState({ - [e.target.name]: e.target.value - }); - } - render() { return (
-
{ - e.preventDefault(); - this.login(this.state.email, this.state.password); - }} - > -

- + { + this.setState({ + email: event.target.value + }); + }} /> - { + this.setState({ + password: event.target.value + }); + }} required + sx={{ + marginTop: "1em" + }} /> - {this.state.error && (

Wrong username or password

)} - +
); } diff --git a/src/styles/main.css b/src/styles/main.css index 3d7ecc9..d0c0c18 100644 --- a/src/styles/main.css +++ b/src/styles/main.css @@ -106,6 +106,7 @@ body { /* Login */ #login-container { + width: 100%; display: flex; justify-content: center; } @@ -116,6 +117,7 @@ body { flex-direction: column; justify-content: center; text-align: center; + padding: 2em; } #login > h1 { -- cgit v1.1