From 2ad6fded02379a088aa5cdec2889f8a39b21c05e Mon Sep 17 00:00:00 2001 From: AvantikaSharma2307 <123316093+AvantikaSharma2307@users.noreply.github.com> Date: Tue, 16 Apr 2024 23:59:13 +0530 Subject: [PATCH 1/2] Updated the sponser section --- src/Sections/Card.css | 10 ++++++++- src/Sections/Sponsors.tsx | 44 +++++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/Sections/Card.css b/src/Sections/Card.css index d32d59aeff..f22b6ceada 100644 --- a/src/Sections/Card.css +++ b/src/Sections/Card.css @@ -1,5 +1,5 @@ .card { - width: 300px; + width: 250px; height: 200px; background-color:white; border-radius: 10px; @@ -31,4 +31,12 @@ grid-template-columns: 1fr; } } + .card { + transition: opacity 0.5s ease; + opacity: 0; + } + .appear { + opacity: 1; + } + \ No newline at end of file diff --git a/src/Sections/Sponsors.tsx b/src/Sections/Sponsors.tsx index 27039a8f41..24ff992ed5 100644 --- a/src/Sections/Sponsors.tsx +++ b/src/Sections/Sponsors.tsx @@ -1,23 +1,49 @@ - +import { useEffect, useRef, useState } from 'react'; import './Card.css'; import devtron from '../images/devtron.png'; import microsoft from '../images/microsoft.png'; import tata from'../images/tata 1 mg.png'; import epam from '../images/epam.png'; + export const Sponsors = () => { + const [isVisible, setIsVisible] = useState(false); + const sponsorRef = useRef(null); + + useEffect(() => { + const options = { + root: null, + rootMargin: '0px', + threshold: 0.5, + }; + + const observer = new IntersectionObserver((entries) => { + entries.forEach((entry) => { + setIsVisible(entry.isIntersecting); + }); + }, options); + + if (sponsorRef.current) { + observer.observe(sponsorRef.current); + } + + return () => { + if (sponsorRef.current) { + observer.unobserve(sponsorRef.current); + } + }; + }, []); + return (