Directory
- Welcome
Reviews Section
The Reviews section component creates an engaging, auto-scrolling testimonial showcase with smooth animations and interactive hover effects. Perfect for displaying social proof and customer feedback in a modern, dynamic way.
Overview
Key features of the Reviews section:
- Infinite smooth scrolling animation
- Pause on hover interaction
- Responsive card design
- Automatic content duplication for seamless loops
- GSAP-powered animations
- Accessible structure
Basic Implementation
---import Reviews from '@/components/NST-components/sections/reviews/Reviews.astro';import { reviewsData } from './your-reviews-data';---
<Reviews data={reviewsData} />
Data Structure
The Reviews component expects an array of review objects with the following structure:
interface Review { author: string; role: string; content: string; image: string;}
const reviews: Review[] = [ { author: 'Sarah Johnson', role: 'Marketing Director', content: 'This product has transformed how we work. Absolutely incredible results!', image: '/testimonials/person1.jpg', }, // ... additional reviews];
Animation Features
Auto-Scrolling
The component implements smooth, continuous scrolling using GSAP:
- Automatic calculation of scroll speed based on content width
- Seamless infinite loop through content duplication
- Smooth acceleration and deceleration
- Performance-optimized using
will-change
transform
Hover Interaction
// Animation automatically pauses on hoverreviewsTrack.addEventListener('mouseenter', () => { // Smooth pause transition});
reviewsTrack.addEventListener('mouseleave', () => { // Smooth resume transition});
Styling Customization
Card Styling
<Reviews class="custom-reviews-section" cardClass="custom-review-card" />
CSS Custom Properties
.custom-reviews-section { --review-card-width: 400px; --review-card-gap: 2rem; --review-scroll-speed: 50; --review-gradient-fade: 15%;}
Accessibility Features
- Proper image alt text for reviewer photos
- Semantic HTML structure
- Reduced motion support
- ARIA labels for dynamic content
- Keyboard pause controls
Best Practices
-
Content Guidelines
- Keep testimonials concise and impactful
- Include authentic reviewer details
- Use high-quality profile images
- Maintain consistent content length
-
Visual Presentation
- Ensure readable text contrast
- Optimize image sizes
- Maintain consistent card heights
- Use appropriate spacing
-
Performance Optimization
- Lazy load images
- Optimize animation performance
- Consider reduced motion preferences
- Monitor scroll performance
Common Customizations
Custom Card Layout
<Reviews> <template slot="review-card"> { (review) => ( <div class="custom-review-layout"> <img src={review.image} alt={review.author} /> <div class="content"> <p>{review.content}</p> <cite>{review.author}</cite> </div> </div> ) } </template></Reviews>
Animation Speed Control
<Reviews scrollSpeed={75} Adjust scroll speed pauseOnHover={false} Disable pause on hover />
Technical Details
Animation Implementation
The component uses GSAP for smooth animations:
const scrollTween = gsap.to(reviewsTrack, { x: `-${totalWidth}px`, duration: totalWidth / scrollSpeed, ease: 'none', repeat: -1,});
Limited Time Launch Sale
Start showcasing customer testimonials with style. Get our AstroJS starter template now and implement engaging review sections in minutes.
GET 60% OFF!