docs: add github icon on nav

This commit is contained in:
Bereket Engida
2024-11-25 20:46:29 +03:00
parent 667ab82231
commit 2fb2e8588f
5 changed files with 220 additions and 168 deletions

View File

@@ -6,15 +6,17 @@ import { useSelectedLayoutSegment } from "next/navigation";
type Props = {
href: string;
children: React.ReactNode;
className?: string;
external?: boolean;
};
export const NavLink = ({ href, children }: Props) => {
export const NavLink = ({ href, children, className, external }: Props) => {
const segment = useSelectedLayoutSegment();
const isActive =
segment === href.slice(1) || (segment === null && href === "/");
return (
<li className="relative group">
<li className={cn("relative group", className)}>
<Link
href={href}
className={cn(
@@ -22,6 +24,7 @@ export const NavLink = ({ href, children }: Props) => {
"group-hover:text-foreground",
isActive ? "text-foreground" : "text-muted-foreground",
)}
target={external ? "_blank" : "_parent"}
>
{children}
</Link>