Skip to content

Commit

Permalink
Fix formatting for four files
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaanthenerd committed Oct 15, 2024
1 parent 03d9eda commit 213d365
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 60 deletions.
4 changes: 3 additions & 1 deletion src/app/community/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ const Community = async () => {
<Header />
<div className="mx-6 h-full p-2">
<div className="pb-8">
<h1 className="text-2xl font-bold text-slate-500">Community Events</h1>
<h1 className="text-2xl font-bold text-slate-500">
Community Events
</h1>
<CommunityEvents events={events} />
</div>
<div className="pb-8">
Expand Down
8 changes: 4 additions & 4 deletions src/components/CommunityEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ type Event = SelectEvent & {
description: string;
image: string;
tags: string[];
approved: "approved" | "rejected" | "pending";
approved: 'approved' | 'rejected' | 'pending';
profileImage: string | null;
soc: boolean;
}
}
};
};

type Props = {
events: Event[];
}
};

const CommunityEvents = ({ events }: Props) => {
if (events.length == 0) {
Expand Down
6 changes: 1 addition & 5 deletions src/components/InfiniteScrollGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ export default function InfiniteScrollGrid({ session, tag }: Props) {
ref={isLastElement ? lastOrgElementRef : null}
key={club.id}
>
<ClubCard
club={club}
session={session}
priority={false}
/>
<ClubCard club={club} session={session} priority={false} />
</div>
);
}),
Expand Down
113 changes: 63 additions & 50 deletions src/components/OrgDirectoryCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,74 @@ import { LeftArrowIcon, RightArrowIcon } from '@src/icons/Icons';
import ClubCard from './club/ClubCard';

type Props = {
clubs: SelectClub[],
session?: Session
}
clubs: SelectClub[];
session?: Session;
};

const OrgDirectoryCarousel: FC<Props> = ({ clubs, session }) => {
const [currentIndex, setCurrentIndex] = useState(0);
const clubCard = useRef(null);
const clubCardElement: HTMLDivElement = clubCard.current!;
let clubCardWidth = 0;
if (clubCardElement) {
clubCardWidth = clubCardElement.scrollWidth;
}
const [currentIndex, setCurrentIndex] = useState(0);
const clubCard = useRef(null);
const clubCardElement: HTMLDivElement = clubCard.current!;
let clubCardWidth = 0;
if (clubCardElement) {
clubCardWidth = clubCardElement.scrollWidth;
}

function prev() {
setCurrentIndex(currentIndex - 1);
}
function prev() {
setCurrentIndex(currentIndex - 1);
}

function next() {
setCurrentIndex(currentIndex + 1);
}
function next() {
setCurrentIndex(currentIndex + 1);
}

if (session) {
return (
<div className="carousel-container w-full flex flex-col relative">
{
<div className="buttons flex justify-between pt-4 pb-8">
{currentIndex > 0 &&
<button onClick={prev} className="left-arrow bg-white absolute left-0 p-2">
<LeftArrowIcon fill={"black"}/>
</button>
}
{currentIndex < clubs.length - 1 &&
<button onClick={next} className="right-arrow bg-white absolute right-0 p-2">
<RightArrowIcon fill={"black"}/>
</button>
}
</div>
}
<div className="carousel-wrapper flex w-full relative">
<div className="carousel-content-wrapper overflow-hidden w-full h-full">
<div
className="carousel-content flex w-full flex-shrink-0 flex-grow transition ease-in-out duration-500"
style={{ transform: `translateX(-${currentIndex * clubCardWidth}px)` }}
>
{clubs.map((club) => (
<div className="pr-8 py-8" key={club.id} ref={clubCard}>
<ClubCard key={club.id} club={club} session={session} priority />
</div>
))}
</div>
</div>
if (session) {
return (
<div className="carousel-container relative flex w-full flex-col">
{
<div className="buttons flex justify-between pb-8 pt-4">
{currentIndex > 0 && (
<button
onClick={prev}
className="left-arrow absolute left-0 bg-white p-2"
>
<LeftArrowIcon fill={'black'} />
</button>
)}
{currentIndex < clubs.length - 1 && (
<button
onClick={next}
className="right-arrow absolute right-0 bg-white p-2"
>
<RightArrowIcon fill={'black'} />
</button>
)}
</div>
}
<div className="carousel-wrapper relative flex w-full">
<div className="carousel-content-wrapper h-full w-full overflow-hidden">
<div
className="carousel-content flex w-full flex-shrink-0 flex-grow transition duration-500 ease-in-out"
style={{
transform: `translateX(-${currentIndex * clubCardWidth}px)`,
}}
>
{clubs.map((club) => (
<div className="py-8 pr-8" key={club.id} ref={clubCard}>
<ClubCard
key={club.id}
club={club}
session={session}
priority
/>
</div>
))}
</div>
)
}
}
</div>
</div>
</div>
);
}
};

export default OrgDirectoryCarousel;
export default OrgDirectoryCarousel;

0 comments on commit 213d365

Please sign in to comment.