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

Refactor(frontend): scrollbar #77

Merged
merged 5 commits into from
Feb 10, 2025
Merged

Conversation

alcercu
Copy link
Collaborator

@alcercu alcercu commented Feb 10, 2025

Summary by CodeRabbit

  • Chores

    • Updated dependencies by adding a new package and removing two that were no longer needed.
  • New Features

    • Enhanced mobile navigation by implementing body scroll locking when the mobile menu is open.
  • Refactor

    • Streamlined the overall layout by removing custom scroll wrappers and simplifying component structure.
  • Style

    • Refined scrollbar appearance and adjusted maximum width settings for various components to improve responsiveness and visual consistency.

Copy link
Contributor

coderabbitai bot commented Feb 10, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update modifies several frontend files. The package file now adds a new dependency and removes two obsolete ones. The layout now renders with a standard <body> instead of a custom scrollbar wrapper, with related attributes removed. In mobile navigation, the code introduces a new hook to lock the body scroll when the menu is open while also removing its usage elsewhere. An obsolete custom scrollbar component file is deleted, and global CSS is updated to adjust scrollbar styling and ordering.

Changes

File(s) Changes Summary
frontend/package.json Added dependency @uidotdev/usehooks (^2.4.1); removed overlayscrollbars (^2.10.1) and overlayscrollbars-react (^0.5.6).
frontend/src/app/layout.tsx, frontend/src/components/OverlayScrollbarMain.tsx, frontend/src/styles/globals.css Removed custom overlay scrollbar component and associated attributes; updated CSS ordering and scrollbar styling.
frontend/src/components/Navbar/MobileMenu.tsx, frontend/src/components/Navbar/index.tsx Introduced useLockBodyScroll hook in MobileMenu (to lock body scroll) and removed its usage in Navbar; adjusted class names and structure.
frontend/src/components/Footer.tsx Updated maximum width of the footer container from max-w-7xl to max-w-screen-2xl.

Possibly related PRs

  • feat(frontend): add-navbar #5: The changes in the main PR, specifically the addition of the @uidotdev/usehooks dependency and its usage in the MobileMenu component, are related to the modifications in the retrieved PR where the Navbar component also utilizes the useLockBodyScroll hook from the same library.

Suggested reviewers

  • Harman-singh-waraich

Poem

I'm a bouncy rabbit, hopping through the code,
Cleaning up scrolls and hooks along the road.
Dependencies pruned, new tools in play,
With standard layouts leading the way.
A nibble of change, a hop of delight—
My code garden is sprouting, bright and light!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91944c4 and 9fe380e.

📒 Files selected for processing (1)
  • frontend/src/styles/globals.css (2 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Feb 10, 2025

Deploy Preview for kleros-website-v2 ready!

Name Link
🔨 Latest commit 9fe380e
🔍 Latest deploy log https://app.netlify.com/sites/kleros-website-v2/deploys/67a9d7866d5f500008a28271
😎 Deploy Preview https://deploy-preview-77--kleros-website-v2.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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9916d2d and 670a369.

⛔ Files ignored due to path filters (1)
  • frontend/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • frontend/package.json (1 hunks)
  • frontend/src/app/layout.tsx (1 hunks)
  • frontend/src/components/Navbar/MobileMenu.tsx (3 hunks)
  • frontend/src/components/Navbar/index.tsx (2 hunks)
  • frontend/src/components/OverlayScrollbarMain.tsx (0 hunks)
  • frontend/src/styles/globals.css (2 hunks)
💤 Files with no reviewable changes (1)
  • frontend/src/components/OverlayScrollbarMain.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - kleros-website-v2
  • GitHub Check: Header rules - kleros-website-v2
  • GitHub Check: Pages changed - kleros-website-v2
🔇 Additional comments (5)
frontend/src/app/layout.tsx (1)

25-26: LGTM! Clean and simplified layout structure.

The removal of custom scrollbar wrapper in favor of native scrolling improves maintainability. The addition of min-w-80 class helps prevent layout issues on narrow screens.

Also applies to: 32-32

frontend/src/components/Navbar/index.tsx (1)

35-35: LGTM! Improved header width handling and scroll lock location.

The width changes (w-screen min-w-80) ensure consistent viewport coverage while maintaining minimum width. Moving scroll lock to MobileMenu component is a better separation of concerns.

frontend/package.json (1)

15-15: Verify @uidotdev/usehooks version and compatibility.

Let's ensure we're using the latest stable version of the package and check for any known issues.

✅ Verification successful

🌐 Web query:

What is the latest version of @uidotdev/usehooks?

💡 Result:

The latest version of @uidotdev/usehooks is 2.4.1, last published on October 23, 2023[4][6][9]. This version has remained stable for over a year according to npm release history[3][9], with no newer releases indicated in any of the package's documentation or official sources as of February 2025[3][4][6].

For installation:

npm i @uidotdev/usehooks

The package provides both standard and experimental hooks, though development activity appears to have paused after October 2023 based on release patterns[3][9]. Developers should verify compatibility with their React v18+ projects before implementation[1][2][4].

Citations:


Dependency version verified: @uidotdev/usehooks is up-to-date.

  • The package in the codebase is set to version ^2.4.1, which matches the latest stable version published on October 23, 2023.
  • No newer stable release or compatibility issues have been reported for React v18+.
frontend/src/styles/globals.css (2)

21-42: New HTML Scrollbar Styles Added

This block introduces a new html selector that sets scrollbar-gutter: stable; and applies custom styles to the WebKit scrollbar pseudo-elements. These changes align with the removal of the custom scrollbar component and the objective to simplify and standardize scrollbar behavior.

Recommendation: Verify that the scrollbar-gutter property and the pseudo-element styles work consistently across all target browsers or consider adding fallback rules if needed.


44-50: Reordered Body Styling

The body selector now follows the html block and retains standard properties (color, background, font settings) to ensure consistent typography and appearance. This ordering helps maintain proper cascade and clarity now that the custom overlay scrollbar components are removed.

Recommendation: Double-check that no unintended specificity or cascade issues arise from the new order.

@alcercu alcercu merged commit 14d328e into master Feb 10, 2025
3 of 5 checks passed
@alcercu alcercu deleted the refactor(frontend)/scrollbar branch February 10, 2025 10:41
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.

2 participants