More small fixes

This commit is contained in:
Edin Dazdarevic
2017-04-17 15:46:27 +02:00
parent c556f52b1c
commit 344877beda
3 changed files with 31 additions and 3 deletions

View File

@@ -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`
}