display multiple prices / visual changes

This commit is contained in:
2020-11-12 18:23:52 +01:00
parent dd9501e3cc
commit 840407cd8f
6 changed files with 58 additions and 18 deletions

View File

@@ -75,7 +75,7 @@ export default function Dish(props) {
<hr />
<div className="dish-row-column">
<h5>Cena</h5>
<DishPrices prices={dish.prices}/>
{dish.prices && <DishPrices prices={dish.prices} />}
</div>
<hr />
<div className="dish-row-column">

View File

@@ -5,7 +5,6 @@ import FormControl from "@material-ui/core/FormControl";
import FormGroup from "@material-ui/core/FormGroup";
import FormControlLabel from "@material-ui/core/FormControlLabel";
import Checkbox from "@material-ui/core/Checkbox";
import FormHelperText from "@material-ui/core/FormHelperText";
const useStyles = makeStyles((theme) => ({
root: {

View File

@@ -8,7 +8,7 @@ export default function CardDish(props) {
const history = useHistory();
const {
name,
price,
prices,
imgUrl,
weight,
vegan,
@@ -17,6 +17,22 @@ export default function CardDish(props) {
_id,
} = props.dish;
const FormatPrices = () => {
if (prices.price1.priceName === "") {
return(
<h5>{ prices.price1.price }</h5>
)
} else {
return (
<div className="carddish-prices-multi">
{prices.price1.priceName !== "" && <h5>{prices.price1.price} ({ prices.price1.priceName })</h5>}
{prices.price2.priceName !== "" && <h5>{prices.price2.price} ({prices.price2.priceName})</h5>}
{prices.price3.priceName !== "" && <h5>{prices.price3.price} ({ prices.price3.priceName })</h5>}
</div>
)
}
}
return (
<div
className="carddish-container"
@@ -30,17 +46,20 @@ export default function CardDish(props) {
<div className="carddish-left-info">
<div className="carddish-left-upper">
<h2>{name}</h2>
<p>Porcja: {weight}</p>
<p>
{vegan && "Danie wegańskie | "}
{vegetarian && "Danie wegetariańskie"}
</p>
<div className="carddish-left-middle">
<p>Porcja: {weight}</p>
<p>
{(vegan & vegetarian) ? "wegańskie | wegetariańskie" : ""}
{(vegan & !vegetarian) ? "wegańskie" : ""}
{(!vegan & vegetarian) ? "wegetariańskie" : ""}
</p>
</div>
</div>
<Pictograms pictograms={extractTags(allergens)} />
</div>
</div>
<div className="carddish-right">
<h5>{!props.hidePrice && `${price}`}</h5>
<FormatPrices/>
<KeyboardArrowRightIcon color="primary" />
</div>
</div>

View File

@@ -59,6 +59,10 @@ export default function Restaurant(props) {
/>
)}
<WorkingHours hours={restaurant.workingHours} />
{restaurant.lunchHours && <h5>Lunch menu</h5>}
{restaurant.lunchHours && (
<p style={{ color: "#bbbbbb", fontWeight: 400 }}>{restaurant.lunchHours}</p>
)}
<hr />
<h5>Lokalizacja</h5>
{restaurant.location && (
@@ -68,9 +72,6 @@ export default function Restaurant(props) {
</div>
<div className="restaurant-content">
<div className="restaurant-dishes">
{restaurant.lunchHours && (
<h3>Lunch menu ({restaurant.lunchHours})</h3>
)}
{!showDishList && <CircularProgress />}
{(showDishList && restaurant.lunchMenu) && <LunchMenu restaurant={restaurant} />}
<h3>Menu</h3>

View File

@@ -40,12 +40,13 @@ h4 {
.carddish-left {
display: flex;
h2 {
font-size: 1.1rem;
font-size: 16px;
font-weight: 500;
margin: auto;
}
p {
font-size: 13px;
font-weight: 500;
margin-left: auto;
color: $gray;
}
@@ -57,15 +58,31 @@ h4 {
justify-content: space-between;
}
.carddish-left-middle {
margin-top: 8px;
p {
margin: auto;
margin-bottom: 3px;
}
}
.carddish-right {
display: flex;
flex-direction: column;
margin-right: 1rem;
margin-right: 5px;
align-items: flex-end;
justify-content: space-between;
h5 {
font-weight: 500;
font-size: 1rem;
font-size: 14px;
margin-top: 4px;
}
}
.carddish-prices-multi {
text-align: end;
h5 {
margin-top: 0;
margin-bottom: 4px;
}
}

View File

@@ -1,6 +1,10 @@
.pictograms-container {
height: 30px;
margin: 0px 8px 8px 0px;
margin: 0px 8px 0px 0px;
background-color: #444444;
border-radius: 24px;
padding: 2px;
width: fit-content;
}
.pictograms-container-separated {
@@ -11,8 +15,8 @@
.pictogram {
margin: 6px;
height: 20px;
width: 20px;
height: 16px;
width: 16px;
}
.separate-pictogram {