-
-
Notifications
You must be signed in to change notification settings - Fork 23
Navbar made responsive #74
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
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5ad4a7b
Footer made dynamic
parthratra11 2c77d70
Merge pull request #1 from parthratra11/dev
parthratra11 e25ca2c
Copyright centered + Footer padding fixed
parthratra11 132f0c2
Merge pull request #2 from parthratra11/dev
parthratra11 05f9eb6
Merge branch 'yashksaini-coder:main' into main
parthratra11 d4bdfdd
Update README.md
parthratra11 3a77e82
Theme toggle button fixed
parthratra11 e661111
Merge pull request #3 from parthratra11/dev
parthratra11 81e30ac
Hide/Unhide button added for password
parthratra11 0d3ee6e
Hide/Unhide button added on password v2
parthratra11 d7bc49c
Dev branch commit
parthratra11 b0b1c78
Navbar made responsive
parthratra11 0c143f4
Navbar made responsive v2
parthratra11 c96580c
Update README.md
parthratra11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
'use client' | ||
"use client"; | ||
|
||
import { useState } from "react" | ||
import Link from "next/link" | ||
import { usePathname } from "next/navigation" | ||
import { Button } from "@/components/ui/button" | ||
import { ThemeToggle } from "@/components/theme-toggle" | ||
import { Menu, X } from 'lucide-react' | ||
import { useState } from "react"; | ||
import Link from "next/link"; | ||
import { usePathname } from "next/navigation"; | ||
import { Button } from "@/components/ui/button"; | ||
import { ThemeToggle } from "@/components/theme-toggle"; | ||
import { Menu, X } from "lucide-react"; | ||
|
||
const navItems = [ | ||
{ href: "/", label: "Home" }, | ||
// { href: "features", label: "Features" }, | ||
{ href: "/learn-more", label: "How it Works" }, | ||
{ href: "/FAQ", label: "FAQs" }, | ||
// { href: "/blog", label: "Blog" }, | ||
] | ||
]; | ||
|
||
const Navbar1 = () => { | ||
const [isMenuOpen, setIsMenuOpen] = useState(false) | ||
const pathname = usePathname() | ||
const [isMenuOpen, setIsMenuOpen] = useState(false); | ||
const pathname = usePathname(); | ||
|
||
const toggleMenu = () => setIsMenuOpen(!isMenuOpen) | ||
const toggleMenu = () => setIsMenuOpen(!isMenuOpen); | ||
|
||
return ( | ||
<header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"> | ||
|
@@ -34,15 +34,20 @@ const Navbar1 = () => { | |
key={item.href} | ||
href={item.href} | ||
className={`text-sm font-medium transition-colors hover:text-primary ${ | ||
pathname === item.href ? "text-primary" : "text-muted-foreground" | ||
pathname === item.href | ||
? "text-primary" | ||
: "text-muted-foreground" | ||
}`} | ||
> | ||
{item.label} | ||
</Link> | ||
))} | ||
</div> | ||
<div className="hidden lg:flex items-center space-x-4"> | ||
<Link href="/auth/signin" className="text-sm font-medium text-muted-foreground hover:text-primary"> | ||
<Link | ||
href="/auth/signin" | ||
className="text-sm font-medium text-muted-foreground hover:text-primary" | ||
> | ||
Log in | ||
</Link> | ||
<Button asChild> | ||
|
@@ -55,45 +60,47 @@ const Navbar1 = () => { | |
className="lg:hidden focus:outline-none" | ||
aria-label={isMenuOpen ? "Close menu" : "Open menu"} | ||
> | ||
{isMenuOpen ? <X size={24} /> : <Menu size={24} />} | ||
{/* ADDED THEME TOGGLE ALONG WITH MENU */} | ||
<div className="flex flex-row justify-center items-center gap-2"> | ||
<ThemeToggle /> | ||
{isMenuOpen ? <X size={24} /> : <Menu size={24} />} | ||
</div> | ||
</button> | ||
</nav> | ||
|
||
{isMenuOpen && ( | ||
<div className="lg:hidden"> | ||
<nav className="container flex flex-col space-y-4 py-4"> | ||
{/* ADDED X-PADDING TO MAKE IT FIT PROPERLY ON MOBILE SCREENS */} | ||
<nav className="container flex flex-col space-y-4 py-4 px-4"> | ||
{navItems.map((item) => ( | ||
<Link | ||
key={item.href} | ||
href={item.href} | ||
className={`text-sm font-medium transition-colors hover:text-primary ${ | ||
pathname === item.href ? "text-primary" : "text-muted-foreground" | ||
pathname === item.href | ||
? "text-primary" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shifting to new lines is unnecessary |
||
: "text-muted-foreground" | ||
}`} | ||
onClick={toggleMenu} | ||
> | ||
{item.label} | ||
</Link> | ||
))} | ||
<div className="flex flex-col space-y-4 pt-4 border-t"> | ||
<Link | ||
href="/auth/signin" | ||
className="text-sm font-medium text-muted-foreground hover:text-primary" | ||
onClick={toggleMenu} | ||
> | ||
Log in | ||
</Link> | ||
{/* FORMATTED THE LOGIN BUTTON -> LOGIN TEXT IN CENTER AND BACKGROUND ADDED */} | ||
<Button asChild className="bg-primary-foreground text-white"> | ||
<Link href="/auth/signin">Login</Link> | ||
</Button> | ||
<Button asChild onClick={toggleMenu}> | ||
<Link href="/auth/register">Sign up</Link> | ||
</Button> | ||
<div className="flex justify-start"> | ||
<ThemeToggle /> | ||
</div> | ||
<div className="flex justify-start"></div> | ||
</div> | ||
</nav> | ||
</div> | ||
)} | ||
</header> | ||
) | ||
} | ||
export default Navbar1 | ||
); | ||
}; | ||
|
||
export default Navbar1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why shifted to new line, ??