MenuList: fix tablet size

- remove the three different css classes use one class in @media css
This commit is contained in:
2025-10-04 21:30:04 +03:00
parent 28bad2de5f
commit 226207a533
2 changed files with 20 additions and 38 deletions

View File

@@ -33,12 +33,24 @@
transition: color 0.3s ease; transition: color 0.3s ease;
} }
.menuItemsGrid {
display: flex;
flex-direction: column;
gap: 1rem;
}
/* Enhanced responsive menu section headers */ /* Enhanced responsive menu section headers */
@media (min-width: 769px) and (max-width: 1024px) { @media (min-width: 769px) and (max-width: 1024px) {
.menuSection h3 { .menuSection h3 {
margin: 40px 0px 20px 0px; margin: 40px 0px 20px 0px;
font-size: 24px; font-size: 24px;
} }
.menuItemsGrid {
grid-template-columns: repeat(2, 1fr);
gap: 16px;
margin-bottom: 20px;
}
} }
@media (min-width: 1025px) { @media (min-width: 1025px) {
@@ -46,39 +58,19 @@
margin: 50px 0px 25px 0px; margin: 50px 0px 25px 0px;
font-size: 28px; font-size: 28px;
} }
}
.menuItemsGrid { .menuItemsGrid {
display: flex;
flex-direction: column;
gap: 1rem;
}
.menuItemsGridMobile {
gap: 12px;
grid-template-columns: 1fr;
}
.menuItemsGridTablet {
grid-template-columns: repeat(2, 1fr);
gap: 16px;
padding: 0 12px;
margin-bottom: 20px;
}
.menuItemsGridDesktop {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 20px; gap: 20px;
padding: 0 16px;
margin-bottom: 24px; margin-bottom: 24px;
}
} }
/* Enhanced responsive menu items grid */ /* Enhanced responsive menu items grid */
@media (min-width: 1280px) { @media (min-width: 1280px) {
.menuItemsGridDesktop { .menuItemsGrid {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 24px; gap: 24px;
padding: 0 20px;
margin-bottom: 28px; margin-bottom: 28px;
} }
} }

View File

@@ -28,14 +28,12 @@ const { useBreakpoint } = Grid;
export function MenuList({ data, categoryRefs }: MenuListProps) { export function MenuList({ data, categoryRefs }: MenuListProps) {
const { isRTL } = useAppSelector((state) => state.locale); const { isRTL } = useAppSelector((state) => state.locale);
const products = data?.products; const products = data?.products;
const { xs, md, lg } = useBreakpoint(); const { xs, md } = useBreakpoint();
const { items } = useAppSelector((state) => state.order); const { items } = useAppSelector((state) => state.order);
const restaurantName = localStorage.getItem("restaurantName"); const restaurantName = localStorage.getItem("restaurantName");
const navigate = useNavigate(); const navigate = useNavigate();
const { t } = useTranslation(); const { t } = useTranslation();
const { themeName } = useAppSelector((state) => state.theme); const { themeName } = useAppSelector((state) => state.theme);
const isMobile = xs;
const isTablet = !xs && !md;
// Show error state if data exists but has no products // Show error state if data exists but has no products
if (data && (!data.products || data.products.length === 0)) { if (data && (!data.products || data.products.length === 0)) {
@@ -104,15 +102,7 @@ export function MenuList({ data, categoryRefs }: MenuListProps) {
> >
{isRTL ? category.name : category.name} {isRTL ? category.name : category.name}
</ProTitle> </ProTitle>
<div <div className={styles.menuItemsGrid}>
className={
styles.menuItemsGrid + " " + isMobile
? styles.menuItemsGridMobile
: isTablet
? styles.menuItemsGridTablet
: styles.menuItemsGridDesktop
}
>
{categoryProducts.map((item: Product) => ( {categoryProducts.map((item: Product) => (
<div <div
key={item.id} key={item.id}