Skip to content

Commit

Permalink
close responsive navbar on selection
Browse files Browse the repository at this point in the history
this fixes #28
  • Loading branch information
kingjulien1 committed Sep 8, 2022
1 parent 74f5d47 commit 4e2e959
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions components/navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ const collapseItems = ["Home", "Discover", "About"]

export default function Nav() {
const { status } = useSession()
const [isOpen, setOpen] = useState(false)

return (
<Navbar isBordered variant="sticky">
<Navbar.Brand>
<Navbar.Toggle showIn="xs" aria-label="toggle navigation" />
<NextLink href="/">
<Link hidein="xs" color="text" css={{ fontWeight: "$bold", fontSize: "large", paddingLeft: "$10" }}>
ttt.land
</Link>
</NextLink>
<Navbar.Toggle onClick={() => setOpen(true)} showIn="xs" aria-label="toggle navigation" />
</Navbar.Brand>
<Navbar.Content enableCursorHighlight hideIn="xs">
<NextLink href="/">
Expand All @@ -35,11 +31,13 @@ export default function Nav() {
<ColorModeToggle />
{{ loading: <Loading />, unauthenticated: <AuthModal />, authenticated: <UserModal /> }[status]}
</Navbar.Content>
<Navbar.Collapse>
<Navbar.Collapse disableBlur isOpen={isOpen}>
{collapseItems.map((item) => (
<Navbar.CollapseItem key={item} activeColor="secondary">
<Navbar.CollapseItem key={item} activeColor="secondary" css={{ fontSize: "$4xl", fontWeight: "$bold" }}>
<NextLink href={item === "Home" ? "/" : item.toLowerCase()}>
<Link color="inherit">{item}</Link>
<Link color="inherit" onClick={() => setOpen(false)}>
{item}
</Link>
</NextLink>
</Navbar.CollapseItem>
))}
Expand Down

1 comment on commit 4e2e959

@vercel
Copy link

@vercel vercel bot commented on 4e2e959 Sep 8, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

tttland – ./

tttland-kingjulien1.vercel.app
ttt-land.vercel.app
tttland-git-main-kingjulien1.vercel.app

Please sign in to comment.