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 /> <hr />
<div className="dish-row-column"> <div className="dish-row-column">
<h5>Cena</h5> <h5>Cena</h5>
<DishPrices prices={dish.prices}/> {dish.prices && <DishPrices prices={dish.prices} />}
</div> </div>
<hr /> <hr />
<div className="dish-row-column"> <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 FormGroup from "@material-ui/core/FormGroup";
import FormControlLabel from "@material-ui/core/FormControlLabel"; import FormControlLabel from "@material-ui/core/FormControlLabel";
import Checkbox from "@material-ui/core/Checkbox"; import Checkbox from "@material-ui/core/Checkbox";
import FormHelperText from "@material-ui/core/FormHelperText";
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,10 @@
.pictograms-container { .pictograms-container {
height: 30px; 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 { .pictograms-container-separated {
@@ -11,8 +15,8 @@
.pictogram { .pictogram {
margin: 6px; margin: 6px;
height: 20px; height: 16px;
width: 20px; width: 16px;
} }
.separate-pictogram { .separate-pictogram {