Skip to content

Commit

Permalink
Community Image components added. Update community images through con…
Browse files Browse the repository at this point in the history
…fig/communityImages.json
  • Loading branch information
izzyg770 committed Jul 10, 2024
1 parent 104dc03 commit 54c2608
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
23 changes: 23 additions & 0 deletions components/communityImages.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Image from 'next/image';

export default function CommunityImages({ images, basePath }) {
return (
<div className="flex flex-col sm:flex-row items-center mx-auto max-w-6xl">
{images.map((image, index) => (
<div key={index} className="w-full sm:w-1/2 mx-4 mb-6 flex flex-col justify-center items-center">
<p className="text-base mt-2">{image.name}</p>
<Image
width={500}
height={500}
src={
basePath
? `${basePath}/images/community/${image.image}`
: `/images/community/${image.image}`
}
alt={image.name}
/>
</div>
))}
</div>
);
}
11 changes: 11 additions & 0 deletions config/communityImages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"name": "WN24 Project Expo",
"image": "WN24_EXPO.JPG"
},
{
"name": "WN24 Data Science Night",
"image": "WN24_DSN.JPG"
}
]

32 changes: 5 additions & 27 deletions pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import SponsorSection from "@/components/sponsorSection";
import Timeline from "@/components/timeline";
import Wave from "@/components/wave";
import Wave180 from "@/components/wave180";
import CommunityImages from "@/components/communityImages";
import loadStaticData from "@/shared/static";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
import { useState } from "react";

export default function Home({ sponsors, projects, timeline }) {
export default function Home({ sponsors, projects, timeline, communityImages }) {
sponsors[0].tier = "MDST is made possible by our sponsors";
const router = useRouter();
const basePath = router.basePath;
Expand Down Expand Up @@ -119,7 +120,7 @@ export default function Home({ sponsors, projects, timeline }) {
</div>
</div>
<Carousel projects={projects} basePath={basePath} />
<CommunityImages basePath={basePath} />
<CommunityImages basePath={basePath} images={communityImages} />
<div className="container mx-auto px-2 mt-8">
<h2 className="text-3xl text-center">
MDST is proudly supported by our sponsors
Expand Down Expand Up @@ -151,30 +152,6 @@ function ProjectCard({ json, basePath }) {
</Link>
);
}
function CommunityImages({ basePath }) {
return (
<div className="flex flex-col sm:flex-row items-center mx-auto max-w-6xl">
<div className="w-full sm:w-1/2 mx-4 mb-6 flex flex-col justify-center items-center">
<p className="text-base mt-2">WN24 Project Expo</p>
<Image
src={`${basePath}/images/community/WN24_EXPO.JPG`}
alt="Image 1"
width={500}
height={500}
/>
</div>
<div className="w-full sm:w-1/2 mx-4 mb-6 flex flex-col justify-center items-center">
<p className="text-base mt-2">WN24 Data Science Night</p>
<Image
src={`${basePath}/images/community/WN24_DSN.JPG`}
alt="Image 2"
width={500}
height={500}
/>
</div>
</div>
);
}

function Factbox({ fact, closer }) {
return (
Expand Down Expand Up @@ -243,6 +220,7 @@ export async function getStaticProps() {
const sponsors = loadStaticData("sponsors.json");
const projects = loadStaticData("homepage.json");
const timeline = loadStaticData("timeline.json");
const communityImages = loadStaticData("communityImages.json");

return { props: { sponsors, projects, timeline } };
return { props: { sponsors, projects, timeline, communityImages } };
}

0 comments on commit 54c2608

Please sign in to comment.