Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. Index: src/components/Register.js
  2. IDEA additional info:
  3. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  4. <+>UTF-8
  5. ===================================================================
  6. --- src/components/Register.js (revision 690e9584d1752ee218dbb863a68013546550e7e0)
  7. +++ src/components/Register.js (date 1539612168253)
  8. @@ -36,6 +36,31 @@
  9. });
  10.  
  11. class Register extends React.Component {
  12. + state = {
  13. + emailAddress: '',
  14. + password: '',
  15. + replicatedPassword: '',
  16. + firstName: '',
  17. + lastName: ''
  18. + };
  19. +
  20. + constructor(props) {
  21. + super(props);
  22. +
  23. + this.updateState = this.updateState.bind(this);
  24. + this.onSubmit = this.onSubmit.bind(this);
  25. + }
  26. +
  27. + updateState(event) {
  28. + this.setState({
  29. + [ event.target.name ]: event.target.value
  30. + });
  31. + };
  32. +
  33. + onSubmit(event) {
  34. + event.preventDefault();
  35. + };
  36. +
  37. render() {
  38. return (
  39. <React.Fragment>
  40. @@ -49,25 +74,48 @@
  41. <form className={this.props.classes.form}>
  42. <FormControl fullWidth margin="normal" required>
  43. <InputLabel htmlFor="emailAddress">Email Address</InputLabel>
  44. - <Input id="emailAddress" name="emailAddress" />
  45. + <Input
  46. + id="emailAddress"
  47. + name="emailAddress"
  48. + onChange={this.updateState} />
  49. </FormControl>
  50. <FormControl fullWidth margin="normal" required>
  51. <InputLabel htmlFor="password">Password</InputLabel>
  52. - <Input id="password" name="password" type="password" />
  53. + <Input
  54. + id="password"
  55. + name="password"
  56. + type="password"
  57. + onChange={this.updateState} />
  58. </FormControl>
  59. <FormControl fullWidth margin="normal" required>
  60. <InputLabel htmlFor="replicatedPassword">Confirm password</InputLabel>
  61. - <Input id="replicatedPassword" name="replicatedPassword" type="password" />
  62. + <Input
  63. + id="replicatedPassword"
  64. + name="replicatedPassword"
  65. + type="password"
  66. + onChange={this.updateState} />
  67. </FormControl>
  68. <FormControl fullWidth margin="normal">
  69. <InputLabel htmlFor="firstName">First name</InputLabel>
  70. - <Input id="firstName" name="firstName" />
  71. + <Input
  72. + id="firstName"
  73. + name="firstName"
  74. + onChange={this.updateState} />
  75. </FormControl>
  76. <FormControl fullWidth margin="normal">
  77. <InputLabel htmlFor="lastName">Last name</InputLabel>
  78. - <Input id="lastName" name="lastName" />
  79. + <Input
  80. + id="lastName"
  81. + name="lastName"
  82. + onChange={this.updateState} />
  83. </FormControl>
  84. - <Button fullWidth color="primary" variant="contained" type="submit" className={this.props.classes.signUp}>Sign Up</Button>
  85. + <Button
  86. + fullWidth
  87. + color="primary"
  88. + variant="contained"
  89. + type="submit"
  90. + onClick={this.onSubmit}
  91. + className={this.props.classes.signUp}>Sign Up</Button>
  92. </form>
  93. </Paper>
  94. </main>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement