aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-10-16 10:41:35 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-10-16 10:41:35 -0500
commita08880499dd3c7dd3dd6fd07ce6ae94cae09cd53 (patch)
tree1804f8dc92ecec1d199c60111c19e73b1917102b
parentf6aa24eb0d83f0f04e0da7cc4ffed1984fa6d794 (diff)
downloadslskd-a08880499dd3c7dd3dd6fd07ce6ae94cae09cd53.tar.gz
remove initializing, fix spacing
-rw-r--r--src/web/src/components/LoginForm.js140
1 files changed, 70 insertions, 70 deletions
diff --git a/src/web/src/components/LoginForm.js b/src/web/src/components/LoginForm.js
index 6d2fc72a..82af0195 100644
--- a/src/web/src/components/LoginForm.js
+++ b/src/web/src/components/LoginForm.js
@@ -2,82 +2,82 @@ import React, { Component } from 'react'
import { Button, Form, Grid, Header, Icon, Segment, Checkbox, Message } from 'semantic-ui-react'
const initialState = {
- username: '',
- password: '',
- rememberMe: true,
- ready: false,
+ username: '',
+ password: '',
+ rememberMe: true,
+ ready: false,
}
class LoginForm extends Component {
- state = initialState;
+ state = initialState;
- handleChange = (field, value) => {
- this.setState({
- [field]: value,
- }, () => {
- if (this.state.username !== '' && this.state.password !== '') {
- this.setState({ ready: true })
- } else {
- this.setState({ ready: false })
- }
- });
- }
+ handleChange = (field, value) => {
+ this.setState({
+ [field]: value,
+ }, () => {
+ if (this.state.username !== '' && this.state.password !== '') {
+ this.setState({ ready: true })
+ } else {
+ this.setState({ ready: false })
+ }
+ });
+ }
- render = () => {
- const { initialized, onLoginAttempt, loading, error } = this.props;
- const { username, password, rememberMe, ready } = this.state;
+ render = () => {
+ const { onLoginAttempt, loading, error } = this.props;
+ const { username, password, rememberMe, ready } = this.state;
- return (
- <>
- {initialized && <Grid textAlign='center' style={{ height: '100vh' }} verticalAlign='middle'>
- <Grid.Column style={{ maxWidth: 372 }}>
- <Header as='h2' textAlign='center'>
- slsk<strong>d</strong>
- </Header>
- <Form size='large'>
- <Segment loading={loading}>
- <Form.Input
- fluid icon='user'
- iconPosition='left'
- placeholder='Username'
- onChange={(event) => this.handleChange('username', event.target.value)}
- />
- <Form.Input
- fluid
- icon='lock'
- iconPosition='left'
- placeholder='Password'
- type='password'
- onChange={(event) => this.handleChange('password', event.target.value)}
- />
- <Checkbox
- label='Remember Me'
- onChange={() => this.handleChange('rememberMe', !rememberMe)}
- checked={rememberMe}
- />
- </Segment>
- <Button
- primary
- fluid
- size='large'
- className='login-button'
- loading={loading}
- disabled={!ready || loading}
- onClick={() => onLoginAttempt(username, password, rememberMe)}
- >
- <Icon name='sign in'/>
- Login
- </Button>
- {error && <Message className='login-failure' negative floating>
- <Icon name='x' />
- {error.message}
- </Message>}
- </Form>
- </Grid.Column>
- </Grid>}
- </>
- )
- }
+ return (
+ <>
+ <Grid textAlign='center' style={{ height: '100vh' }} verticalAlign='middle'>
+ <Grid.Column style={{ maxWidth: 372 }}>
+ <Header as='h2' textAlign='center'>
+ slsk<strong>d</strong>
+ </Header>
+ <Form size='large'>
+ <Segment loading={loading}>
+ <Form.Input
+ fluid icon='user'
+ iconPosition='left'
+ placeholder='Username'
+ onChange={(event) => this.handleChange('username', event.target.value)}
+ />
+ <Form.Input
+ fluid
+ icon='lock'
+ iconPosition='left'
+ placeholder='Password'
+ type='password'
+ onChange={(event) => this.handleChange('password', event.target.value)}
+ />
+ <Checkbox
+ label='Remember Me'
+ onChange={() => this.handleChange('rememberMe', !rememberMe)}
+ checked={rememberMe}
+ />
+ </Segment>
+ <Button
+ primary
+ fluid
+ size='large'
+ className='login-button'
+ loading={loading}
+ disabled={!ready || loading}
+ onClick={() => onLoginAttempt(username, password, rememberMe)}
+ >
+ <Icon name='sign in'/>
+ Login
+ </Button>
+ {error && <Message className='login-failure' negative floating>
+ <Icon name='x' />
+ {error.message}
+ </Message>}
+ </Form>
+ </Grid.Column>
+ </Grid>
+ </>
+ )
+ }
}
export default LoginForm \ No newline at end of file