Skip to content

Commit cfbda44

Browse files
committed
Fixed president Carousel buttons and removed presidentavatar
1 parent 31196ae commit cfbda44

File tree

6 files changed

+71
-42
lines changed

6 files changed

+71
-42
lines changed

components/Avatar.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@ import FontAwesomeLink from './FontAwesomeLink';
44

55
const PROFILE_CONTAINER = 'flex flex-col items-center m-10';
66

7-
const Avatar = ({ name, linkedin, position, pfp, classes, prevRole, profileContainerClasses = '' }) => {
7+
const Avatar = ({ name, linkedin, position, pfp, classes, prevRole, currRole, profileContainerClasses = '' }) => {
88
const img = 'https:' + pfp.fields.file.url;
9+
const isPresidentAvatar = String(classes).includes("president-avatar");
910
return (
1011
<div className={`${PROFILE_CONTAINER} ${profileContainerClasses}`}>
1112
<div className={`w-28 h-28 sm:w-48 sm:h-48 rounded-full relative overflow-hidden`}>
1213
<Image src={img} alt={name} layout="fill" objectFit="contain" unoptimized={true} />
1314
</div>
1415
<h2 className={`text-[#7055FD] text-xs sm:text-base font-semibold mt-3 ${classes}`}>{name}</h2>
1516
<h2 className={`text-[#7055FD] text-xs sm:text-base font-medium mb-2 ${classes}`}>{position}</h2>
16-
{prevRole && (
17+
{isPresidentAvatar && (
18+
<h2
19+
className={`text-[#7055FD] w-28 text-center text-xs sm:text-base hidden sm:block font-medium mb-2 ${classes}`}
20+
>
21+
{currRole}
22+
</h2>
23+
)}
24+
{(prevRole && !isPresidentAvatar) && (
1725
<h2
1826
className={`text-[#7055FD] w-28 text-center text-xs sm:text-base hidden sm:block font-medium mb-2 ${classes}`}
1927
>

components/Carousel.jsx

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,60 @@ import { Navigation, Pagination } from "swiper";
33
import "swiper/css";
44
import "swiper/css/effect-cards";
55
import "swiper/css/pagination";
6+
import { useRef } from "react";
67

78
const SPACE_BETWEEN_ELEMENTS = 50;
89

9-
const Carousel = (props) => {
10+
const Carousel = ({ children, className='', ...props }) => {
11+
const isPresidentCarousel = String(className).includes("president-carousel");
12+
const prevRef = useRef(null);
13+
const nextRef = useRef(null);
14+
15+
if (isPresidentCarousel) {
16+
return (
17+
<div className="relative w-full flex items-center justify-center">
18+
{/* Custom Navigation Buttons */}
19+
<button
20+
ref={prevRef}
21+
className="absolute z-10 left-[-2rem] md:left-[-4rem] top-1/2 -translate-y-1/2"
22+
>
23+
<div className="swiper-button-prev"></div>
24+
</button>
25+
<button
26+
ref={nextRef}
27+
className="absolute z-10 right-[-2rem] md:right-[-4rem] top-1/2 -translate-y-1/2"
28+
>
29+
<div className="swiper-button-next"></div>
30+
</button>
31+
32+
<Swiper
33+
style={{
34+
"--swiper-navigation-color": "#FFF",
35+
"--swiper-navigation-size": "25px",
36+
"--swiper-pagination-color": "#FFF",
37+
}}
38+
modules={[Navigation, Pagination]}
39+
navigation={{
40+
prevEl: prevRef.current,
41+
nextEl: nextRef.current,
42+
}}
43+
onBeforeInit={(swiper) => {
44+
swiper.params.navigation.prevEl = prevRef.current;
45+
swiper.params.navigation.nextEl = nextRef.current;
46+
}}
47+
pagination={{ clickable: true }}
48+
spaceBetween={SPACE_BETWEEN_ELEMENTS}
49+
className={`mySwiper ${className}`}
50+
{...props}
51+
>
52+
{children.map((child, index) => (
53+
<SwiperSlide key={index}>{child}</SwiperSlide>
54+
))}
55+
</Swiper>
56+
</div>
57+
);
58+
}
59+
1060
return (
1161
<Swiper
1262
style={{
@@ -21,7 +71,7 @@ const Carousel = (props) => {
2171
className="mySwiper"
2272
{...props}
2373
>
24-
{props.children.map((child, index) => (
74+
{children.map((child, index) => (
2575
<SwiperSlide key={index}>{child}</SwiperSlide>
2676
))}
2777
</Swiper>

components/CoPresident.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SwiperSlide } from 'swiper/react';
33
import Carousel from './Carousel';
44
import 'swiper/css';
55
import 'swiper/css/navigation';
6-
import Avatar from './PresidentAvatar';
6+
import Avatar from './Avatar';
77
const CAROUSEL_CONTAINER = 'president-carousel text-white rounded-lg w-[20rem] h-full md:w-4/5 swiper-button-white flex justify-center items-center';
88
const PRESIDENT_TILE =
99
'bg-[#A689FF] bg-opacity-50 w-[20rem] h-[70rem] md:h-[25rem] rounded-lg items-center p-14 lg:p-10 flex flex-col md:w-4/5 md:flex-row';
@@ -24,7 +24,7 @@ const President = [[{
2424
}
2525
}
2626
},
27-
classes: "text-[#7055FD]",
27+
classes: "text-[#7055FD] president-avatar !mb-0",
2828
},
2929
{
3030
name: "John Doe",
@@ -40,7 +40,7 @@ const President = [[{
4040
}
4141
}
4242
},
43-
classes: "text-[#7055FD]",
43+
classes: "text-[#7055FD] president-avatar !mb-0",
4444
}
4545
],
4646
[{
@@ -57,7 +57,7 @@ const President = [[{
5757
}
5858
}
5959
},
60-
classes: "text-[#7055FD]",
60+
classes: "text-[#7055FD] president-avatar !mb-0",
6161
},
6262
]];
6363

@@ -77,7 +77,7 @@ const PresidentTile = ({ name, linkedin, pfp, classes, testimonial, position, cu
7777
const CoPresident = () => {
7878
return (
7979
<div className={CAROUSEL_CONTAINER}>
80-
<Carousel>
80+
<Carousel className='president-carousel'>
8181
{President.map((president) => (
8282
<SwiperSlide key={president[0].name}>
8383
<div className='bg-white w-full rounded-3xl h-full flex flex-col justify-center items-center gap-10 py-20'>

components/PresidentAvatar.jsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

pages/our-team/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import UnderConstruction from '../../components/UnderConstruction';
2-
import AlumniSection from '../../components/AlumniSection';
32

43
const OurTeam = () => {
54
return (
65
<div>
76
{/* <MeetOurTeam />
87
<InternalTeam />
9-
<TechnicalTeam /> */}
10-
<AlumniSection />
8+
<TechnicalTeam />
9+
<AlumniSection /> */}
1110
<UnderConstruction />
1211
</div>
1312
);

styles/globals.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
}
4545

4646
.president-carousel .swiper-button-next {
47-
right: 0px;
47+
color: white;
4848
}
4949

5050
.president-carousel .swiper-button-prev {
51-
left: 0px;
51+
color: white;
5252
}

0 commit comments

Comments
 (0)