Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Revert "feat(web): redesign marketing site navbar"

Richie McIlroyf2d3a4c04121
diff --git a/apps/web/app/(site)/Navbar.tsx b/apps/web/app/(site)/Navbar.tsx
index f4a87a9f4..c1593218d 100644
--- a/apps/web/app/(site)/Navbar.tsx
+++ b/apps/web/app/(site)/Navbar.tsx
@@ -29,14 +29,18 @@ const Links = [
label: "Instant Mode",
sub: "Quick recordings with instant shareable links",
href: "/features/instant-mode",
- icon: <Zap className="size-4 text-gray-12" strokeWidth={1.5} />,
+ icon: <Zap fill="yellow" className="size-4" strokeWidth={1.5} />,
},
{
label: "Studio Mode",
sub: "Professional recordings with advanced editing",
href: "/features/studio-mode",
icon: (
- <Clapperboard className="size-4 text-gray-12" strokeWidth={1.5} />
+ <Clapperboard
+ fill="var(--blue-9)"
+ className="size-4"
+ strokeWidth={1.5}
+ />
),
},
{
@@ -117,13 +121,12 @@ export const Navbar = ({ stars }: NavbarProps) => {
const [showMobileMenu, setShowMobileMenu] = useState(false);
const auth = useCurrentUser();
- const [scrolled, setScrolled] = useState(false);
+ const [hideLogoName, setHideLogoName] = useState(false);
useEffect(() => {
const onScroll = () => {
- setScrolled(window.scrollY > 4);
+ setHideLogoName(window.scrollY > 10);
};
- onScroll();
document.addEventListener("scroll", onScroll, { passive: true });
return () => {
document.removeEventListener("scroll", onScroll);
@@ -132,158 +135,161 @@ export const Navbar = ({ stars }: NavbarProps) => {
return (
<>
- <header
- className={classNames(
- "fixed left-0 right-0 top-0 z-[51] transition-colors duration-200",
- scrolled
- ? "border-b border-gray-4 bg-[#FAFAFA]/85 backdrop-blur-md"
- : "border-b border-transparent bg-transparent",
- )}
- >
- <nav className="mx-auto flex h-14 w-full max-w-[1180px] items-center justify-between px-5 md:h-16 lg:px-8">
- <div className="flex items-center gap-10">
- <Link
- passHref
- href="/home"
- className="flex items-center"
- aria-label="Cap home"
- >
- <Logo
- hideLogoName={false}
- className="transition-opacity duration-200 hover:opacity-80"
- viewBoxDimensions="0 0 120 40"
- style={{ width: 84, height: 36 }}
- />
- </Link>
- <div className="hidden lg:flex">
- <NavigationMenu>
- <NavigationMenuList className="space-x-0">
- {Links.map((link) => (
- <NavigationMenuItem key={link.label}>
- {link.dropdown ? (
- <>
- <NavigationMenuTrigger className="px-3 py-0 text-[13px] font-medium text-gray-10 hover:text-gray-12 active:text-gray-12 focus:text-gray-12 data-[state=open]:text-gray-12">
- {link.label}
- </NavigationMenuTrigger>
- <NavigationMenuContent>
- <ul className="grid gap-1 p-3 md:w-[400px] lg:w-[480px] lg:grid-cols-2">
- {link.dropdown.map((sublink) => (
- <li key={sublink.href}>
- <NavigationMenuLink asChild>
- <a
- href={sublink.href}
- className="block rounded-lg p-3 leading-tight no-underline outline-none transition-colors duration-200 select-none hover:bg-gray-3"
- >
- <div className="flex items-center gap-2 text-[13px] font-medium text-gray-12">
- {sublink.icon && sublink.icon}
- <span>{sublink.label}</span>
- </div>
- <p className="mt-1 line-clamp-2 text-[12px] leading-snug text-gray-10">
- {sublink.sub}
- </p>
- </a>
- </NavigationMenuLink>
- </li>
- ))}
- </ul>
- </NavigationMenuContent>
- </>
- ) : (
- <NavigationMenuLink asChild>
- <Link
- href={link.href}
- className={classNames(
- navigationMenuTriggerStyle(),
- pathname === link.href
- ? "text-gray-12"
- : "text-gray-10",
- "px-3 py-0 text-[13px] font-medium hover:text-gray-12",
- )}
- >
- {link.label}
- </Link>
- </NavigationMenuLink>
- )}
- </NavigationMenuItem>
- ))}
- </NavigationMenuList>
- </NavigationMenu>
+ <header className="fixed left-0 right-0 z-[51] animate-in fade-in slide-in-from-top-4 duration-500 top-4 lg:top-6">
+ <nav className="p-2 mx-auto w-full max-w-[calc(100%-20px)] bg-white rounded-full border backdrop-blur-md lg:max-w-fit border-zinc-200 h-fit">
+ <div className="flex gap-12 justify-between items-center mx-auto max-w-5xl h-full transition-all">
+ <div className="flex items-center">
+ <Link passHref href="/home">
+ <Logo
+ hideLogoName={hideLogoName}
+ className="transition-all duration-200 ease-out"
+ viewBoxDimensions={hideLogoName ? "0 0 60 40" : "0 0 120 40"}
+ style={{
+ width: hideLogoName ? 45.5 : 90,
+ height: 40,
+ }}
+ />
+ </Link>
+ <div className="hidden lg:flex">
+ <NavigationMenu>
+ <NavigationMenuList className="space-x-0">
+ {Links.map((link) => (
+ <NavigationMenuItem key={link.label}>
+ {link.dropdown ? (
+ <>
+ <NavigationMenuTrigger
+ className={
+ "px-2 py-0 text-sm font-medium text-gray-10 active:text-gray-10 focus:text-gray-10 hover:text-blue-9"
+ }
+ >
+ {link.label}
+ </NavigationMenuTrigger>
+ <NavigationMenuContent>
+ <ul className="grid gap-3 p-6 md:w-[400px] lg:w-[500px] lg:grid-cols-2">
+ {link.dropdown.map((sublink) => (
+ <li key={sublink.href}>
+ <NavigationMenuLink asChild>
+ <a
+ href={sublink.href}
+ className="block p-3 space-y-1 leading-none no-underline rounded-md transition-all duration-200 outline-none select-none hover:bg-gray-2 hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
+ >
+ <div className="flex gap-2 items-center text-base font-medium leading-none transition-colors duration-200 text-zinc-700 group-hover:text-zinc-900">
+ {sublink.icon && sublink.icon}
+ <span className="font-semibold text-gray-12">
+ {sublink.label}
+ </span>
+ </div>
+ <p className="text-sm leading-snug transition-colors duration-200 line-clamp-2 text-zinc-500 group-hover:text-zinc-700">
+ {sublink.sub}
+ </p>
+ </a>
+ </NavigationMenuLink>
+ </li>
+ ))}
+ </ul>
+ </NavigationMenuContent>
+ </>
+ ) : (
+ <NavigationMenuLink asChild>
+ <Link
+ href={link.href}
+ className={classNames(
+ navigationMenuTriggerStyle(),
+ pathname === link.href
+ ? "text-blue-9"
+ : "text-gray-10",
+ "px-2 py-0 text-sm font-medium hover:text-blue-9 focus:text-8",
+ )}
+ >
+ {link.label}
+ </Link>
+ </NavigationMenuLink>
+ )}
+ </NavigationMenuItem>
+ ))}
+ </NavigationMenuList>
+ </NavigationMenu>
+ </div>
</div>
- </div>
- <div className="hidden items-center gap-2 lg:flex">
- <Button
- variant="ghost"
- icon={
- <Image src="/github.svg" alt="Github" width={14} height={14} />
- }
- target="_blank"
- href="https://github.com/CapSoftware/Cap"
- size="sm"
- className="!h-9 !px-3 !text-[13px] !text-gray-11 hover:!text-gray-12"
- >
- {`${stars ? stars : "GitHub"}`}
- </Button>
- <Suspense
- fallback={
- <Button
- variant="dark"
- disabled
- size="sm"
- className="!h-9 !px-4 !text-[13px]"
- >
- Loading…
- </Button>
- }
+ <div className="hidden items-center space-x-2 lg:flex">
+ <Button
+ variant="outline"
+ icon={
+ <Image
+ src="/github.svg"
+ alt="Github"
+ width={16}
+ height={16}
+ />
+ }
+ target="_blank"
+ href="https://github.com/CapSoftware/Cap"
+ size="sm"
+ className="w-full font-medium sm:w-auto"
+ >
+ {`GitHub${stars ? ` (${stars})` : ""}`}
+ </Button>
+ <Suspense
+ fallback={
+ <Button
+ variant="dark"
+ disabled
+ size="sm"
+ className="w-full font-medium sm:w-auto"
+ >
+ Loading...
+ </Button>
+ }
+ >
+ {!auth && (
+ <Button
+ variant="gray"
+ href="/login"
+ size="sm"
+ className="w-full font-medium sm:w-auto"
+ >
+ Login
+ </Button>
+ )}
+ <LoginOrDashboard />
+ </Suspense>
+ </div>
+ <button
+ type="button"
+ className="flex lg:hidden"
+ onClick={() => setShowMobileMenu(!showMobileMenu)}
>
- {!auth && (
- <Button
- variant="ghost"
- href="/login"
- size="sm"
- className="!h-9 !px-3 !text-[13px] !text-gray-11 hover:!text-gray-12"
- >
- Login
- </Button>
- )}
- <LoginOrDashboard />
- </Suspense>
+ <div className="flex flex-col gap-[5px] mr-1">
+ <motion.div
+ initial={{ opacity: 1 }}
+ animate={{
+ rotate: showMobileMenu ? 45 : 0,
+ y: showMobileMenu ? 7 : 0,
+ }}
+ transition={{ duration: 0.2 }}
+ className="w-6 h-0.5 bg-black"
+ />
+ <motion.div
+ initial={{ opacity: 1 }}
+ animate={{
+ opacity: showMobileMenu ? 0 : 1,
+ x: showMobileMenu ? -5 : 0,
+ }}
+ transition={{ duration: 0.2 }}
+ className="w-6 h-0.5 bg-black"
+ />
+ <motion.div
+ initial={{ opacity: 1 }}
+ animate={{
+ rotate: showMobileMenu ? -45 : 0,
+ y: showMobileMenu ? -7 : 0,
+ }}
+ transition={{ duration: 0.2 }}
+ className="w-6 h-0.5 bg-black"
+ />
+ </div>
+ </button>
</div>
- <button
- type="button"
- className="flex lg:hidden"
- onClick={() => setShowMobileMenu(!showMobileMenu)}
- aria-label="Toggle menu"
- >
- <div className="mr-1 flex flex-col gap-[5px]">
- <motion.div
- initial={{ opacity: 1 }}
- animate={{
- rotate: showMobileMenu ? 45 : 0,
- y: showMobileMenu ? 7 : 0,
- }}
- transition={{ duration: 0.2 }}
- className="h-0.5 w-6 bg-gray-12"
- />
- <motion.div
- initial={{ opacity: 1 }}
- animate={{
- opacity: showMobileMenu ? 0 : 1,
- x: showMobileMenu ? -5 : 0,
- }}
- transition={{ duration: 0.2 }}
- className="h-0.5 w-6 bg-gray-12"
- />
- <motion.div
- initial={{ opacity: 1 }}
- animate={{
- rotate: showMobileMenu ? -45 : 0,
- y: showMobileMenu ? -7 : 0,
- }}
- transition={{ duration: 0.2 }}
- className="h-0.5 w-6 bg-gray-12"
- />
- </div>
- </button>
</nav>
</header>
{showMobileMenu && (
@@ -305,9 +311,9 @@ function LoginOrDashboard() {
variant="dark"
href={auth ? "/dashboard" : "/signup"}
size="sm"
- className="!h-9 !px-4 !text-[13px]"
+ className="w-full font-medium sm:w-auto"
>
- {auth ? "Dashboard" : "Sign up"}
+ {auth ? "Dashboard" : "Sign Up"}
</Button>
);
}