Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import { Button, Checkbox, Header, Form, Grid } from 'semantic-ui-react';
  3.  
  4. const styles = {
  5.     root: {
  6.         marginTop: '5%'
  7.     }
  8. };
  9. class Register extends Component {
  10. constructor() {
  11.     super();
  12.     this.state = {
  13.         firstname: '',
  14.         lastname: '',
  15.         email: '',
  16.         password: '',
  17.         confirmPassword: '',
  18.         acceptedTerms: false
  19.     };
  20. }
  21.     onChange = (e) => {
  22.         let state = this.state;
  23.         state[e.target.name] = e.target.value;
  24.  
  25.         this.setState(state);
  26.     };
  27.  
  28.     onRegisterFormSubmit = (e) => {
  29.         e.preventDefault();
  30.         console.log(this.state);
  31.     };
  32.  
  33.     render() {
  34.         return(
  35.             <Grid style={styles.root} centered>
  36.                 <Grid.Column width={4}>
  37.                     <Header textAlign={'center'} as='h1'>Zalóż konto juz dzisiaj</Header>
  38.                     <Form onSubmit={this.onRegisterFormSubmit}>
  39.                         <Form.Field>
  40.                             <label htmlFor="name">Imię</label>
  41.                             <input type="text"
  42.                                    onChange={this.onChange}
  43.                                    placeholder="Podaj swoje imię"
  44.                             />
  45.                         </Form.Field>
  46.                         <Form.Field>
  47.                             <label htmlFor="surname">Nazwisko</label>
  48.                             <input type="text"
  49.                                    onChange={this.onChange}
  50.                                    placeholder="Podaj swoje nazwisko"
  51.                         />
  52.                         </Form.Field>
  53.                         <Form.Field>
  54.                             <label htmlFor="email">Email</label>
  55.                             <input name="email"
  56.                                    type="email"
  57.                                    onChange={this.onChange}
  58.                                    placeholder="Wpisz tu Email"
  59.                             />
  60.                         </Form.Field>
  61.                         <Form.Field>
  62.                             <label htmlFor="password">Hasło</label>
  63.                             <input name="password" type="password" placeholder="Wpisz tu hasło"/>
  64.                         </Form.Field>
  65.                         <Form.Field>
  66.                             <label htmlFor="confirmPassword">Powtórz hasło</label>
  67.                             <input name="confirmPassword" type="password" placeholder="Wpisz hasło ponownie" />
  68.                         </Form.Field>
  69.                         <Form.Field>
  70.                             <Checkbox label="Akceptuję warunki użytkowania serwisu"
  71.                                       onChange={() => this.state.acceptedTerms = !this.state.acceptedTerms}
  72.                             />
  73.                         </Form.Field>
  74.                         <Button basic type="submit">Zarejestruj się</Button>
  75.                     </Form>
  76.                 </Grid.Column>
  77.             </Grid>
  78.         )
  79.     }
  80. }
  81. export default Register;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement