From 6b018f35c979cc99c6fcebb262d1936bdb150c1d Mon Sep 17 00:00:00 2001 From: Miran Date: Sun, 22 Dec 2024 23:05:54 +0530 Subject: [PATCH 1/2] feat: add events highlight section on homepage --- package.json | 1 + src/components/EventsHighlight/index.jsx | 110 +++++++++++++++++++++++ src/pages/Home/index.jsx | 6 ++ 3 files changed, 117 insertions(+) create mode 100644 src/components/EventsHighlight/index.jsx diff --git a/package.json b/package.json index b60061b..eed8ed7 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@vitejs/plugin-react": "^4.2.1", "baffle": "^0.3.6", "framer-motion": "^11.5.4", + "gsap": "^3.12.5", "lodash": "^4.17.21", "prop-types": "^15.8.1", "react": "^18.2.0", diff --git a/src/components/EventsHighlight/index.jsx b/src/components/EventsHighlight/index.jsx new file mode 100644 index 0000000..b875bd9 --- /dev/null +++ b/src/components/EventsHighlight/index.jsx @@ -0,0 +1,110 @@ +import { useEffect, useRef } from "react"; +import gsap from "gsap"; +import { ScrollTrigger } from "gsap/ScrollTrigger"; + +const EventsHighlight = () => { + const containerRef = useRef(null); + + const images = [ + { + url: "/CodeX-Website/gallery/Community Session/cs1.jpg", + alt: "Image 1", + side: "left", + }, + { + url: "/CodeX-Website/gallery/AIML SESSION/aiml1.jpg", + alt: "Image 2", + side: "right", + }, + { + url: "/CodeX-Website/gallery//AIML SESSION/aiml6.jpg", + alt: "Image 3", + side: "left", + }, + { + url: "/CodeX-Website/gallery/Community Session/cs3.jpg", + alt: "Image 4", + side: "right", + }, + { + url: "/CodeX-Website/gallery/HackTober Fest/htf1_1.jpg", + alt: "Image 5", + side: "left", + }, + { + url: "/CodeX-Website/gallery/Laser Lock/ll1.jpg", + alt: "Image 6", + side: "right", + }, + ]; + + useEffect(() => { + gsap.registerPlugin(ScrollTrigger); + + // Set up each image animation + images.forEach((_, index) => { + const imageSection = containerRef.current.children[index]; + + gsap.fromTo( + imageSection, + { + opacity: 1, + y: "20vh", + }, + { + opacity: 1, + y: "-100vh", + ease: "none", + scrollTrigger: { + trigger: imageSection, + start: "top bottom", + end: "bottom top", + scrub: 1, + markers: false, + }, + }, + ); + }); + + return () => { + ScrollTrigger.getAll().forEach((trigger) => trigger.kill()); + }; + }, []); + + return ( +
+ {/* Fixed description */} +
+

+ Events Highlight +

+
+ + {/* Images container */} +
+ {images.map((image, index) => ( +
+
+ {image.alt} +
+
+ ))} +
+
+ ); +}; + +export default EventsHighlight; diff --git a/src/pages/Home/index.jsx b/src/pages/Home/index.jsx index 861f565..00360c7 100644 --- a/src/pages/Home/index.jsx +++ b/src/pages/Home/index.jsx @@ -2,6 +2,8 @@ import { useContext } from "react"; import Heading from "@/components/Heading"; import { CursorVariantContext } from "@/context/CursorVariantProvider"; import PageTransition from "@/components/PageTransition"; +import EventsHighlight from "../../components/EventsHighlight"; +import SkewButton from "../../components/SkewButton"; function Home() { const { setCursorVariantText, setCursorVariantDefault } = @@ -24,6 +26,10 @@ function Home() { + +
+ +
); } From 680e9566376ce370e9bab973f5d0119ba0bb767e Mon Sep 17 00:00:00 2001 From: Miran Date: Sun, 22 Dec 2024 23:10:40 +0530 Subject: [PATCH 2/2] fix: remove redundant work --- src/components/AboutUs/index.jsx | 107 ----------------------- src/components/Card/index.jsx | 17 ---- src/components/EventsHighlight/index.jsx | 14 ++- src/routes/index.jsx | 7 -- 4 files changed, 10 insertions(+), 135 deletions(-) delete mode 100644 src/components/AboutUs/index.jsx delete mode 100644 src/components/Card/index.jsx diff --git a/src/components/AboutUs/index.jsx b/src/components/AboutUs/index.jsx deleted file mode 100644 index 1f01627..0000000 --- a/src/components/AboutUs/index.jsx +++ /dev/null @@ -1,107 +0,0 @@ -import Marquee from "react-fast-marquee"; -import Card from "@/components/Card"; - -export default function AboutSection() { - const images1 = [ - { src: "/placeholder.svg?height=250&width=250", id: "image1-1" }, - { src: "/placeholder.svg?height=250&width=250", id: "image1-2" }, - { src: "/placeholder.svg?height=250&width=250", id: "image1-3" }, - { src: "/placeholder.svg?height=250&width=250", id: "image1-4" }, - ]; - - const images2 = [ - { src: "/placeholder.svg?height=250&width=250", id: "image2-1" }, - { src: "/placeholder.svg?height=250&width=250", id: "image2-2" }, - { src: "/placeholder.svg?height=250&width=250", id: "image2-3" }, - { src: "/placeholder.svg?height=250&width=250", id: "image2-4" }, - ]; - - return ( - <> -
-
-
-
-

- ABOUT US -

- -
-

- - Codex is the coding club at{" "} - - - Symbiosis Institute of Technology - - - {" "} - that brings together students passionate about technology and - programming. Our club is committed to creating an engaging - environment{" "} - - - where members can learn, collaborate, and grow their coding - expertise through a variety of activities and events. - -

- -
-
-
-
-
- - {images1.map((image) => ( - - {`Gallery - - ))} - - - - {images2.map((image) => ( - - {`Gallery - - ))} - -
- - ); -} diff --git a/src/components/Card/index.jsx b/src/components/Card/index.jsx deleted file mode 100644 index 6c440a3..0000000 --- a/src/components/Card/index.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import PropTypes from "prop-types"; - -export function Card({ children, className }) { - return
{children}
; -} - -Card.propTypes = { - children: PropTypes.node, - className: PropTypes.string, -}; - -Card.defaultProps = { - children: null, - className: "", -}; - -export default Card; diff --git a/src/components/EventsHighlight/index.jsx b/src/components/EventsHighlight/index.jsx index b875bd9..c468d23 100644 --- a/src/components/EventsHighlight/index.jsx +++ b/src/components/EventsHighlight/index.jsx @@ -2,36 +2,42 @@ import { useEffect, useRef } from "react"; import gsap from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; -const EventsHighlight = () => { +function EventsHighlight() { const containerRef = useRef(null); const images = [ { + key: 0, url: "/CodeX-Website/gallery/Community Session/cs1.jpg", alt: "Image 1", side: "left", }, { + key: 1, url: "/CodeX-Website/gallery/AIML SESSION/aiml1.jpg", alt: "Image 2", side: "right", }, { + key: 2, url: "/CodeX-Website/gallery//AIML SESSION/aiml6.jpg", alt: "Image 3", side: "left", }, { + key: 3, url: "/CodeX-Website/gallery/Community Session/cs3.jpg", alt: "Image 4", side: "right", }, { + key: 4, url: "/CodeX-Website/gallery/HackTober Fest/htf1_1.jpg", alt: "Image 5", side: "left", }, { + key: 5, url: "/CodeX-Website/gallery/Laser Lock/ll1.jpg", alt: "Image 6", side: "right", @@ -82,9 +88,9 @@ const EventsHighlight = () => { {/* Images container */}
- {images.map((image, index) => ( + {images.map((image) => (
{
); -}; +} export default EventsHighlight; diff --git a/src/routes/index.jsx b/src/routes/index.jsx index 5bfe1a6..f460a54 100644 --- a/src/routes/index.jsx +++ b/src/routes/index.jsx @@ -5,15 +5,8 @@ import Gallery from "@/pages/Gallery/Gallery"; import Contact from "@/pages/Contact"; import PageNotFound from "../pages/PageNotFound"; import Loader from "@/components/Loader"; -import AboutSection from "@/components/AboutUs"; const routes = [ - { - label: "AboutUs", - path: "/about-us-test", - requireAuth: false, - render: , - }, { label: "Loader", path: "/loader",