import React from 'react';
import {formatPrice} from '../lib/helpers';
export default class Listings extends React.Component {
onListingClick(id) {
this.props.dispatch({
type: 'VIEW_LISTING_DETAILS',
action: {
id
}
});
}
onMouseEnter (id) {
this.props.dispatch({
type: 'ON_LISTING_MOUSE_OVER',
action: {
id
}
});
}
renderListings () {
const {listings = (new Map())} = this.props;
if (listings.size === 0) {
return (
Nema rezultata
Nema oglasa koji ispunjavaju vaše uslove pretrage.
)
}
const rendered = [];
for(const l of listings.values()) {
const {images} = l;
rendered.push(
{formatPrice(l.price)}
{l.rooms ? `${l.rooms} sobe, `: null}{l.size ? `${l.size}m2`: null}
Prije 2 sata
);
}
return rendered;
}
render() {
const {listings = (new Map())} = this.props;
return (
{listings.size} rezultata
{this.renderListings()}
)
}
}