Skip to content

Commit

Permalink
Add headerClientRoutes and update main header component
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Mar 21, 2024
1 parent 1434082 commit 949b6c8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 31 deletions.
28 changes: 28 additions & 0 deletions src/components/header-client-routes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use client";

import { cn } from "@/utils";
import Link from "next/link";
import { usePathname } from "next/navigation";

const headerClientClassname =
"text-sm text-neutral-700 hover:opacity-80 dark:text-neutral-300 transition-opacity";

const HeaderClientRoutes = () => {
const pathname = usePathname();
return (
<>
<Link
href="/docs/getting-started"
className={cn(
headerClientClassname,
pathname.includes("/docs") &&
"font-medium underline underline-offset-8 dark:text-white dark:decoration-neutral-600",
)}
>
Docs
</Link>
</>
);
};

export default HeaderClientRoutes;
35 changes: 23 additions & 12 deletions src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,35 @@ import UserButton from "@/components/auth/user-btn";
import Logo from "@/components/icons/logo";
import { GithubLogo } from "@/components/icons/logos";
import CommandK from "@/components/commandK";
import HeaderClientRoutes from "./header-client-routes";

const Header = () => {
return (
<nav className={cn("flex w-full", "sticky top-0 z-50", "bg-white dark:bg-neutral-900")}>
<nav
className={cn(
"flex w-full",
"sticky top-0 z-50",
"bg-white dark:bg-neutral-900",
)}
>
<Container>
<div className="flex w-full items-center justify-between pb-2 pt-4">
<Link
href="/"
className="flex items-center space-x-3 transition-opacity hover:opacity-80 rtl:space-x-reverse"
>
<Logo width={30} />
<span className="self-center whitespace-nowrap text-lg font-medium tracking-tight dark:text-white">
slug
</span>
<Badge className="cursor-pointer">beta</Badge>
</Link>
<div className="flex items-center space-x-5">
<div className="flex items-center space-x-1 border-r border-neutral-200 dark:border-neutral-800 pr-4">
<Link
href="/"
className="flex items-center space-x-3 transition-opacity hover:opacity-80 rtl:space-x-reverse"
>
<Logo width={30} />
<span className="self-center whitespace-nowrap text-lg font-medium tracking-tight dark:text-white">
slug
</span>
<Badge className="cursor-pointer">beta</Badge>
</Link>
</div>
<HeaderClientRoutes />
</div>
<div className="flex items-center space-x-1">
<Link href="/docs">Docs</Link>
<ExternalLink
href="https://github.com/pheralb/slug"
className={buttonVariants({
Expand Down
19 changes: 0 additions & 19 deletions src/components/login-button.tsx

This file was deleted.

0 comments on commit 949b6c8

Please sign in to comment.