Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-Side Code update in page.js code file. #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/app/page.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
"use client";

import React, { useEffect } from "react";
import Navbar from "@/components/Navbar";
import Links from "../components/Links";

export default function Home() {
// Function to scroll to the section
const scrollToSection = () => {
const section = document.getElementById("more-section");
if (section) {
section.scrollIntoView({ behavior: "smooth" });
setTimeout(() => {
// this method is used to move down the nav when clicked on button.
// Adjusts the scroll position slightly after the scroll
window.scrollBy({
top: -1,
behavior: "smooth",
Expand All @@ -18,6 +20,12 @@ export default function Home() {
}
};

// Ensure the DOM is accessible after mounting
useEffect(() => {
const section = document.getElementById("more-section");
// You can add logic here if needed for the section element
}, []);

return (
<>
<Navbar />
Expand Down Expand Up @@ -51,7 +59,7 @@ export default function Home() {
<h2 className="text-3xl sm:text-4xl font-bold text-gray-800">
Welcome to the next section!
</h2>
<Links></Links>
<Links />
<p className="text-lg sm:text-xl text-gray-600">
Here&apos;s more information about GDG-BU and what we do.
</p>
Expand Down