From 08bb517ef11d48673e7ec57727276a2838d76cd4 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 24 Oct 2018 23:20:52 +0100 Subject: [PATCH] Login form: upgrade material-ui. --- src/components/LoginForm.tsx | 95 +++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/src/components/LoginForm.tsx b/src/components/LoginForm.tsx index ce6d5a6..417bb93 100644 --- a/src/components/LoginForm.tsx +++ b/src/components/LoginForm.tsx @@ -1,7 +1,9 @@ import * as React from 'react'; -import RaisedButton from 'material-ui/RaisedButton'; -import TextField from 'material-ui/TextField'; -import Toggle from 'material-ui/Toggle'; +import Button from '@material-ui/core/Button'; +import TextField from '@material-ui/core/TextField'; +import FormGroup from '@material-ui/core/FormGroup'; +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import Switch from '@material-ui/core/Switch'; import ExternalLink from '../widgets/ExternalLink'; @@ -18,7 +20,7 @@ interface FormErrors { class LoginForm extends React.PureComponent { state: { - showAdvanced?: boolean; + showAdvanced: boolean; errors: FormErrors; server: string; @@ -36,6 +38,7 @@ class LoginForm extends React.PureComponent { constructor(props: any) { super(props); this.state = { + showAdvanced: false, errors: {}, server: '', username: '', @@ -96,23 +99,6 @@ class LoginForm extends React.PureComponent { } render() { - let advancedSettings = null; - if (this.state.showAdvanced) { - advancedSettings = ( - - -
-
- ); - } - const styles = { form: { }, @@ -120,7 +106,7 @@ class LoginForm extends React.PureComponent { color: getPalette('accent1Color'), paddingTop: 20, }, - advancedSettings: { + textField: { marginTop: 20, }, submit: { @@ -129,22 +115,45 @@ class LoginForm extends React.PureComponent { }, }; + let advancedSettings = null; + if (this.state.showAdvanced) { + advancedSettings = ( + + +
+
+ ); + } + return ( {(this.props.error) && (
Error! {this.props.error.message}
)}
- + + + } + label="Advanced settings" + /> + {advancedSettings}
- + > + {this.props.loading ? 'Loading…' : 'Log In'} +