From e9c631e78a7a2d0f258118ddccc6be1ae854a6a3 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 11 May 2021 18:40:09 +0200 Subject: [PATCH] Update login form --- src/ui/routes/LoginRoute.tsx | 41 +++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/ui/routes/LoginRoute.tsx b/src/ui/routes/LoginRoute.tsx index 62d674d..731818b 100644 --- a/src/ui/routes/LoginRoute.tsx +++ b/src/ui/routes/LoginRoute.tsx @@ -21,6 +21,7 @@ import { import LockOutlinedIcon from "@material-ui/icons/LockOutlined"; import React from "react"; +import { matAlert } from "../widgets/DialogsProvider"; function Copyright() { return ( @@ -33,7 +34,38 @@ function Copyright() { ); } -export class LoginRoute extends React.Component { +interface LoginRouteState { + currEmail: string; +} + +export class LoginRoute extends React.Component<{}, LoginRouteState> { + constructor(props: any) { + super(props); + + this.state = { + currEmail: "", + }; + + this.handleChangedEmail = this.handleChangedEmail.bind(this); + this.handleSubmitEmail = this.handleSubmitEmail.bind(this); + } + + get canSubmit(): boolean { + return this.state.currEmail.length > 4; + } + + handleChangedEmail(e: React.ChangeEvent) { + this.setState({ currEmail: e.target.value }); + } + + handleSubmitEmail(e: React.ChangeEvent) { + e.preventDefault(); + + if (!this.canSubmit) return; + + matAlert("good"); + } + render() { return (