import { Card, Skeleton } from "antd"; import useBreakPoint from "hooks/useBreakPoint"; import styles from "./MenuSkeleton.module.css"; interface MenuSkeletonProps { categoryCount?: number; itemCount?: number; variant?: | "default" | "minimal" | "detailed" | "categories-only" | "menu-only"; } const MenuSkeleton = ({ categoryCount = 8, itemCount = 8, variant = "default", }: MenuSkeletonProps) => { const { isMobile, isTablet } = useBreakPoint(); const getCategoryCardStyle = () => { if (isMobile) { return { width: 90, height: 110, }; } else if (isTablet) { return { width: 120, height: 110, }; } else { return { width: 140, height: 160, }; } }; const getMenuItemCardStyle = () => { if (isMobile) { return { height: 140, padding: "12px 12px 12px 16px", }; } else if (isTablet) { return { height: 160, padding: "16px", }; } else { return { height: 180, padding: "20px", }; } }; const getCategoryImageStyle = () => { if (isMobile) { return { width: 90, height: 78, borderTopLeftRadius: 8, borderTopRightRadius: 8, }; } else if (isTablet) { return { width: 120, height: 78, borderTopLeftRadius: 8, borderTopRightRadius: 8, }; } else { return { width: 140, height: 78, borderTopLeftRadius: 8, borderTopRightRadius: 8, }; } }; const getMenuItemImageStyle = () => { if (isMobile) { return { width: 90, height: 95, }; } else if (isTablet) { return { width: 120, height: 120, }; } else { return { width: 140, height: 140, }; } }; return ( <> {/* Restaurant Header Skeleton */}
{/* Cover Image Skeleton */} {/* Logo Skeleton */} {/* Decorative Shap es Skeleton */}
{/* Restaurant Info Skeleton */}
{/* Loyalty Card Skeleton */}

{Array.from({ length: 5 }).map((_, index) => ( ))}
{/* Categories Skeleton */} {(variant === "default" || variant === "minimal" || variant === "detailed" || variant === "categories-only") && (
{Array.from({ length: variant === "minimal" ? Math.min(categoryCount, 4) : categoryCount, }).map((_, index) => (
))}
)} {/* Menu Items Skeleton */} {(variant === "default" || variant === "minimal" || variant === "detailed" || variant === "menu-only") && (
{Array.from({ length: variant === "minimal" ? 1 : 3 }).map( (_, sectionIndex) => (
{/* Section Header Skeleton */} {/*
*/}
{Array.from({ length: variant === "minimal" ? Math.min(itemCount, 4) : itemCount, }).map((_, itemIndex) => (
{/* Item Description Skeleton */} {/* Action Icons Skeleton */}
{/* Item Image Skeleton */} {" "}
))}
), )}
)}
); }; export default MenuSkeleton;