Skip to content

Commit 2a9b7c5

Browse files
Abhishek PatawariAbhishek Patawari
authored andcommitted
feat: marquee, events page
1 parent 12f9da9 commit 2a9b7c5

File tree

6 files changed

+84
-1
lines changed

6 files changed

+84
-1
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"@fontsource/poppins": "^5.0.8",
2020
"@vitejs/plugin-react": "^4.2.1",
2121
"baffle": "^0.3.6",
22+
"canvas": "^3.0.0",
23+
"color-thief-react": "^2.1.0",
2224
"framer-motion": "^11.5.4",
2325
"gsap": "^3.12.5",
2426
"lodash": "^4.17.21",
@@ -28,6 +30,7 @@
2830
"react-fast-marquee": "^1.6.5",
2931
"react-router-dom": "^6.22.1",
3032
"react-toastify": "^10.0.4",
33+
"swiper": "^11.1.15",
3134
"vite": "^5.1.0"
3235
},
3336
"devDependencies": {

src/pages/Events/Card.jsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { useMemo } from "react";
2+
import PropTypes from "prop-types";
3+
import { images } from "../Gallery/Gallery";
4+
5+
const getRandomColor = () => {
6+
const r = Math.floor(Math.random() * 256);
7+
const g = Math.floor(Math.random() * 256);
8+
const b = Math.floor(Math.random() * 256);
9+
return `rgba(${r}, ${g}, ${b}, 0.3)`; // Add transparency for the glassmorphism effect
10+
};
11+
12+
function Card({ object }) {
13+
const imageSrc = object?.src || images[0]?.src;
14+
const imageAlt = object?.caption || images[0]?.caption;
15+
16+
const randomColor = useMemo(() => getRandomColor(), []);
17+
18+
return (
19+
<div className="relative inline-block w-full max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg h-[300px] overflow-hidden rounded-xl shadow-lg">
20+
<img
21+
src={imageSrc}
22+
alt={imageAlt}
23+
className="w-full h-full object-cover object-bottom rounded-t-xl"
24+
/>
25+
<div
26+
className="absolute bottom-0 w-full h-1/3 flex items-center justify-center backdrop-blur-md rounded-b-xl"
27+
style={{ backgroundColor: randomColor }}
28+
>
29+
<p className="text-white">{imageAlt}</p>
30+
</div>
31+
</div>
32+
);
33+
}
34+
35+
Card.propTypes = {
36+
object: PropTypes.shape({
37+
src: PropTypes.string,
38+
caption: PropTypes.string,
39+
}).isRequired,
40+
};
41+
42+
export default Card;

src/pages/Events/EventPage.jsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import Marquee from "react-fast-marquee";
2+
import Card from "./Card";
3+
import { images } from "../Gallery/Gallery";
4+
5+
function EventPage() {
6+
return (
7+
<div>
8+
<Marquee gradient={false} speed={50}>
9+
<p className="font-bold text-white mr-8">events</p>
10+
<p className="font-bold text-white mr-8">events</p>
11+
<p className="font-bold text-white mr-8">events</p>
12+
<p className="font-bold text-white mr-8">events</p>
13+
<p className="font-bold text-white mr-8">events</p>
14+
</Marquee>
15+
<div className="my-8 flex justify-center">
16+
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
17+
{images.map((image) => (
18+
<Card key={image.caption} object={image} />
19+
))}
20+
</div>
21+
</div>
22+
</div>
23+
);
24+
}
25+
26+
export default EventPage;

src/pages/Events/dependency.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
idk what im doing rn,
2+
these are some dependencies might need to configure server
3+
4+
5+
brew install pkg-config cairo pango libpng jpeg giflib librsvg

src/pages/Gallery/Gallery.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
22
import Heading from "@/components/Heading/index";
33
import PageTransition from "../../components/PageTransition";
44

5-
const images = [
5+
export const images = [
66
{
77
src: "/CodeX-Website/gallery/RUST SESSION/rs1.JPG",
88
caption: "Rust Session - Introduction to Rust",

src/routes/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Gallery from "@/pages/Gallery/Gallery";
55
import Contact from "@/pages/Contact";
66
import PageNotFound from "../pages/PageNotFound";
77
import Loader from "@/components/Loader";
8+
import EventPage from "../pages/Events/EventPage";
89

910
const routes = [
1011
{
@@ -37,6 +38,12 @@ const routes = [
3738
requireAuth: false,
3839
render: <Teams />,
3940
},
41+
{
42+
label: "Events",
43+
path: "/events",
44+
requireAuth: false,
45+
render: <EventPage />,
46+
},
4047
{
4148
label: "Home",
4249
path: "/",

0 commit comments

Comments
 (0)