SkeletonCard
TheSkeletonCard component displays a loading placeholder that mimics the structure of a product card. It’s used to provide visual feedback while product data is being fetched.
Overview
Located atsrc/components/SkeletonCard.jsx, this component uses Bootstrap’s placeholder utilities to create an animated loading skeleton that matches the dimensions and layout of the actual ProductCard component.
Usage
src/pages/Home.jsx:105-108
Component Structure
The SkeletonCard component has no props and renders a fixed layout:src/components/SkeletonCard.jsx
Features
Loading State
Provides immediate visual feedback during data fetching
Layout Matching
Mirrors ProductCard dimensions for seamless transitions
Animation
Uses Bootstrap’s placeholder-glow for animated effect
Grid Compatible
Works within the same responsive grid as ProductCard
Implementation Details
Placeholder Elements
The component includes placeholders for:- Image area: 200px height placeholder for product thumbnail
- Title: 8-column width placeholder
- Price: 6-column width placeholder
- Buttons: Two 5-column width button placeholders
Bootstrap Classes
Key classes used:placeholder-glow- Adds animated shimmer effectplaceholder- Creates the placeholder elementcol-{n}- Controls placeholder widthh-100- Full height card
Grid Layout
Real-World Usage
Product Catalog Loading
src/pages/Home.jsx:104-117
The
limit variable (set to 12) controls how many skeleton cards are displayed during loading, matching the number of products shown per page.Best Practices
Match Your Card Layout
Match Your Card Layout
Ensure SkeletonCard dimensions and structure match your ProductCard for smooth transitions when data loads.
Use Appropriate Count
Use Appropriate Count
Display the same number of skeleton cards as you would display actual products to maintain consistent visual density.
Unique Keys
Unique Keys
Always use unique keys when rendering multiple skeleton cards in a loop (e.g., array index).
Related Components
- ProductCard - The actual product card component that replaces the skeleton
- Filters - Often triggers loading states that show skeleton cards
