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: Navbar section updated for mobile view #320

Merged
merged 6 commits into from
May 24, 2024

Conversation

AbhiDiva96
Copy link
Contributor

@AbhiDiva96 AbhiDiva96 commented May 17, 2024

Related Issue

fixes: #305

Description

Improved/enhanced the navbar section for the mobile view

Screenshots

Before change

Screenshot 2024-05-17 161932

After change

Screenshot 2024-05-17 162619

Added theme button so that user can easily shift from dark to light mode or vice-versa

Screenshot 2024-05-17 160412

Summary by CodeRabbit

Summary by CodeRabbit

  • Improvements
    • Enhanced the layout and styling of the Navbar for a better visual presentation and user experience on both desktop and mobile views.
    • Minor formatting adjustments to the Theme Button for code consistency.

Copy link

vercel bot commented May 17, 2024

Someone is attempting to deploy a commit to the Sanchit Bajaj's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented May 17, 2024

Walkthrough

The recent changes aim to enhance the layout and styling of the Navbar component to improve visual presentation and user experience on both desktop and mobile views. Specific adjustments were made to elements like the hamburger menu button, theme button, login/register links, and the mobile menu. Additionally, a minor formatting change was implemented in the themeButton component.

Changes

Files Change Summary
src/components/core/navbar/index.tsx Adjusted the layout and styling of the Navbar component, including the hamburger menu button, theme button, login/register links, and mobile menu for better UX.
src/components/core/themeButton/index.tsx Minor modification involving a change in whitespace at the end of the file.

Assessment against linked issues

Objective Addressed Explanation
Navbar toggler not working on mobile device (#305)
Theme button should be on the right-most corner (#305)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@github-actions github-actions bot added title needs formatting Title of issue or pull request does not match the guidelines wait for reviewers and removed title needs formatting Title of issue or pull request does not match the guidelines labels May 17, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Great job, @AbhiDiva96! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project. Keep being the part of the community!

'We will promptly review your changes and offer feedback. Keep up the excellent work!
Kindly remember to check our Contributing Guidelines'

@github-actions github-actions bot added the title needs formatting Title of issue or pull request does not match the guidelines label May 17, 2024
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: 0

Out of diff range and nitpick comments (2)
src/components/core/navbar/index.tsx (2)

Line range hint 135-148: Ensure consistent visibility of the hamburger menu button.

The hamburger menu button's visibility is toggled based on the isMenuOpen state. However, the button is hidden when isMenuOpen is true, which might confuse users who want to close the menu. Consider always showing the button and changing its icon based on the state.

- className={`px-2 lg:hidden dark:text-white dark:hover:text-primary text-secondary hover:text-primary transition-all duration-300 focus:outline-none ${
-   isMenuOpen ? "hidden" : "closed"
- }`}
+ className="px-2 lg:hidden dark:text-white dark:hover:text-primary text-secondary hover:text-primary transition-all duration-300 focus:outline-none"

And then use the Menu or X icon conditionally:

{isMenuOpen ? <X size={32} /> : <Menu size={32} />}

Line range hint 211-248: Optimize the mobile menu for better accessibility and performance.

The mobile menu is currently implemented with a conditional rendering that checks isMenuOpen. This approach can lead to performance issues on devices with slower rendering capabilities as it involves mounting and unmounting components. Consider using CSS to hide and show the menu instead of conditional rendering to improve performance and smoothness of animations.

- {isMenuOpen && (
-   <div className="bg-secondary-light backdrop-blur-sm bg-opacity-60 dark:bg-primary-light dark:bg-opacity-60 h-[100vh] z-50 w-1/2 fixed inset-y-0 right-0 md:hidden transition-transform duration-300">
+ <div className={`bg-secondary-light backdrop-blur-sm bg-opacity-60 dark:bg-primary-light dark:bg-opacity-60 h-[100vh] z-50 w-1/2 fixed inset-y-0 right-0 md:hidden transition-transform duration-300 ${isMenuOpen ? 'translate-x-0' : 'translate-x-full'}`}>

This change uses CSS transitions for the translate-x property to slide the menu in and out, which is generally smoother than mounting and unmounting the component.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between bf2ff2b and ca614a8.
Files ignored due to path filters (2)
  • package.json is excluded by !**/*.json
  • yarn.lock is excluded by !**/*.lock, !**/*.lock
Files selected for processing (2)
  • src/components/core/navbar/index.tsx (5 hunks)
  • src/components/core/themeButton/index.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/components/core/themeButton/index.tsx

@AbhiDiva96 AbhiDiva96 changed the title Bug: Navbar section update for mobile view fix: Navbar section update for mobile view May 17, 2024
@github-actions github-actions bot removed the title needs formatting Title of issue or pull request does not match the guidelines label May 17, 2024
@AbhiDiva96 AbhiDiva96 changed the title fix: Navbar section update for mobile view fix: Navbar section updated for mobile view May 17, 2024
@Sanchitbajaj02
Copy link
Owner

Sanchitbajaj02 commented May 17, 2024

@AbhiDiva96 why this is raised and not included into your previous PR?

@AbhiDiva96
Copy link
Contributor Author

AbhiDiva96 commented May 18, 2024

I don't want to mess up all the things on that PR. I will close that PR. When you review this one. Please go with this PR
@Sanchitbajaj02

@AbhiDiva96
Copy link
Contributor Author

Hey @Sanchitbajaj02
Pls review this PR

@Sanchitbajaj02
Copy link
Owner

Hey @Sanchitbajaj02 Pls review this PR

PR is pulled locally and in review process. It will be merged today

@AbhiDiva96
Copy link
Contributor Author

thank-you so much
@Sanchitbajaj02

package.json Outdated Show resolved Hide resolved


<div className="md:hidden flex justify-end">
<div className="flex justify-end">
Copy link
Owner

Choose a reason for hiding this comment

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

we don't need extra flexboxes

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: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between ca614a8 and 940f2bc.
Files ignored due to path filters (2)
  • package.json is excluded by !**/*.json
  • yarn.lock is excluded by !**/*.lock, !**/*.lock
Files selected for processing (1)
  • src/components/core/navbar/index.tsx (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/components/core/navbar/index.tsx

@AbhiDiva96
Copy link
Contributor Author

@Sanchitbajaj02
please consider this PR as the final one. on forward I am not going to make any other PR. I have pushed all the changes in this one. so sorry for bothering you.

@Sanchitbajaj02
Copy link
Owner

@Sanchitbajaj02 please consider this PR as the final one. on forward I am not going to make any other PR. I have pushed all the changes in this one. so sorry for bothering you.

I added reviews in this pr as well as in your old PRs. Please do that to get it merged. If you're facing problems related to raising prs and git please reach out to me on discord

@Sanchitbajaj02
Copy link
Owner

@AbhiDiva96 Please acknowledge the changes that I have raised. If you have any doubt, please respond. I will close this PR in 48hrs if you didn't

@AbhiDiva96
Copy link
Contributor Author

AbhiDiva96 commented May 22, 2024

I closed the initial two PR.
This is the final PR please review and merge it
this PR waiting for reviews pls merge it.
@Sanchitbajaj02

@Sanchitbajaj02
Copy link
Owner

I closed the initial two PR. This is the final PR please review and merge it this PR waiting for reviews pls merge it. @Sanchitbajaj02

Hi @AbhiDiva96 i have told many times above that you have to change some things to get it merged. Please fix those things then I will merge. It is not just that you create something and I merge it blindly

@AbhiDiva96
Copy link
Contributor Author

AbhiDiva96 commented May 23, 2024

dear @Sanchitbajaj02
i have added all your requirements. which you gave to me in the above. i have add a commit name "improve ui of navbar in mobile view". if any query ping me

image of commit

image

@Sanchitbajaj02
Copy link
Owner

dear @Sanchitbajaj02 i have added all your requirements. which you gave to me in the above. i have add a commit name "improve ui of navbar in mobile view". if any query ping me

image of commit

image

take latest update from master since it has some merge conflicts. Fix them and I will merge

@Sanchitbajaj02 Sanchitbajaj02 added 🪲 bug Something isn't working 🛠 goal: fix The label is related to fixing a bug ✨ goal: improve interface EASY Difficulty Level: Easy level1 10 points gssoc GSSOC'24 Required Label and removed wait for reviewers labels May 23, 2024
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: 0

Outside diff range and nitpick comments (4)
src/components/core/navbar/index.tsx (4)

Line range hint 139-148: The hamburger menu toggle functionality is implemented correctly. Consider adding an explicit type attribute to the button for better standards compliance.

- <button onClick={() => setMenuOpen(!isMenuOpen)} className={`...`}>
+ <button type="button" onClick={() => setMenuOpen(!isMenuOpen)} className={`...`}>

Line range hint 211-247: The conditional rendering of the mobile menu is correctly implemented. Simplify the className by removing unnecessary template literals.

- className={`absolute right-2 top-6 dark:text-white dark:hover:text-primary focus:outline-none ${isMenuOpen ? "open" : "closed"} text-gray-600 hover:text-primary lg:hidden`}
+ className="absolute right-2 top-6 dark:text-white dark:hover:text-primary focus:outline-none text-gray-600 hover:text-primary lg:hidden"

Line range hint 23-23: Specify explicit types instead of any for Redux state selectors to enhance type safety and maintainability.

- const userAuth = useSelector((state: any) => state.auth);
+ const userAuth = useSelector((state: AppState) => state.auth);

Line range hint 1-11: Consider sorting the import statements to improve code readability and maintainability.

- import { useSelector, useDispatch } from "react-redux";
- import { useEffect, useState, useCallback } from "react";
- import Link from "next/link";
- import Image from "next/image";
- import { useRouter, usePathname } from "next/navigation";
+ import { useCallback, useEffect, useState } from "react";
+ import { useDispatch, useSelector } from "react-redux";
+ import Image from "next/image";
+ import Link from "next/link";
+ import { useRouter, usePathname } from "next/navigation";
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 940f2bc and 4ec31e6.
Files selected for processing (1)
  • src/components/core/navbar/index.tsx (4 hunks)
Additional Context Used
Biome (9)
src/components/core/navbar/index.tsx (9)

26-26: Unexpected any. Specify a different type.


30-30: The computed expression can be simplified without the use of a string literal.


46-46: Unexpected any. Specify a different type.


172-172: Do not use template literals if interpolation and special-character handling are not needed.


250-250: Change to an optional chain.


141-146: Provide an explicit type prop for the button element.


178-181: Provide an explicit type prop for the button element.


214-219: Provide an explicit type prop for the button element.


Import statements could be sorted:

Additional comments not posted (1)
src/components/core/navbar/index.tsx (1)

136-138: Positioning of the ThemeButton in the mobile view looks good and aligns with the PR objectives.

@Sanchitbajaj02 Sanchitbajaj02 merged commit fd6a0f8 into Sanchitbajaj02:master May 24, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working EASY Difficulty Level: Easy 🛠 goal: fix The label is related to fixing a bug ✨ goal: improve interface gssoc GSSOC'24 Required Label level1 10 points
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Navbar toggler not working in mobile device
2 participants