-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: responsive navbar * style: nav links hover animatiosn
- Loading branch information
1 parent
b2ab0df
commit 380e264
Showing
5 changed files
with
124 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { FC, ReactNode, useState } from "react"; | ||
import * as Dialog from "@radix-ui/react-dialog"; | ||
import { MdClose, MdMenu } from "react-icons/md"; | ||
import { AnimatePresence, motion } from "framer-motion"; | ||
import Button from "../ui/Button"; | ||
import NavItems from "./NavItems"; | ||
|
||
interface MobileMenuProps {} | ||
|
||
const MobileMenu: FC<MobileMenuProps> = ({}) => { | ||
const [open, setOpen] = useState(false); | ||
return ( | ||
<Dialog.Root onOpenChange={setOpen}> | ||
<Dialog.Trigger asChild> | ||
<button className="block sm:hidden" aria-label="open menu"> | ||
<MdMenu className="text-4xl" /> | ||
</button> | ||
</Dialog.Trigger> | ||
<AnimatePresence> | ||
{open ? ( | ||
<Dialog.Portal forceMount> | ||
<Dialog.Overlay asChild forceMount> | ||
<motion.div | ||
className="fixed inset-0 flex overflow-auto cursor-pointer z-50 shadow-xl dark:shadow-primary/25" | ||
initial={{ opacity: 1, y: "-100%" }} | ||
animate={{ opacity: 1, y: "0%" }} | ||
exit={{ opacity: 1, y: "-100%" }} | ||
transition={{ duration: 0.4, ease: "circOut" }} | ||
> | ||
<Dialog.Content asChild forceMount> | ||
<div className="flex flex-col items-center justify-between py-24 flex-1 w-full bg-white dark:bg-black border border-black/10 dark:border-white/25 p-10 shadow-xl dark:shadow-primary/50 focus:outline-none cursor-auto z-50"> | ||
<NavItems className="text-3xl h-fit text-center flex-col items-center justify-center gap-10" /> | ||
|
||
<p className=""> | ||
Get a Second Brain with{" "} | ||
<span className="text-primary dark:bg-white rounded-sm"> | ||
Quivr | ||
</span> | ||
</p> | ||
|
||
<Dialog.Close asChild> | ||
<button | ||
className="absolute top-0 p-3 right-0 flex items-center justify-center gap-2 appearance-none rounded-full focus:shadow-sm focus:outline-none" | ||
aria-label="close menu" | ||
> | ||
<MdClose className="text-4xl" /> | ||
</button> | ||
</Dialog.Close> | ||
</div> | ||
</Dialog.Content> | ||
</motion.div> | ||
</Dialog.Overlay> | ||
</Dialog.Portal> | ||
) : null} | ||
</AnimatePresence> | ||
</Dialog.Root> | ||
); | ||
}; | ||
|
||
export default MobileMenu; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { cn } from "@/lib/utils"; | ||
import Link from "next/link"; | ||
import { FC, HTMLAttributes, ReactNode } from "react"; | ||
import DarkModeToggle from "./DarkModeToggle"; | ||
import Button from "../ui/Button"; | ||
|
||
interface NavItemsProps extends HTMLAttributes<HTMLUListElement> {} | ||
|
||
const NavItems: FC<NavItemsProps> = ({ className, ...props }) => { | ||
return ( | ||
// <div className={cn("flex flex-1 items-center", className)} {...props}> | ||
<ul | ||
className={cn( | ||
"flex flex-row items-center gap-4 text-sm flex-1", | ||
className | ||
)} | ||
{...props} | ||
> | ||
{process.env.NEXT_PUBLIC_ENV === "local" ? ( | ||
<> | ||
<NavLink to="/upload">Upload</NavLink> | ||
<NavLink to="/chat">Chat</NavLink> | ||
<NavLink to="/explore">Explore</NavLink> | ||
</> | ||
) : ( | ||
<> | ||
<NavLink to="https://github.com/StanGirard/quivr">Github</NavLink> | ||
<NavLink to="https://discord.gg/HUpRgp2HG8">Discord</NavLink> | ||
</> | ||
)} | ||
<div className="flex sm:flex-1 sm:justify-end flex-col items-center justify-center sm:flex-row gap-5 sm:gap-2"> | ||
<Link href={"https://try-quivr.streamlit.app"}> | ||
<Button variant={"secondary"}>Try Demo</Button> | ||
</Link> | ||
<DarkModeToggle /> | ||
</div> | ||
</ul> | ||
// </div> | ||
); | ||
}; | ||
|
||
interface NavLinkProps { | ||
children: ReactNode; | ||
to: string; | ||
} | ||
|
||
const NavLink: FC<NavLinkProps> = ({ children, to }) => { | ||
return ( | ||
<li className="group relative"> | ||
<Link href={to}>{children}</Link> | ||
<hr className="aboslute top-full border border-transparent border-b-primary dark:border-b-white scale-x-0 group-hover:scale-x-100 group-focus-within:scale-x-100 transition-transform" /> | ||
</li> | ||
); | ||
}; | ||
|
||
export default NavItems; |
This file contains 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
This file contains 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
380e264
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.
Successfully deployed to the following URLs:
quiver – ./
quiver-two.vercel.app
www.quivr.app
quiver-stangirard.vercel.app
quivr.app
quiver-git-main-stangirard.vercel.app