Analytics added / NewRestaurant.js added

This commit is contained in:
2020-08-10 20:14:43 +02:00
parent 769be397e5
commit 48bb74e5f8
26 changed files with 118 additions and 48 deletions

View File

@@ -0,0 +1,31 @@
import React from "react";
import CardRestaurant from "./CardRestaurant";
import { useSelector } from "react-redux";
export default function SearchResults() {
var results = useSelector((store) => store.searchResults);
const array = Array.from(results);
var count = results.length;
const restaurants = array.map((restaurant) => (
<CardRestaurant
key={restaurant._id}
id={restaurant._id}
name={restaurant.name}
city={restaurant.city}
description={restaurant.description}
imgUrl={restaurant.imgUrl}
hours={restaurant.workingHours}
tags={restaurant.tags}
/>
));
return (
<div className="search-results">
<div className="results-count">
<p>Znaleziono: {count}</p>
<hr />
</div>
{restaurants}
</div>
);
}