File tree Expand file tree Collapse file tree 5 files changed +46
-80
lines changed
Listings/Components/ListingsList Expand file tree Collapse file tree 5 files changed +46
-80
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,6 @@ interface Props {
49
49
}
50
50
51
51
export class SearchListingsQuery extends React . PureComponent < Props > {
52
- // public shouldComponentUpdate(nextProps: Props) {
53
- // const { address, guests, priceMin, priceMax } = this.props
54
- // if (this.props.address !== nextProps.address) {
55
- // return true
56
- // }
57
-
58
- // return false
59
- // }
60
-
61
52
public render ( ) {
62
53
const { address, guests, priceMin, priceMax } = this . props
63
54
Original file line number Diff line number Diff line change
1
+ import * as React from 'react'
2
+ import { Link } from 'react-router-dom'
3
+
4
+ import { GeoSuggest } from 'src/Components/GeoSuggest'
5
+ import { Input } from 'src/Components/Input'
6
+ import { Button } from 'src/Components/Button'
7
+ import { Label } from 'src/Components/Input/style'
8
+ import { Container , Wrapper , Title , Right } from './style'
9
+
10
+ interface Props {
11
+ updateState : ( newState : object ) => void
12
+ }
13
+
14
+ export const FormUI : React . SFC < Props > = ( { updateState } ) => (
15
+ < Container >
16
+ < Wrapper >
17
+ < Title > Book unique homes and experiences.</ Title >
18
+
19
+ < Label > Lokalizacja</ Label >
20
+
21
+ < GeoSuggest />
22
+
23
+ < Input
24
+ onChange = { ( value : string ) =>
25
+ updateState ( { guests : parseInt ( value , 10 ) } )
26
+ }
27
+ label = "Goscie"
28
+ placeholder = "1 gość"
29
+ type = "number"
30
+ />
31
+
32
+ < Right >
33
+ < Link to = "/listings" style = { { textDecoration : 'none' } } >
34
+ < Button > Szukaj</ Button >
35
+ </ Link >
36
+ </ Right >
37
+ </ Wrapper >
38
+ </ Container >
39
+ )
Original file line number Diff line number Diff line change 1
1
import * as React from 'react'
2
+ import { Subscribe } from 'unstated'
2
3
3
- import { Input } from 'src/Components/Input'
4
- import { Button } from 'src/Components/Button'
5
- import { Container , Wrapper , Title , Right } from './style'
4
+ import { Filter } from 'src/Containers/Filter'
5
+ import { FormUI } from './Form'
6
6
7
7
export const Form : React . SFC < { } > = ( ) => (
8
- < Container >
9
- < Wrapper >
10
- < Title > Book unique homes and experiences.</ Title >
11
-
12
- < Input label = "GDZIE?" placeholder = "Warszaw" onChange = { ( ) => null } />
13
-
14
- < Input
15
- onChange = { ( ) => null }
16
- label = "PRZYJAZD"
17
- placeholder = "dd-mm-rrrr"
18
- />
19
-
20
- < Input label = "GOSĆIE" placeholder = "1 gość" onChange = { ( ) => null } />
21
-
22
- < Right >
23
- < Button > Szukaj</ Button >
24
- </ Right >
25
- </ Wrapper >
26
- </ Container >
8
+ < Subscribe to = { [ Filter ] } >
9
+ { ( { updateState } : Filter ) => < FormUI updateState = { updateState } /> }
10
+ </ Subscribe >
27
11
)
Original file line number Diff line number Diff line change @@ -31,53 +31,6 @@ interface Props {
31
31
32
32
const getRoute = ( id : number ) => `/listing/${ id } `
33
33
34
- // export const ListingItem: React.SFC<Props> = ({
35
- // id,
36
- // name,
37
- // category,
38
- // description,
39
- // price,
40
- // beds,
41
- // guests,
42
- // lat,
43
- // lng,
44
- // amenities,
45
- // setPostion
46
- // }) => (
47
- // <Link to={getRoute(id)} style={{ textDecoration: 'none' }}>
48
- // <Container onMouseEnter={() => setPostion(lat, lng)}>
49
- // <Image src="https://a0.muscache.com/im/pictures/126e41c4-2a1b-4251-b516-d239351126f7.jpg?aki_policy=large" />
50
-
51
- // <Row>
52
- // <Details>
53
- // <Subtitle>CAŁY APARTAMENT</Subtitle>
54
- // <Title>{name}</Title>
55
-
56
- // <RoomsDetails>
57
- // <SmallText>{guests} goście •</SmallText>
58
- // <SmallText>1 sypialnia •</SmallText>
59
- // <SmallText>{beds} Łóżko •</SmallText>
60
- // <SmallText>1 Łazienka</SmallText>
61
- // </RoomsDetails>
62
-
63
- // <RoomsDetails>
64
- // {amenities.map((amenitie, i) => (
65
- // <SmallText key={i}>{amenitie} •</SmallText>
66
- // ))}
67
- // </RoomsDetails>
68
- // </Details>
69
-
70
- // <Pricing>
71
- // <Title>{price} zł</Title>
72
- // <VerySmallText>za dzien</VerySmallText>
73
-
74
- // <Stars />
75
- // </Pricing>
76
- // </Row>
77
- // </Container>
78
- // </Link>
79
- // )
80
-
81
34
export class ListingItem extends React . PureComponent < Props > {
82
35
public render ( ) {
83
36
const {
@@ -93,7 +46,6 @@ export class ListingItem extends React.PureComponent<Props> {
93
46
amenities,
94
47
setPostion
95
48
} = this . props
96
- console . log ( 'RERENDER LISTING ITEM' )
97
49
return (
98
50
< Link to = { getRoute ( id ) } style = { { textDecoration : 'none' } } >
99
51
< Container onMouseEnter = { ( ) => setPostion ( lat , lng ) } >
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import * as React from 'react'
2
2
import { Subscribe } from 'unstated'
3
3
4
4
import { SearchListingsQuery } from 'src/Graphql/SearchListings'
5
- import { ListingItem } from './Components/ListingItem'
6
5
import { Location } from 'src/Containers/Location'
7
6
import { Filter } from 'src/Containers/Filter'
7
+ import { ListingItem } from './Components/ListingItem'
8
8
9
9
import { Container } from './style'
10
10
You can’t perform that action at this time.
0 commit comments