not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB

  1. import React, { Component } from 'react';
  2. import ActiveButton from './activeButton';
  3. export default class NicknameInput extends Component {
  4. constructor(props){
  5. super(props);
  6. this.state = {fieldValue: ''};
  7. this.onInputChange = this.onInputChange.bind(this);
  8. this.sendNickname = this.sendNickname.bind(this);
  9. }
  10. onInputChange(event) {
  11. this.setState({ fieldValue: event.target.value });
  12. }
  13. sendNickname(event){
  14. event.preventDefault();
  15. this.props.socket.emit('register', this.state.fieldValue);
  16. console.log("Sent Registration.")
  17. this.setState({fieldValue: ''})
  18. }
  19. render() {
  20. return(
  21. <div className="container-fluid game">
  22. <div className="row">
  23. <div className="col-xs-12 col-sm-7">
  24. <a className="logo">
  25. <div>WHAT</div>
  26. <div>THE </div>
  27. <div>TREND?!</div>
  28. </a>
  29. <div className="game__main">
  30. <form onSubmit={this.sendNickname}>
  31. <input className="login__input" maxLength="30" placeholder="Nickname" onChange = {this.onInputChange} value={this.state.fieldValue} />
  32. <span>
  33. <ActiveButton input = {this.state.fieldValue} type='register' />
  34. </span>
  35. </form>
  36. </div>
  37. </div>
  38. <div className="col-xs-12 col-sm-5 game__sidebar">
  39. <canvas className="scene scene--full" id="scene" ></canvas>
  40. </div>
  41. </div>
  42. </div>
  43. )
  44. }
  45. }