old_ConnectionForm.jsx 756B

123456789101112131415161718192021222324252627282930
  1. import React from 'react'
  2. import PropTypes from 'prop-types'
  3. export const ConnectionForm = props => {
  4. return (
  5. <div>
  6. { props.user.isLoggedIn
  7. ? 'You are already logged in.'
  8. : (
  9. <div>
  10. Login:
  11. <input type='text' onChange={props.onChangeLogin} placeholder='Login' />
  12. <input type='text' onChange={props.onChangePassword} placeholder='Password' />
  13. <button type='button' onClick={props.onClickSubmit}>Connect</button>
  14. </div>
  15. )
  16. }
  17. </div>
  18. )
  19. }
  20. ConnectionForm.PropTypes = {
  21. user: PropTypes.shape({
  22. isLoggedIn: PropTypes.bool.isRequired
  23. }),
  24. onChangeLogin: PropTypes.func,
  25. onChangePassword: PropTypes.func,
  26. onClickSubmit: PropTypes.func
  27. }