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 (