diff --git a/public/webContent.json b/public/webContent.json new file mode 100644 index 0000000..4c6d239 --- /dev/null +++ b/public/webContent.json @@ -0,0 +1,7 @@ +{ + "landing": { + "cet_overview": "Founded in 1939, College of Engineering, Trivandrum (CET) is Kerala's first engineering college, established during the reign of Sri Chithira Thirunal Balarama Varma. Initially started with 21 students in Civil, Mechanical, and Electrical Engineering, CET moved to its expansive 125-acre campus in 1960 and is now managed by the Kerala Government.", + "cse_overview": "Established in 1984, the Computer Science and Engineering (CSE) department is known for its academic excellence and strong placement records. With 21 faculty members and a top student intake, CSE has a legacy of producing skilled engineers with alumni holding prominent positions globally in industry, academia, and research." + } + } + \ No newline at end of file diff --git a/src/pages/landing.tsx b/src/pages/landing.tsx index 3169834..38a92b8 100644 --- a/src/pages/landing.tsx +++ b/src/pages/landing.tsx @@ -1,90 +1,120 @@ "use client"; import "../app/globals.css"; -import Image from 'next/image'; -import sampleDepartmentImage from '../app/assets/images/sampleDepartmentImage.svg'; -import landingImg1 from '../app/assets/images/landingImg1.svg'; -import landingImg2 from '../app/assets/images/landingImg2.svg'; -import { useState, useEffect } from 'react'; +import Image from "next/image"; +import sampleDepartmentImage from "../app/assets/images/sampleDepartmentImage.svg"; +import landingImg1 from "../app/assets/images/landingImg1.svg"; +import landingImg2 from "../app/assets/images/landingImg2.svg"; +import { useState, useEffect } from "react"; -export default function Landing() { +type landingPageContent = { + cet_overview: string; + cse_overview: string; +}; +export default function Landing() { + const [currentImage, setCurrentImage] = useState(0); + const images = [sampleDepartmentImage, landingImg1]; + const [data, setData] = useState({ + cet_overview: "", + cse_overview: "", + }); - const [currentImage, setCurrentImage] = useState(0); - const images = [sampleDepartmentImage, landingImg1]; + useEffect(() => { + // Fetch JSON data from the public folder + fetch("/webContent.json") + .then((response) => response.json()) + .then((jsonData) => setData(jsonData.landing)) + .catch((error) => console.error("Error fetching JSON:", error)); + }, []); - useEffect(() => { - const imageSwitchInterval = setInterval(() => { - setCurrentImage((prevIndex) => (prevIndex + 1) % images.length); - }, 2000); + useEffect(() => { + const imageSwitchInterval = setInterval(() => { + setCurrentImage((prevIndex) => (prevIndex + 1) % images.length); + }, 2000); - return () => clearInterval(imageSwitchInterval); - }, []); + return () => clearInterval(imageSwitchInterval); + }, []); - const submitQUery = (e: React.FormEvent) => { - e.preventDefault(); - alert("Query submitted!"); - }; + const submitQUery = (e: React.FormEvent) => { + e.preventDefault(); + alert("Query submitted!"); + }; - return ( -
-
-
-
-

CS ASSOCIATION

-

Department of Computer Science

-
-
- -
-
- College of Engineering Trivandrum -
-
-
- Department of Computer Science -
-

Department of Computer Science

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. -

-
-
-
-
-

College Of Engineering Trivandrum

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. -

-
- Department of Computer Science -
+ return ( +
+
+
+
+

+ CS ASSOCIATION +

+

+ Department of Computer Science +

+
+
+ +
+
+ College of Engineering Trivandrum +
+
+
+ Department of Computer Science +
+

Department of Computer Science

+

{data.cse_overview}

+
+
+
+
+

+ College Of Engineering Trivandrum +

+

{data.cet_overview}

+
+ Department of Computer Science +
-
-
-
Do you have any queries?
-
- - -
-
-
+
+
+
+ Do you have any queries? +
+
+ + +
- ); +
+
+ ); }