import React, { useRef, useLayoutEffect } from 'react'; import { motion } from 'framer-motion'; import gsap from 'gsap'; import { ScrollTrigger } from 'gsap/ScrollTrigger'; import { Link } from 'react-router-dom'; import { blogPostData } from '../src/data/seoData'; gsap.registerPlugin(ScrollTrigger); const posts = blogPostData .filter((post) => !post.redirect) .slice(0, 3) .map((post) => ({ image: post.image || '/images/blog/business-email-comparison-new.png', category: post.category === 'authority' ? 'IT Insights' : 'Local Services', title: post.h1, excerpt: post.description, href: `/${post.slug}`, })); const Blog: React.FC = () => { const containerRef = useRef(null); const imagesRef = useRef<(HTMLDivElement | null)[]>([]); imagesRef.current = []; useLayoutEffect(() => { const ctx = gsap.context(() => { imagesRef.current.forEach((imgWrapper) => { if (!imgWrapper) return; gsap.to(imgWrapper, { yPercent: 30, ease: "none", scrollTrigger: { trigger: imgWrapper.closest('article'), start: "top bottom", end: "bottom top", scrub: true } }); }); }, containerRef); return () => ctx.revert(); }, []); return (
Latest Insights

Stay updated with our latest news and articles.

View all posts arrow_forward
{posts.map((post, i) => (
{ if (el) imagesRef.current.push(el); }} className="w-full h-[140%] -mt-[20%]" > {post.title}
Read
{post.category}

{post.title}

{post.excerpt}

))}
); }; export default Blog;