Skip to content

Conversation

@HeleneSelvig
Copy link
Contributor

This pull request updates the navigation tab component in src/routes/_home.tsx to improve the active tab indicator. Instead of each tab rendering its own indicator, a single animated indicator is now rendered based on the active route, resulting in smoother transitions and cleaner code. The implementation leverages React hooks and refs to track tab positions and animate the indicator.

Navigation Tab Indicator Improvements:

  • Added a single, animated active tab indicator using motion.div, which smoothly transitions its position and width based on the active route. This replaces the previous approach where each tab rendered its own indicator.
  • Introduced useLayoutEffect, useRef, and useState to track the position and width of the active tab and update the indicator accordingly.
  • Modified the NavLink rendering to attach refs for measuring tab positions and removed the per-tab indicator logic.
  • Added imports for the new hooks and useLocation from react-router to support the new indicator logic.

refactored home to not use shared layout for navtabs by adding a useLayoutEffect
run pnpm biome format --write src/routes/_home.tsx to fix formatting for a clean pnpm check
@HeleneSelvig HeleneSelvig linked an issue Feb 9, 2026 that may be closed by this pull request
@netlify
Copy link

netlify bot commented Feb 9, 2026

Deploy Preview for vektorprogrammet-homepage failed.

Name Link
🔨 Latest commit d154fb9
🔍 Latest deploy log https://app.netlify.com/projects/vektorprogrammet-homepage/deploys/698a1464c8aa1800086166ec

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

Copy link
Contributor

@perhsolheim perhsolheim left a comment

Choose a reason for hiding this comment

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

Looks good to me chief

@perhsolheim perhsolheim enabled auto-merge February 9, 2026 17:47
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 9, 2026

Deploying homepage with  Cloudflare Pages  Cloudflare Pages

Latest commit: d154fb9
Status: ✅  Deploy successful!
Preview URL: https://721dece4.homepage-dl3.pages.dev
Branch Preview URL: https://550-fix-bug-with-selected-ta.homepage-dl3.pages.dev

View logs

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.

Fix bug with selected tab on page scroll

2 participants