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

fix menu background on non-scrollable page #63

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Conversation

IvanKiral
Copy link
Contributor

Motivation

Which issue does this fix? Fixes #62

If no issue exists, what is the fix or new feature? Were there any reasons to fix/implement things that are not obvious?

Checklist

  • Code follows coding conventions held in this repo
  • Automated tests have been added
  • Tests are passing
  • Docs have been updated (if applicable)
  • Temporary settings (e.g. variables used during development and testing) have been reverted to defaults

How to test

If manual testing is required, what are the steps?

@IvanKiral IvanKiral requested a review from a team as a code owner April 30, 2024 10:58
Copy link

vercel bot commented Apr 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ficto-healthtech ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 11:53am
ficto-healthtech-qa ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 11:53am
ficto-imaging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 11:53am
ficto-imaging-qa ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 11:53am
ficto-surgical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 11:53am
ficto-surgical-qa ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 11:53am

Copy link

netlify bot commented Apr 30, 2024

Deploy Preview for new-sample-app ready!

Name Link
🔨 Latest commit d21f927
🔍 Latest deploy log https://app.netlify.com/sites/new-sample-app/deploys/66795d2b0f968500088e6d79
😎 Deploy Preview https://deploy-preview-63--new-sample-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


const handleMenuClick = (menuId: string | number): void => {
setActiveMenu(menuId === activeMenu ? -1 : menuId);
};

useEffect(() => {
// set is scrolled to show the menu when scrolling is not possible
setIsScrolled(document.body.scrollHeight <= window.innerHeight);
Copy link
Member

Choose a reason for hiding this comment

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

I don't like mixing the two concepts. You claim that when the page is too short to be scrolled that the page in fact is scrolled with setting this flag to true. I would prefer having a separate constant (ideally not a state, but a memoized constant created during render) indicating whether the page is scrollable or not.

useEffect(() => {
// set is scrolled to show the menu when scrolling is not possible
setIsScrolled(document.body.scrollHeight <= window.innerHeight);
}, [router]);
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need the router here? The component doesn't re-mount on navigating somewhere else? Also why do you use the whole router project as a dependency, isn't just the path property enough?

@IvanKiral IvanKiral merged commit b35841a into main Jun 25, 2024
12 checks passed
@IvanKiral IvanKiral deleted the fix_menu_empty_page branch June 25, 2024 06:35
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.

FICTO IMAGING - content disapears when clicked combined solutions
2 participants