Skip to content

Commit e1b0782

Browse files
authored
Merge pull request #20 from NepTechTribe/new
Past event section completed
2 parents ec9c17a + d8d2c04 commit e1b0782

File tree

5 files changed

+84
-5
lines changed

5 files changed

+84
-5
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import Title from "./title";
2+
import Container from "react-bootstrap/Container";
3+
import Row from "react-bootstrap/Row";
4+
import Col from "react-bootstrap/Col";
5+
import eventimg from "../../assets/LandingPage/pr-1.jpg";
6+
import Button from "./button";
7+
import { ChevronLeft, ChevronRight } from "react-bootstrap-icons";
8+
import React, { useState, useEffect } from "react";
9+
10+
function PastEvent() {
11+
const PastEventArray = [
12+
{ title: "event title 1", image: eventimg },
13+
{ title: "event title 2", image: eventimg },
14+
{ title: "event title 3", image: eventimg },
15+
{ title: "event title 4", image: eventimg },
16+
{ title: "event title 5", image: eventimg },
17+
{ title: "event title 6", image: eventimg },
18+
{ title: "event title 7", image: eventimg },
19+
{ title: "event title 8", image: eventimg },
20+
];
21+
22+
const [currentIndex, setCurrentIndex] = useState(0);
23+
const itemsToShow = 4;
24+
25+
const getVisibleItems = () => {
26+
return Array.from({ length: itemsToShow }, (_, i) => {
27+
const index = (currentIndex + i) % PastEventArray.length;
28+
return PastEventArray[index];
29+
});
30+
};
31+
32+
const handleNavigation = (direction) => {
33+
setCurrentIndex((prevIndex) => {
34+
const newIndex = (prevIndex + direction + PastEventArray.length) % PastEventArray.length;
35+
return newIndex;
36+
});
37+
};
38+
39+
40+
const visibleItems = getVisibleItems();
41+
42+
const prevItem = () => handleNavigation(-itemsToShow);
43+
const nextItem = () => handleNavigation(itemsToShow);
44+
45+
return (
46+
<div style={{ display: 'flex', alignItems: 'center' }}>
47+
<button onClick={prevItem} className="herobutton" disabled={currentIndex === 0}>
48+
<ChevronLeft />
49+
</button>
50+
<Container>
51+
<Title title={"GALLERY"} head={"Sneak Peek From Past Events"} />
52+
<Row>
53+
{visibleItems.map((item, index) => (
54+
<Col md={3} key={index} className="Announcement-individual">
55+
<img src={item.image} className="Announcement-individual__image" alt={`image of ${item.title}`} />
56+
<div style={{ padding: '1rem 0rem' }}>
57+
<h2 className="Announcement-individual__title">{item.title}</h2>
58+
</div>
59+
<Button buttontext={"View More"} buttonclass={"eventbutton"} />
60+
</Col>
61+
))}
62+
</Row>
63+
</Container>
64+
<button onClick={nextItem} className="herobutton" disabled={currentIndex + itemsToShow >= PastEventArray.length}>
65+
<ChevronRight />
66+
</button>
67+
</div>
68+
);
69+
}
70+
71+
export default PastEvent;

src/Pages/Landingpage.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Hero from "../Components/landingpage/hero";
33
import AboutUs from "../Components/landingpage/about";
44
import Programs from "../Components/landingpage/programs";
55
import Announcement from "../Components/landingpage/announcement";
6+
import PastEvent from "../Components/landingpage/pastevent";
67

78
function LandingPage(){
89
return(
@@ -12,6 +13,7 @@ function LandingPage(){
1213
<AboutUs/>
1314
<Programs/>
1415
<Announcement/>
16+
<PastEvent/>
1517
</>
1618
)
1719
}

src/Styles/App.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@
7373
}
7474

7575
.eventbutton {
76-
padding: 0rem;
76+
padding: 0.5rem 0.5rem;
7777
background-color: transparent;
7878
color: black;
7979
font-weight: 400;
80-
height: 1rem;
80+
height: 3rem;
81+
}
82+
.eventbutton:hover {
83+
border: 1px solid #000080;
8184
}
8285

8386
.Head {

src/Styles/App.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Styles/LandingPage/_Button.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222

2323
.eventbutton{
2424
@extend .herobutton;
25-
padding: 0rem;
25+
padding: 0.5rem 0.5rem;
2626
background-color: transparent;
2727
color: black;
2828
font-weight: 400;
29-
height: 1rem;
29+
height: 3rem;
30+
&:hover{
31+
border: 1px solid #000080 ;
32+
}
3033
}

0 commit comments

Comments
 (0)