Skip to content

Conversation

CrownDestro
Copy link

Description: reusable custom hooks

Changes included:

Extracted Scroll and animation variants that are reused into useScrollRef.js & useAnimationVariants.js as hooks.
New custom hooks created:
useScrollDirection (for Navbar)
useNavbarColor (for Navbar)
useDrawerState (for MenuDrawer)
useResponsiveGrid (for MembersAndAlumni)

Assets updated: Updated Dheeraj_M’s image in public/assets/members/Secondyears.

Notes:
This PR addresses #18 .

Copy link

vercel bot commented Oct 19, 2025

@CrownDestro is attempting to deploy a commit to the amFOSS Dev Team on Vercel.

A member of the Team first needs to authorize it.

@KKSurendran06 KKSurendran06 requested a review from Copilot October 20, 2025 14:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors inline logic into reusable custom hooks to improve code maintainability and reduce duplication across components. The changes extract scroll behavior, animation variants, drawer state, and responsive grid logic into dedicated hooks.

Key changes:

  • Created six custom hooks: useScrollRef, useScrollDirection, useNavbarColor, useDrawerState, useResponsiveGrid, and useAnimationVariants
  • Updated components (Navbar, MembersAndAlumni) and page components (home, about, team, story, gallery, clublife, achievements) to use the new hooks
  • Renamed data import to clubLifeData in clublife page for clarity

Reviewed Changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/hooks/useScrollRef.js New hook that provides a scrollRef
lib/hooks/useScrollDirection.js Extracts scroll direction detection logic from Navbar
lib/hooks/useResponsiveGrid.js Extracts responsive grid logic from MembersAndAlumni
lib/hooks/useNavbarColor.js Extracts navbar color logic from Navbar
lib/hooks/useDrawerState.js Extracts drawer state management from Navbar
lib/hooks/useAnimationVariants.js Extracts animation variants definitions into reusable hook
components/shared/Navbar.jsx Refactored to use new custom hooks
components/team/membersAndAlumni.jsx Refactored to use useResponsiveGrid hook
app/(root)/team/page.jsx Uses useScrollRef and useAnimationVariants hooks
app/(root)/story/page.jsx Uses useScrollRef hook
app/(root)/gallery/page.jsx Uses useScrollRef hook
app/(root)/clublife/page.jsx Uses new hooks and renames component/imports
app/(root)/achievements/page.jsx Uses useScrollRef hook
app/(root)/about/page.jsx Uses useScrollRef hook
app/(root)/(home)/page.jsx Uses useScrollRef and useAnimationVariants hooks

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

setHidden(false);
}

if (isDrawerOpen && window.innerHeight > 424) {
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 424 should be extracted as a named constant (e.g., MIN_DRAWER_CLOSE_HEIGHT) to improve code clarity and maintainability.

Copilot uses AI. Check for mistakes.

Comment on lines +16 to +18
if (latest + 93 <= window.innerHeight && prevNavColor === true) {
return false;
} else if (latest + 93 > window.innerHeight && prevNavColor === false) {
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic number 93 (appears to be navbar height offset) should be extracted as a named constant (e.g., NAVBAR_HEIGHT_OFFSET) to improve code clarity and maintainability.

Copilot uses AI. Check for mistakes.

Comment on lines +23 to +24
clubLife1Variants: clubLife1Varients,
clubLife2Variants: clubLife2Varients,
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The destructured properties clubLife1Variants and clubLife2Variants do not exist in the useAnimationVariants hook. Based on the hook's implementation, these should be slideInRightVariant and slideInLeftVariant respectively.

Suggested change
clubLife1Variants: clubLife1Varients,
clubLife2Variants: clubLife2Varients,
slideInRightVariant: clubLife1Varients,
slideInLeftVariant: clubLife2Varients,

Copilot uses AI. Check for mistakes.

const {
clubLife1Variants: clubLife1Varients,
clubLife2Variants: clubLife2Varients,
imageVariants: imageVarients,
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'imageVarients' to 'imageVariants'.

Suggested change
imageVariants: imageVarients,
imageVariants,

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant