From a6b3b37156fff53360e1bfd4091003c7486f9978 Mon Sep 17 00:00:00 2001 From: Eduardo Liron Date: Sat, 15 Jul 2023 19:36:10 -0300 Subject: [PATCH] fix(FoodPage): Improve layout responsibility --- src/main.css | 8 ++------ src/routes/FoodPage.tsx | 45 +++++++++++++++++------------------------ 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/src/main.css b/src/main.css index 0b2578b..aa8c2b2 100644 --- a/src/main.css +++ b/src/main.css @@ -8,7 +8,6 @@ body { } .App { - text-align: center; width:100%; margin: 0 auto; @@ -71,12 +70,9 @@ a { /* FOODPAGE COMPONENT LAYOUT */ .foodPage-image { - align-items: end; - border-radius: 8px; - box-shadow: 3px 4px 8px #888888; + width: 100%; + height: 100%; object-fit: cover; - width:100%; - height: 160px; } .season-status{ diff --git a/src/routes/FoodPage.tsx b/src/routes/FoodPage.tsx index 56662e7..8c65d58 100644 --- a/src/routes/FoodPage.tsx +++ b/src/routes/FoodPage.tsx @@ -2,7 +2,7 @@ import type { FoodList } from "../types/food"; import { currentMonth } from "../utils/utils"; import { useParams, useNavigate, Link } from "react-router-dom"; import { useEffect } from "react"; -import { Box, Typography, Grid } from "@mui/material"; +import { Box, Typography, Grid, Stack } from "@mui/material"; import { styled } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; @@ -63,43 +63,33 @@ export default function FoodPage({ food }: { food: FoodList }) { })); const ImgBox = styled(Box)(() => ({ - objectFit: "cover", - margin: "1em", - width: "40%", - maxHeight: "160px", + position: "relative", + overflow: "hidden", + width: "8rem", + height: "8rem", + borderRadius: "1rem", + boxShadow: "3px 4px 8px #888888" })); const renderMonths = () => { return months.map((month) => { let userNumber = Number(month) + 1 return ( - + sx={{...monthColor(month), m: 1}}> {t(`month_${month}`)} - ); }); } return ( - + {`photo @@ -111,27 +101,28 @@ export default function FoodPage({ food }: { food: FoodList }) { alignItems="left" justifyContent="center" width="50%"> - {/* typescript problem */} - {t(selectedFood?selectedFood.description[0].name:'FOOD NOT FOUND')}: + {/* typescript problem */} + {t(selectedFood?selectedFood.description[0].name:'FOOD NOT FOUND')} {t(seasonStatus)} - + {/* BOTTOM GRID WITH MONTHS */} - + {/* {t('FoodPage_monthsInSeason')} - - */} + {renderMonths()} - + );