From 28bad2de5f2594fbee136a7f72d2a4ac7e5e7e17 Mon Sep 17 00:00:00 2001 From: Mohammed Al-yaseen Date: Sat, 4 Oct 2025 18:16:26 +0300 Subject: [PATCH] fix skeleton styles --- .../components/MenuList/MenuList.module.css | 7 +- .../menu/components/MenuList/MenuList.tsx | 16 ++-- .../MenuSkeleton/MenuSkeleton.module.css | 96 ++++++++++--------- .../components/MenuSkeleton/MenuSkeleton.tsx | 83 +++++++--------- src/pages/menu/menu.module.css | 30 ++++-- src/pages/menu/page.tsx | 9 +- 6 files changed, 126 insertions(+), 115 deletions(-) diff --git a/src/pages/menu/components/MenuList/MenuList.module.css b/src/pages/menu/components/MenuList/MenuList.module.css index 60eb484..54ac4d5 100644 --- a/src/pages/menu/components/MenuList/MenuList.module.css +++ b/src/pages/menu/components/MenuList/MenuList.module.css @@ -49,10 +49,9 @@ } .menuItemsGrid { - display: grid; - gap: 12px; - grid-template-columns: 1fr; - margin-bottom: 10px; + display: flex; + flex-direction: column; + gap: 1rem; } .menuItemsGridMobile { diff --git a/src/pages/menu/components/MenuList/MenuList.tsx b/src/pages/menu/components/MenuList/MenuList.tsx index 70ca818..d6b5cf1 100644 --- a/src/pages/menu/components/MenuList/MenuList.tsx +++ b/src/pages/menu/components/MenuList/MenuList.tsx @@ -28,12 +28,14 @@ const { useBreakpoint } = Grid; export function MenuList({ data, categoryRefs }: MenuListProps) { const { isRTL } = useAppSelector((state) => state.locale); const products = data?.products; - const { xs, md } = useBreakpoint(); + const { xs, md, lg } = useBreakpoint(); const { items } = useAppSelector((state) => state.order); const restaurantName = localStorage.getItem("restaurantName"); const navigate = useNavigate(); const { t } = useTranslation(); const { themeName } = useAppSelector((state) => state.theme); + const isMobile = xs; + const isTablet = !xs && !md; // Show error state if data exists but has no products if (data && (!data.products || data.products.length === 0)) { @@ -103,11 +105,13 @@ export function MenuList({ data, categoryRefs }: MenuListProps) { {isRTL ? category.name : category.name}
{categoryProducts.map((item: Product) => (
{ - const { xs, sm, md } = useBreakpoint(); + const { xs, md } = useBreakpoint(); const isMobile = xs; - const isTablet = sm && !md; - const isDesktop = md; + const isTablet = !xs && !md; + // const isDesktop = md; const getCategoryCardStyle = () => { if (isMobile) { return { width: 90, - height: 95, + height: 110, }; } else if (isTablet) { return { width: 120, - height: 140, + height: 110, }; } else { return { @@ -66,23 +66,23 @@ const MenuSkeleton = ({ if (isMobile) { return { width: 90, - height: 60, + height: 78, borderTopLeftRadius: 8, borderTopRightRadius: 8, }; } else if (isTablet) { return { width: 120, - height: 90, - borderTopLeftRadius: 12, - borderTopRightRadius: 12, + height: 78, + borderTopLeftRadius: 8, + borderTopRightRadius: 8, }; } else { return { - width: 120, - height: 100, - borderTopLeftRadius: 16, - borderTopRightRadius: 16, + width: 140, + height: 78, + borderTopLeftRadius: 8, + borderTopRightRadius: 8, }; } }; @@ -116,25 +116,8 @@ const MenuSkeleton = ({ } }; - const getPageContainerStyle = () => { - if (isDesktop) { - return { - maxWidth: "1200px", - margin: "0 auto", - padding: "32px", - }; - } else if (isTablet) { - return { - padding: "24px", - }; - } - }; - return ( -
+
{/* Restaurant Header Skeleton */}
{/* Cover Image Skeleton */} @@ -153,10 +136,10 @@ const MenuSkeleton = ({ style={{ position: "absolute", left: isMobile ? "33px" : "40px", - top: isMobile ? "133px" : "-70px", + top: isMobile ? "133px" : isTablet ? "170px" : "170px", borderRadius: "50%", - width: isMobile ? "72px" : "80px", - height: isMobile ? "72px" : "80px", + width: isMobile ? "72px" : isTablet ? "80px" : "80px", + height: isMobile ? "72px" : isTablet ? "80px" : "80px", border: "3px solid var(--background)", zIndex: 10, overflow: "hidden", @@ -262,7 +245,15 @@ const MenuSkeleton = ({ variant === "minimal" || variant === "detailed" || variant === "categories-only") && ( -
+
{Array.from({ length: variant === "minimal" @@ -313,7 +304,7 @@ const MenuSkeleton = ({ > +
{Array.from({ length: variant === "minimal" ? 1 : 3 }).map( (_, sectionIndex) => (
@@ -387,18 +383,11 @@ const MenuSkeleton = ({ lineHeight: 1, height: "100%", flex: 1, + display: "flex", + flexDirection: "column", + justifyContent: "center", }} > - {/* Item Name Skeleton */} - - {/* Item Description Skeleton */} @@ -102,7 +103,7 @@ function MenuPage() {
-
+
{isRTL ? restaurant?.nameAR : restaurant?.name}