Mobile adjustments
This commit is contained in:
36
web/dist/main.css
vendored
36
web/dist/main.css
vendored
@@ -467,8 +467,26 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.filters-btn-toggle {
|
.filters-btn-toggle {
|
||||||
margin-top: 90px;
|
margin-top: 70px;
|
||||||
|
margin-right: 10px;
|
||||||
display: block;
|
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 {
|
.filters-close-button {
|
||||||
@@ -542,6 +560,7 @@ html {
|
|||||||
.filters {
|
.filters {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filters-close {
|
.filters-close {
|
||||||
@@ -560,6 +579,18 @@ html {
|
|||||||
.value-between-box {
|
.value-between-box {
|
||||||
justify-content: space-around;
|
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) {
|
@media (max-width: 768px) {
|
||||||
.ld-image-container {
|
.ld-image-container,
|
||||||
|
.ld-image-container img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ export default class ListingDetails extends React.Component {
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button className="hide-listing">
|
|
||||||
<i className="fa fa-thumbs-o-down" aria-hidden="true" />
|
|
||||||
<span>
|
|
||||||
Sakrij
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="ld-details">
|
<div className="ld-details">
|
||||||
|
|||||||
@@ -7,7 +7,14 @@ export default class Listings extends React.Component {
|
|||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(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 => {
|
this.handleScroll = e => {
|
||||||
|
console.log('scrolling');
|
||||||
const node = e.target
|
const node = e.target
|
||||||
const offset = node.scrollHeight - node.scrollTop - node.clientHeight
|
const offset = node.scrollHeight - node.scrollTop - node.clientHeight
|
||||||
|
|
||||||
@@ -123,11 +130,13 @@ export default class Listings extends React.Component {
|
|||||||
attachScrollListener () {
|
attachScrollListener () {
|
||||||
const listings = findDOMNode(this.refs.listings)
|
const listings = findDOMNode(this.refs.listings)
|
||||||
listings.parentNode.addEventListener('scroll', this.handleScroll)
|
listings.parentNode.addEventListener('scroll', this.handleScroll)
|
||||||
|
listings.parentNode.addEventListener('touchmove', this.handleTouchMove)
|
||||||
}
|
}
|
||||||
|
|
||||||
removeScrollListener () {
|
removeScrollListener () {
|
||||||
const listings = findDOMNode(this.refs.listings)
|
const listings = findDOMNode(this.refs.listings)
|
||||||
listings.parentNode.removeEventListener('scroll', this.handleScroll)
|
listings.parentNode.removeEventListener('scroll', this.handleScroll)
|
||||||
|
listings.parentNode.removeEventListener('touchmove', this.handleTouchMove)
|
||||||
}
|
}
|
||||||
|
|
||||||
onSortChange (e) {
|
onSortChange (e) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class Main extends React.Component {
|
|||||||
rooms: {},
|
rooms: {},
|
||||||
category: {}
|
category: {}
|
||||||
},
|
},
|
||||||
|
mobileView: 'MAP',
|
||||||
contact: {
|
contact: {
|
||||||
message: '',
|
message: '',
|
||||||
name: '',
|
name: '',
|
||||||
@@ -79,9 +80,10 @@ class Main extends React.Component {
|
|||||||
|
|
||||||
var control = document.createElement('div')
|
var control = document.createElement('div')
|
||||||
control.classList.add('filters-btn-toggle')
|
control.classList.add('filters-btn-toggle')
|
||||||
control.innerHTML = '<button>Filters</button>'
|
control.innerHTML = '<button>Filteri</button>'
|
||||||
//control.style = "top: 200px;"
|
//control.style = "top: 200px;"
|
||||||
control['style'] = 'top: 200px;'
|
// TODO: enable this
|
||||||
|
//control['style'] = 'top: 200px;'
|
||||||
|
|
||||||
var input = document.getElementById('gmaps-places-input')
|
var input = document.getElementById('gmaps-places-input')
|
||||||
|
|
||||||
@@ -540,6 +542,7 @@ class Main extends React.Component {
|
|||||||
onClose={this.onCloseClick.bind(this)}
|
onClose={this.onCloseClick.bind(this)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
children.push(
|
children.push(
|
||||||
<Listings
|
<Listings
|
||||||
sort={this.state.sort}
|
sort={this.state.sort}
|
||||||
@@ -559,6 +562,20 @@ class Main extends React.Component {
|
|||||||
return content
|
return content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMobileListViewClick (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
this.dispatch({
|
||||||
|
type: 'MOBILE_LIST_VIEW'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMobileMapViewClick (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
this.dispatch({
|
||||||
|
type: 'MOBILE_MAP_VIEW'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const leftStyle = {}
|
const leftStyle = {}
|
||||||
const rightStyle = {}
|
const rightStyle = {}
|
||||||
@@ -567,7 +584,7 @@ class Main extends React.Component {
|
|||||||
let leftClass = 'left-base'
|
let leftClass = 'left-base'
|
||||||
let rightClass = 'right-base'
|
let rightClass = 'right-base'
|
||||||
|
|
||||||
if (this.state.mapClicked) {
|
if (this.state.listingId || this.state.mapClicked) {
|
||||||
leftClass = 'left-hidden'
|
leftClass = 'left-hidden'
|
||||||
rightClass = 'right-shown'
|
rightClass = 'right-shown'
|
||||||
}
|
}
|
||||||
@@ -576,7 +593,7 @@ class Main extends React.Component {
|
|||||||
<div id="container">
|
<div id="container">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<a className="hamburger-menu">K</a>
|
<a className="hamburger-menu">K</a>
|
||||||
<span className="title">Kiwi</span>
|
<span className="title">KIVI</span>
|
||||||
<input
|
<input
|
||||||
id="gmaps-places-input"
|
id="gmaps-places-input"
|
||||||
placeholder="Unesite adresu, naselje ili grad"
|
placeholder="Unesite adresu, naselje ili grad"
|
||||||
@@ -584,10 +601,10 @@ class Main extends React.Component {
|
|||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<div className="view-types">
|
<div className="view-types">
|
||||||
<a className="view-type-left">
|
<a onClick={this.onMobileListViewClick.bind(this)}className="view-type-left">
|
||||||
<i className="btn-select-map fa fa-list" />
|
<i className="btn-select-map fa fa-list" />
|
||||||
</a>
|
</a>
|
||||||
<a className="view-type-right">
|
<a onClick={this.onMobileMapViewClick.bind(this)} className="view-type-right">
|
||||||
<i className="view-type-map-icon fa fa-map-marker" />
|
<i className="view-type-map-icon fa fa-map-marker" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -598,7 +615,17 @@ class Main extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="left" style={leftStyle} className={leftClass}>
|
<div id="left" style={leftStyle} className={leftClass}>
|
||||||
<div id="map" ref="map" />
|
{this.state.mobileView === 'LIST' && !this.state.listingDetails &&
|
||||||
|
<div className="map-list-view">
|
||||||
|
<Listings
|
||||||
|
sort={this.state.sort}
|
||||||
|
totalCount={this.state.totalCount}
|
||||||
|
loadingMore={this.state.loadingMore}
|
||||||
|
listings={this.state.listings}
|
||||||
|
dispatch={this.dispatch.bind(this)}
|
||||||
|
/>
|
||||||
|
</div>}
|
||||||
|
<div id="map" ref="map" className={this.state.mobileView !== 'MAP' && "hide"} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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 viewListingDetails = ({type, action}, component) => {
|
||||||
const scrollElem = document.querySelector('.right-content')
|
const scrollElem = getScrollElem(component)
|
||||||
component.savedScrollTop = scrollElem.scrollTop
|
component.savedScrollTop = scrollElem.scrollTop
|
||||||
|
|
||||||
component.setState(
|
component.setState(
|
||||||
@@ -224,7 +232,8 @@ const backToResults = ({type, action}, component) => {
|
|||||||
prevSelected.marker.setIcon(component.visitedMarkerIcon())
|
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
|
scrollElem.scrollTop = component.savedScrollTop
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -251,7 +260,8 @@ const mapIdle = ({type, action}, component) => {
|
|||||||
page: 0
|
page: 0
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
const scrollElem = document.querySelector('.right-content')
|
const scrollElem = getScrollElem(component)
|
||||||
|
//const scrollElem = document.querySelector('.right-content')
|
||||||
scrollElem.scrollTop = 0
|
scrollElem.scrollTop = 0
|
||||||
component.refreshListings()
|
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 = {
|
const handlers = {
|
||||||
SET_MIN_PRICE: setMinPrice,
|
SET_MIN_PRICE: setMinPrice,
|
||||||
SET_MAX_PRICE: setMaxPrice,
|
SET_MAX_PRICE: setMaxPrice,
|
||||||
@@ -372,7 +399,9 @@ const handlers = {
|
|||||||
UPDATE_CONTACT_INFO: updateContactInfo,
|
UPDATE_CONTACT_INFO: updateContactInfo,
|
||||||
SUBMIT_CONTACT_START: submitContactStart,
|
SUBMIT_CONTACT_START: submitContactStart,
|
||||||
SUBMIT_CONTACT_END: submitContactEnd,
|
SUBMIT_CONTACT_END: submitContactEnd,
|
||||||
INVALID_CONTACT: invalidContact
|
INVALID_CONTACT: invalidContact,
|
||||||
|
MOBILE_MAP_VIEW: mobileMapView,
|
||||||
|
MOBILE_LIST_VIEW: mobileListView
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handleMessage = ({type, action}, component) => {
|
export const handleMessage = ({type, action}, component) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user