Skip to content

Commit ac15857

Browse files
authored
Merge pull request #42 from codeXsit/Codex-3-events
Codex 3 events
2 parents 46fbf99 + e861c73 commit ac15857

File tree

11 files changed

+182
-2
lines changed

11 files changed

+182
-2
lines changed

src/App.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const navLinks = [
1111
{ name: "Our Team", path: "/teams" },
1212
{ name: "Events", path: "/events" },
1313
{ name: "Gallery", path: "/gallery" },
14+
{ name: "Events", path: "/events" },
1415
{ name: "Contact", path: "/contact" },
1516
{ name: "Community", path: "/community" },
1617
];
105 KB
Loading
58.9 KB
Loading
157 KB
Loading
55.9 KB
Loading

src/assets/styles/index.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,18 @@ a {
2727
-webkit-text-stroke-width: 2px;
2828
-webkit-text-stroke-color: #737373;
2929
}
30+
31+
.words {
32+
position: relative;
33+
animation: move-words 25s linear infinite;
34+
margin: 0;
35+
}
36+
37+
@keyframes move-words {
38+
0% {
39+
left: 100%;
40+
}
41+
100% {
42+
left: -100%;
43+
}
44+
}

src/components/Navbar/index.jsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,15 @@ function Navbar({ links }) {
5050
<li
5151
key={link.name}
5252
className={`
53-
group font-regular text-white md:my-0 md:ml-8 transition-all hover:text-primary
53+
font-semibold text-white md:my-0 md:ml-8
54+
border-b-2
55+
${
56+
location.pathname
57+
.toLowerCase()
58+
.includes(link.path.toLowerCase())
59+
? "border-red-500 hover:border-red-700"
60+
: "border-transparent hover:border-red-500"
61+
}
5462
`}
5563
>
5664
<Link to={link.path}>{link.name}</Link>
@@ -65,7 +73,18 @@ function Navbar({ links }) {
6573
/>
6674
</li>
6775
))}
68-
</ul>
76+
</ul>
77+
<button
78+
type="button"
79+
onClick={() => setIsOpen(!isOpen)}
80+
className="w-7 h-7 text-white cursor-pointer md:hidden"
81+
>
82+
{isOpen ? (
83+
<img src={closeIcon} alt="close" />
84+
) : (
85+
<img src={menuIcon} alt="menu" />
86+
)}
87+
</button>
6988
</nav>
7089
);
7190
}

src/pages/Events/card.jsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { useState, useEffect } from "react";
2+
import { Link } from "react-router-dom";
3+
import PropTypes from "prop-types";
4+
5+
function Card({ event }) {
6+
const [truncatedText, setTruncatedText] = useState("");
7+
const maxLength = 25; // Maximum number of words
8+
9+
useEffect(() => {
10+
const text = event.description;
11+
const words = text.split(" ");
12+
13+
if (words.length > maxLength) {
14+
setTruncatedText(words.slice(0, maxLength).join(" "));
15+
} else {
16+
setTruncatedText(text);
17+
}
18+
}, []);
19+
return (
20+
<div className=" shadow-lg bg-zinc-600 rounded-2xl max-w-96 h-[30rem] relative">
21+
<img
22+
className="w-mag rounded-se-2xl rounded-ss-2xl"
23+
src={`${event.image}`}
24+
alt={event.alt}
25+
/>
26+
<div className="content-box px-4 pt-2">
27+
<p className="py-1 font-medium text-white break-words">{event.name}</p>
28+
<p className="date font-thin py-2 pr-3 text-zinc-400">{event.date}</p>
29+
<p className="description text-white font-light ">{truncatedText}</p>
30+
</div>
31+
<Link
32+
to={event.link}
33+
className="absolute bottom-0 left-0 right-0 text-center tracking-widest font-thin drop-shadow-lg text-white py-7 hover:text-red-600"
34+
>
35+
READ MORE
36+
</Link>
37+
</div>
38+
);
39+
}
40+
Card.propTypes = {
41+
event: PropTypes.object.isRequired,
42+
};
43+
44+
export default Card;

src/pages/Events/events.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[
2+
{
3+
"name": "Event1",
4+
"date": "12/12/24",
5+
"description": "lorem ipsum dolor ",
6+
"image": "/CodeX-Website/src/assets/images/Events/image1.jpg",
7+
"link":"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
8+
"alt":"event1-image"
9+
10+
},
11+
{
12+
"name": "Event2",
13+
"date": "13/12/24",
14+
"description": "lorem ipsum dolor ",
15+
"image": "/CodeX-Website/src/assets/images/Events/image2.jpg",
16+
"link":"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
17+
"alt":"event2-image"
18+
19+
},
20+
{
21+
"name": "Event3",
22+
"date": "14/12/24",
23+
"description": "lorem ipsum dolor ",
24+
"image": "/CodeX-Website/src/assets/images/Events/image3.jpg",
25+
"link":"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
26+
"alt":"event3-image"
27+
28+
},
29+
{
30+
"name": "Event4",
31+
"date": "15/12/24",
32+
"description": "lorem ipsum dolor ",
33+
"image": "/CodeX-Website/src/assets/images/Events/image4.jpg",
34+
"link":"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
35+
"alt":"event4-image"
36+
37+
}
38+
]

src/pages/Events/index.jsx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// import { useState, useEffect } from "react";
2+
import Card from "./card";
3+
import events from "./events.json";
4+
5+
function EventPage() {
6+
const borderStyle = {
7+
color: "transparent",
8+
WebkitTextStrokeWidth: "0.5px",
9+
WebkitTextStrokeColor: "white",
10+
};
11+
// const [events, setEvent] = useState([]);
12+
13+
// useEffect(() => {
14+
// setEvent(events);
15+
// }, []);
16+
return (
17+
<div className="">
18+
<div className=" flex flex-row flex-nowrap w-full overflow-hidden ">
19+
<p
20+
className="text-white text-7xl py-10 font-extrabold inline-block px-1 words"
21+
style={borderStyle}
22+
>
23+
EVENTS
24+
</p>
25+
<p className="text-white text-7xl py-10 font-extrabold inline-block px-2 words">
26+
{" "}
27+
EVENTS
28+
</p>
29+
<p
30+
className="text-white text-7xl py-10 font-extrabold inline-block px-2 words"
31+
style={borderStyle}
32+
>
33+
EVENTS
34+
</p>
35+
<p className="text-white text-7xl py-10 font-extrabold inline-block px-2 words">
36+
{" "}
37+
EVENTS
38+
</p>
39+
<p
40+
className="text-white text-7xl py-10 font-extrabold inline-block px-2 words"
41+
style={borderStyle}
42+
>
43+
EVENTS
44+
</p>
45+
</div>
46+
<div className=" flex flex-wrap gap-10 justify-center align-items py-10">
47+
{/* Add enough content to exceed the width of the container */}
48+
{events.map((event) => (
49+
<Card key={event.name} event={event} />
50+
))}
51+
</div>
52+
</div>
53+
);
54+
}
55+
56+
export default EventPage;

0 commit comments

Comments
 (0)