More small fixes
This commit is contained in:
BIN
web/dist/static/map.jpg
vendored
Normal file
BIN
web/dist/static/map.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import Gallery from './gallery'
|
||||
import {formatPrice} from '../lib/helpers'
|
||||
import {formatPrice, formatRooms, formatFloor} from '../lib/helpers'
|
||||
import ContactModal from './ContactModal';
|
||||
|
||||
export default class ListingDetails extends React.Component {
|
||||
@@ -79,7 +79,7 @@ export default class ListingDetails extends React.Component {
|
||||
<div className="ld-features">
|
||||
<div className="ld-feature-box">
|
||||
<i className="fa fa-bed" />
|
||||
{listing.rooms} sobe
|
||||
{formatRooms(listing.rooms)}
|
||||
</div>
|
||||
<div className="ld-feature-box">
|
||||
<i className="fa fa-home" />
|
||||
@@ -87,7 +87,7 @@ export default class ListingDetails extends React.Component {
|
||||
</div>
|
||||
<div className="ld-feature-box">
|
||||
<i className="fa fa-home" />
|
||||
{listing.floor}. sprat
|
||||
{formatFloor(listing.floor)}
|
||||
</div>
|
||||
<div className="ld-feature-box">
|
||||
<i className="fa fa-home" />
|
||||
|
||||
@@ -38,3 +38,31 @@ export const listingUrl = (id) => {
|
||||
}
|
||||
|
||||
export const isMobile = () => window.matchMedia("(max-width: 768px)").matches
|
||||
|
||||
export const formatRooms = (rooms) => {
|
||||
const val = parseInt(rooms)
|
||||
|
||||
if (isNaN(val)) {
|
||||
return '--'
|
||||
}
|
||||
|
||||
if (val === 0) {
|
||||
return "Garsonjera"
|
||||
}
|
||||
|
||||
if ([2, 3, 4].includes(val)) {
|
||||
return `${val} sobe`
|
||||
}
|
||||
|
||||
return `${val} soba`
|
||||
}
|
||||
|
||||
export const formatFloor = (floor) => {
|
||||
|
||||
const val = parseInt(floor)
|
||||
if (isNaN(val)) {
|
||||
return '--'
|
||||
}
|
||||
|
||||
return `${val}. sprat`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user