Overview
TheProductSection component displays product showcases with alternating layouts, automatic image rotation, and flexible content types (features or categories). It’s designed to highlight PROVESA’s main product lines with rich visual presentations.
Import
Props
Array of product objects from the database. If empty, displays two default products (Arroz Premium Salguero and Abarrotes category).Product Structure:
Usage
Basic Usage with Database Products
Default Behavior (No Products)
- Arroz Premium Salguero (features mode)
- Abarrotes category overview (categories mode)
Custom Product
Display Types
Features Mode
Displays a list of product features with icons:- Icon from
featureIconsarray (BadgeCheck, ShoppingBasket, Truck, Award) - Feature title (bold)
- Feature description (smaller text)
Categories Mode
Displays numbered category cards:- Large numbered badge (01, 02, etc.)
- Category name
- Brief description
Layout Alignment
Left Alignment
- Image on the left side
- Text content on the right side
- Default rotation:
-rotate-2
Right Alignment
- Image on the right side (using
order-2) - Text content on the left side (using
order-1) - Rotation:
rotate-2
Image Slider
Each product features an automatic image slider:Automatic Rotation
- Each product’s slider rotates independently
- Base interval: 4 seconds
- Staggered by 500ms per product to avoid simultaneous transitions
Slider Controls
Dot navigation appears at the bottom of each image:Smooth Transitions
Images fade and scale during transitions:Accent Colors
Primary Accent
- Blue color scheme
- Badge: “Producto Estrella” with Award icon
- Primary blue decorative elements
Secondary Accent
- Orange/warm color scheme
- Badge: “Abarrotes” with ShoppingBasket icon
- Accent orange decorative elements
Visual Effects
Decorative Background Elements
Floating gradient orbs provide subtle visual interest:Rotated Background Card
Each product image has a rotated background card:Image Container Effects
- Shadow:
shadow-2xl shadow-slate-200/80 - Ring:
ring-1 ring-black/5 - Hover scale:
group-hover:scale-[1.01] - Rounded corners:
rounded-3xl
Section Header
The section includes a styled header:Responsive Design
Mobile (< 768px)
- Single column layout
- Full-width images
- Text below images
- 2-column category grid
Tablet/Desktop (≥ 768px)
- Two-column grid
- Side-by-side image and text
- Alternating layouts based on
align - Larger spacing and typography
Feature Icons
Rotates through four icons for features:featureIcons[fi % featureIcons.length]
Real-World Example
Fromroutes/+page.svelte:
Performance Considerations
- Images are preloaded but hidden with opacity
- Staggered intervals prevent simultaneous transitions
- Intervals are properly cleaned up on component unmount
- Smooth transitions use GPU-accelerated properties (opacity, transform)
Dependencies
lucide-svelte- BadgeCheck, ShoppingBasket, Truck, Award iconssvelte- onMount lifecycle function
Related Components
- HeroSlider - Similar slider functionality
- NosotrosTeaser - Company information section
