Analytics added / NewRestaurant.js added
This commit is contained in:
45
src/components/Output/CardRestaurant.js
Normal file
45
src/components/Output/CardRestaurant.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import React from "react";
|
||||
import Pictograms from "./Pictograms";
|
||||
import { fetchRestaurant } from "../../actions";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
||||
function extractTags(tags) {
|
||||
var results = [];
|
||||
for (let [key, value] of Object.entries(tags)) {
|
||||
if (value === true) {
|
||||
results.push(key);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
export default function CardRestaurant(props) {
|
||||
const dispatch = useDispatch();
|
||||
const img = props.imgUrl;
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={() => dispatch(fetchRestaurant(props.id))}
|
||||
className="card-restaurant"
|
||||
>
|
||||
<div
|
||||
className="card-img"
|
||||
style={{ backgroundImage: "url(" + img + ")" }}
|
||||
></div>
|
||||
<div className="card-info">
|
||||
<div className="title-info">
|
||||
<h1>{props.name}</h1>
|
||||
<hr />
|
||||
<h3>Miasto: {props.city}</h3>
|
||||
<h3>Otwarte: {props.hours}</h3>
|
||||
</div>
|
||||
<div className="card-description">
|
||||
<p>{props.description}</p>
|
||||
</div>
|
||||
<div className="card-pictograms">
|
||||
<Pictograms pictograms={extractTags(props.tags)} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user