feat(SW-93): add mocked facility cards
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import type {
|
||||
Facility,
|
||||
FacilityCard,
|
||||
} from "@/types/components/hotelPage/facilities"
|
||||
|
||||
export function sortCards(grid: Facility) {
|
||||
const sortedCards = grid.slice(0).sort((a: FacilityCard, b: FacilityCard) => {
|
||||
if (!a.backgroundImage && b.backgroundImage) {
|
||||
return 1
|
||||
}
|
||||
if (a.backgroundImage && !b.backgroundImage) {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
})
|
||||
|
||||
return { card: sortedCards.pop(), images: sortedCards }
|
||||
}
|
||||
Reference in New Issue
Block a user