Guest User

Untitled

a guest
Jan 21st, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. import React from 'react';
  2. import styled from 'styled-components';
  3. import compose from 'recompose/compose';
  4. import withState from 'recompose/withState';
  5. import withHandlers from 'recompose/withHandlers';
  6. import withProps from 'recompose/withProps';
  7.  
  8. import Header from 'components/registration/Header/Header';
  9. import SearchForm from 'components/registration/SearchForm/SearchForm';
  10. import Map from 'components/registration/Map/Map';
  11. import NotFound from 'components/registration/NotFound/NotFound';
  12. import SelectedSuggestionForm from 'components/registration/SelectedSuggestionForm/SelectedSuggestionForm';
  13.  
  14. const Container = styled.div`
  15. position: absolute;
  16. top: 0;
  17. left: 0;
  18. height: 100%;
  19. width: 100%;
  20. padding-bottom: 20px;
  21. `;
  22.  
  23. const Registration = (props) => {
  24. const {
  25. onRegister, onSuggestionSelect, suggestion, notFound, setSuggestion, setNotFound, selectedPotentialUser,
  26. selectPotentialUser,
  27. } = props;
  28. return (
  29. <Container>
  30. <Header pageTitle="Найти свой дом"/>
  31. <SearchForm
  32. onSuggestionSelect={onSuggestionSelect}
  33. onNotFound={() => {
  34. setNotFound(true);
  35. setSuggestion(null);
  36. selectPotentialUser(null);
  37. }}
  38. onReset={() => {
  39. setNotFound(false);
  40. setSuggestion(null);
  41. selectPotentialUser(null);
  42. }}
  43. />
  44. {notFound && <NotFound onRegister={onRegister} />}
  45. {suggestion &&
  46. <SelectedSuggestionForm
  47. suggestion={suggestion}
  48. selectedPotentialUser={selectedPotentialUser}
  49. onSelect={selectPotentialUser}
  50. onRegister={onRegister}
  51. onJoin={() => console.log('join')}
  52. />}
  53. <Map />
  54. </Container>
  55. )
  56. };
  57.  
  58. export default compose(
  59. withState('suggestion', 'setSuggestion', null),
  60. withState('selectedPotentialUser', 'selectPotentialUser', null),
  61. withState('notFound', 'setNotFound', false),
  62. withState('isRegister', 'setIsRegister', false),
  63. withHandlers({ onSuggestionSelect, onRegister }),
  64. )(Registration);
Add Comment
Please, Sign In to add comment