-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
added new navbar design #31
added new navbar design #31
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis pull request introduces several new CSS styles and modifies the Changes
Possibly related PRs
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (5)
src/App.css (3)
21-28
: Glassmorphism effect implemented successfully, consider browser compatibilityThe
nav.bg-blur
class successfully implements the glassmorphism effect with a gradient background as mentioned in the PR objectives. Great job on achieving the desired visual effect!A few suggestions for improvement:
- Consider adding a fallback for browsers that don't support
backdrop-filter
. You can use a semi-transparent background color as a fallback.- The z-index of 50 seems arbitrary. Consider using a lower value unless there's a specific reason for such a high z-index.
Here's a suggested improvement:
nav.bg-blur { background: rgba(224, 240, 177, 0.8); /* Fallback */ background: linear-gradient(90deg, rgba(224, 240, 177, 0.8) 0%, rgba(188, 222, 232, 0.8) 100%); @supports (backdrop-filter: blur(10px)) { backdrop-filter: blur(10px); background: linear-gradient(90deg, rgba(224, 240, 177, 1) 0%, rgba(188, 222, 232, 1) 100%); } box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2); border-radius: 10px; z-index: 10; /* Lower z-index unless higher is necessary */ padding: 10px 0; }
31-36
: Navigation link styles look good, consider color contrastThe
.nav-link
class provides a solid foundation for styling navigation links. The padding and border-radius create a nice, clickable area, and the transition effects will ensure smooth interactions.One suggestion:
Consider the color contrast of black text on the gradient background. Depending on the gradient colors, black might not provide sufficient contrast for accessibility. You might want to use a darker color or add a text shadow for better readability.Here's a suggested improvement:
.nav-link { color: #333; /* Darker color for better contrast */ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); /* Subtle text shadow for readability */ padding: 10px 20px; border-radius: 20px; transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease; }
55-60
: Mobile menu styling is consistent, consider browser compatibilityThe
.mobile-menu
class maintains a consistent design language with the navbar, implementing glassmorphism and similar styling. This creates a cohesive user experience across desktop and mobile views.One suggestion for improvement:
As with the navbar, consider adding a fallback for browsers that don't supportbackdrop-filter
.Here's a suggested improvement:
.mobile-menu { background: rgba(255, 255, 255, 0.9); @supports (backdrop-filter: blur(5px)) { backdrop-filter: blur(5px); background: rgba(255, 255, 255, 0.7); /* Slightly more transparent when blur is supported */ } border-radius: 8px; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2); }src/Components/Shared/Navbar.jsx (2)
1-1
: Unnecessary Import of ReactSince React 17, importing
React
is no longer necessary when using JSX if the new JSX transform is enabled.Consider updating the import statement:
-import React, { useState } from "react"; +import { useState } from "react";
23-23
: Enhance Image Accessibility with Descriptive Alt TextThe
alt
attribute should provide a meaningful description for users who rely on screen readers.Consider updating the
alt
text to be more descriptive:-<img className="w-14 h-14 bg-white rounded-full p-1" alt="logo" src={Logo} /> +<img class="w-14 h-14 bg-white rounded-full p-1" alt="PlayCafe Logo" src={Logo} />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- src/App.css (1 hunks)
- src/Components/Shared/Navbar.jsx (2 hunks)
🔇 Additional comments (3)
src/App.css (3)
39-45
: Active link styling meets PR objectivesThe
.active-link
class successfully implements the button-gradient effect for the active page as mentioned in the PR objectives. The white text on the gradient background ensures good contrast, and the box shadow adds a nice depth to the active link.Great job on creating a visually distinct style for the active link!
63-72
: Mobile link styling is consistent and interactiveThe
.mobile-link
class and its hover state provide a consistent styling with the desktop navigation links. The padding and border-radius create a good touch target for mobile users, and the transition effects ensure smooth interactions.The hover effect with a semi-transparent background and color change provides clear visual feedback to the user. This enhances the overall user experience on mobile devices.
Great job on maintaining consistency across desktop and mobile views while adapting the styles for touch interfaces!
19-72
: Overall implementation successfully meets PR objectivesThe CSS changes in this file successfully implement the new navbar design with gradient and glassmorphism effects as described in the PR objectives. The styles are consistent across desktop and mobile views, creating a cohesive user experience.
Key achievements:
- Gradient and glassmorphism effects for the navbar
- Button-gradient effect for the active page
- Consistent styling for mobile menu
- Interactive hover effects for better user feedback
Minor suggestions were made regarding browser compatibility for
backdrop-filter
and color contrast for the nav links. Consider implementing these suggestions to further improve the code.Great job on enhancing the visual appeal and functionality of the navbar!
className={`nav-link ${isActiveLink(path) ? "active-link" : ""}`} | ||
> | ||
{/* Add icons here if desired */} | ||
{path === "/" ? "Home" : path.replace("/", "").charAt(0).toUpperCase() + path.slice(2)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug in Generating Navigation Labels
The current method for generating navigation labels may produce incorrect results for paths longer than one character. The expression:
{path.replace("/", "").charAt(0).toUpperCase() + path.slice(2)}
might omit necessary characters in the labels. For example, for the path /boardgame
, the label would be "B" + "ardgame"
, resulting in "Bardgame"
instead of "Boardgame"
.
To fix this, adjust the expression to correctly capitalize the first character and include the rest of the string:
-{path === "/" ? "Home" : path.replace("/", "").charAt(0).toUpperCase() + path.slice(2)}
+{path === "/" ? "Home" : path.replace("/", "").charAt(0).toUpperCase() + path.replace("/", "").slice(1)}
Alternatively, you can simplify the label generation:
{path === "/"
? "Home"
: path.replace("/", "").replace(/^\w/, (c) => c.toUpperCase())}
{["/", "/event", "/menu", "/register", "/boardgame"].map((path, index) => ( | ||
<li key={index}> | ||
<Link | ||
to={path} | ||
className={`nav-link ${isActiveLink(path) ? "active-link" : ""}`} | ||
> | ||
{/* Add icons here if desired */} | ||
{path === "/" ? "Home" : path.replace("/", "").charAt(0).toUpperCase() + path.slice(2)} | ||
</Link> | ||
</li> | ||
))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid Code Duplication by Extracting Navigation Links
The navigation link mapping is duplicated in both the desktop and mobile menus. This can lead to maintenance challenges and potential inconsistencies.
Consider extracting the navigation paths and link rendering into a separate component or function. Here's how you might do it:
-
Create an array of navigation paths and labels:
const navLinks = [ { path: "/", label: "Home" }, { path: "/event", label: "Event" }, { path: "/menu", label: "Menu" }, { path: "/register", label: "Register" }, { path: "/boardgame", label: "Boardgame" }, ];
-
Create a
NavigationLinks
component:const NavigationLinks = ({ isMobile }) => ( <> {navLinks.map((link, index) => ( <li key={index}> <Link to={link.path} className={`${ isMobile ? "block mobile-link" : "nav-link" } ${isActiveLink(link.path) ? "active-link" : ""}`} > {link.label} </Link> </li> ))} </> );
-
Use
NavigationLinks
in both menus:Desktop Menu:
<ul className="ml-4 flex space-x-4 font-semibold"> - {["/", "/event", "/menu", "/register", "/boardgame"].map((path, index) => ( - /* ... */ - ))} + <NavigationLinks isMobile={false} /> </ul>
Mobile Menu:
<div className="px-4 pt-4 pb-4 space-y-2"> - {["/", "/event", "/menu", "/register", "/boardgame"].map((path, index) => ( - /* ... */ - ))} + <NavigationLinks isMobile={true} /> </div>
This approach reduces duplication and makes your code more maintainable.
hi @sanayamahajan-23 first of all i didn't assigned you the issue and i didn't use any vanila css for designing (i used tailwind ) |
but you assigned me this issue @RamakrushnaBiswal |
@sanayamahajan-23 i really sorry about it but your navbar is not matched with our UI and make it using tailwind also make a fresh PR |
Okay so it is assigned to me right ? If it is then could you please provide me with some time until tomorrow |
@sanayamahajan-23 sure |
Before design:
Screenshot of my designs
Here is the design I added as navbar. It has gradient effect along with glassmorphism effect. I also added the new hover effect as you can see from the screenshots and also the active page has button-gradient effect.I hope you like my design. also add the level label so I can keep track of my points.
Summary by CodeRabbit
New Features
Bug Fixes
Style