FormReg.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React, { useState } from "react";
  2. import "./LoginReg.css";
  3. export const FormReg = ({ FormReg }) => {
  4. const [login, setLogin] = useState("");
  5. const [password, setPassword] = useState("");
  6. const [passwordValid, setPasswordValid] = useState("");
  7. return (
  8. <div className="login">
  9. <h3>Registration</h3>
  10. <input
  11. className="u"
  12. type="login"
  13. placeholder="Username"
  14. value={login}
  15. onChange={(e) => setLogin(e.target.value)}
  16. />
  17. <input
  18. className="p"
  19. type="password"
  20. placeholder="Password"
  21. value={password}
  22. onChange={(e) => setPassword(e.target.value)}
  23. />
  24. <input
  25. className="p"
  26. type="password"
  27. placeholder="RepeatYourPassword"
  28. value={passwordValid}
  29. onChange={(e) => setPasswordValid(e.target.value)}
  30. />
  31. <button
  32. type="submit"
  33. className="btn btn-primary btn-block btn-large"
  34. disabled={!login || !password || password !== passwordValid}
  35. onClick={() => FormReg(login, password)}
  36. >
  37. Remember me.{" "}
  38. </button>
  39. <button className="main_page">
  40. <a href="/">Main page</a>
  41. </button>
  42. </div>
  43. );
  44. };