diff --git a/web/dist/main.css b/web/dist/main.css
index 7542126..150b290 100644
--- a/web/dist/main.css
+++ b/web/dist/main.css
@@ -467,8 +467,26 @@ html {
}
.filters-btn-toggle {
- margin-top: 90px;
+ margin-top: 70px;
+ margin-right: 10px;
display: block;
+ min-width: 35px;
+ padding: 5px 10px;
+ border: 1px solid #d8d8d8;
+ background: hsla(0,0%,100%,.9);
+ color: #878698;
+ border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ }
+
+ .filters-btn-toggle button {
+ font-size: 1.2em;
+ -webkit-appearance: none;
+ -webkit-border-radius: 0;
+ border: 0;
+ background: #fff;
+
}
.filters-close-button {
@@ -542,6 +560,7 @@ html {
.filters {
border: none;
padding: 0 15px;
+ height: 100%;
}
.filters-close {
@@ -560,6 +579,18 @@ html {
.value-between-box {
justify-content: space-around;
}
+
+ .map-list-view {
+ width: 100%;
+ border: 1px solid red;
+ overflow-y: auto;
+ height: 100%;
+ padding-top: 60px;
+ }
+
+ .right-content .listings {
+ display: none;
+ }
}
/*
@@ -783,7 +814,8 @@ html {
@media (max-width: 768px) {
- .ld-image-container {
+ .ld-image-container,
+ .ld-image-container img {
width: 100%;
height: 100%;
}
diff --git a/web/src/components/ListingDetails.js b/web/src/components/ListingDetails.js
index c4922b4..ff7d7b0 100644
--- a/web/src/components/ListingDetails.js
+++ b/web/src/components/ListingDetails.js
@@ -57,12 +57,6 @@ export default class ListingDetails extends React.Component {
-
diff --git a/web/src/components/Listings.js b/web/src/components/Listings.js
index 8d2a339..798c071 100644
--- a/web/src/components/Listings.js
+++ b/web/src/components/Listings.js
@@ -7,7 +7,14 @@ export default class Listings extends React.Component {
constructor (props) {
super(props)
+ this.handleTouchMove = e => {
+ const node = e.target
+ const offset = node.scrollHeight - node.scrollTop - node.clientHeight
+ console.log('HANDLE TOUCH MOVE OFFSET', offset)
+ }
+
this.handleScroll = e => {
+ console.log('scrolling');
const node = e.target
const offset = node.scrollHeight - node.scrollTop - node.clientHeight
@@ -123,11 +130,13 @@ export default class Listings extends React.Component {
attachScrollListener () {
const listings = findDOMNode(this.refs.listings)
listings.parentNode.addEventListener('scroll', this.handleScroll)
+ listings.parentNode.addEventListener('touchmove', this.handleTouchMove)
}
removeScrollListener () {
const listings = findDOMNode(this.refs.listings)
listings.parentNode.removeEventListener('scroll', this.handleScroll)
+ listings.parentNode.removeEventListener('touchmove', this.handleTouchMove)
}
onSortChange (e) {
diff --git a/web/src/components/Main.js b/web/src/components/Main.js
index 55b9217..2c6b13c 100644
--- a/web/src/components/Main.js
+++ b/web/src/components/Main.js
@@ -21,6 +21,7 @@ class Main extends React.Component {
rooms: {},
category: {}
},
+ mobileView: 'MAP',
contact: {
message: '',
name: '',
@@ -79,9 +80,10 @@ class Main extends React.Component {
var control = document.createElement('div')
control.classList.add('filters-btn-toggle')
- control.innerHTML = '
'
+ control.innerHTML = '
'
//control.style = "top: 200px;"
- control['style'] = 'top: 200px;'
+ // TODO: enable this
+ //control['style'] = 'top: 200px;'
var input = document.getElementById('gmaps-places-input')
@@ -540,6 +542,7 @@ class Main extends React.Component {
onClose={this.onCloseClick.bind(this)}
/>
)
+
children.push(
-
+ {this.state.mobileView === 'LIST' && !this.state.listingDetails &&
+
+
+
}
+
)
diff --git a/web/src/lib/handlers.js b/web/src/lib/handlers.js
index 86133e6..18ac7f5 100644
--- a/web/src/lib/handlers.js
+++ b/web/src/lib/handlers.js
@@ -49,8 +49,16 @@ const setMaxSize = ({type, action}, component) => {
})
}
+const getScrollElem = (component) => {
+ const {mobileView} = component.state
+ const scrollElem = mobileView === 'LIST' ?
+ document.querySelector('.map-list-view') : document.querySelector('.right-content')
+
+ return scrollElem
+}
+
const viewListingDetails = ({type, action}, component) => {
- const scrollElem = document.querySelector('.right-content')
+ const scrollElem = getScrollElem(component)
component.savedScrollTop = scrollElem.scrollTop
component.setState(
@@ -224,7 +232,8 @@ const backToResults = ({type, action}, component) => {
prevSelected.marker.setIcon(component.visitedMarkerIcon())
}
- const scrollElem = document.querySelector('.right-content')
+ //const scrollElem = document.querySelector('.right-content')
+ const scrollElem = getScrollElem(component)
scrollElem.scrollTop = component.savedScrollTop
}
)
@@ -251,7 +260,8 @@ const mapIdle = ({type, action}, component) => {
page: 0
},
() => {
- const scrollElem = document.querySelector('.right-content')
+ const scrollElem = getScrollElem(component)
+ //const scrollElem = document.querySelector('.right-content')
scrollElem.scrollTop = 0
component.refreshListings()
}
@@ -345,6 +355,23 @@ const submitContactEnd = ({type, action}, component) => {
})
}
+const mobileMapView = ({type, action}, component) => {
+
+ component.setState({
+ mobileView: 'MAP'
+ }, () => {
+ backToResults({type, action}, component)
+ })
+}
+
+const mobileListView = ({type, action}, component) => {
+ component.setState({
+ mobileView: 'LIST'
+ }, () => {
+ backToResults({type, action}, component)
+ })
+}
+
const handlers = {
SET_MIN_PRICE: setMinPrice,
SET_MAX_PRICE: setMaxPrice,
@@ -372,7 +399,9 @@ const handlers = {
UPDATE_CONTACT_INFO: updateContactInfo,
SUBMIT_CONTACT_START: submitContactStart,
SUBMIT_CONTACT_END: submitContactEnd,
- INVALID_CONTACT: invalidContact
+ INVALID_CONTACT: invalidContact,
+ MOBILE_MAP_VIEW: mobileMapView,
+ MOBILE_LIST_VIEW: mobileListView
}
export const handleMessage = ({type, action}, component) => {