web client v0.10 (restaurant view)

This commit is contained in:
2020-10-05 19:33:52 +02:00
parent b3ade3de7d
commit 06728d32f1
12 changed files with 146 additions and 50 deletions

View File

@@ -1,7 +1,7 @@
import React from "react";
import Pictograms from "./Pictograms";
import { fetchRestaurant } from "../../actions";
import { useDispatch } from "react-redux";
import { useHistory } from "react-router-dom";
import { getTodayHours } from "../../Services.js";
function extractTags(tags) {
var results = [];
@@ -15,12 +15,12 @@ function extractTags(tags) {
}
export default function CardRestaurant(props) {
const dispatch = useDispatch();
const history = useHistory();
const img = props.imgUrl;
return (
<div
onClick={() => dispatch(fetchRestaurant(props.id))}
onClick={() => history.push(`/restaurant/${props.id}`)}
className="card-restaurant"
>
<div
@@ -32,7 +32,7 @@ export default function CardRestaurant(props) {
<h1>{props.name}</h1>
<hr />
<h3>Miasto: {props.city}</h3>
<h3>Otwarte: {props.hours}</h3>
<h3>Dziś otwarte: {getTodayHours(props.hours)}</h3>
</div>
<div className="card-description">
<p>{props.description}</p>