feat: update layout and enhance SiteNavbar with top icon links
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ export default function RootLayout({
|
|||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className="min-h-dvh bg-background text-foreground antialiased">
|
<body className="min-h-dvh bg-background text-foreground antialiased">
|
||||||
<div className="mx-auto flex w-full max-w-4xl flex-col overflow-hidden px-4 py-8 sm:px-6 sm:py-10">
|
<div className="mx-auto flex w-full max-w-4xl flex-col overflow-hidden px-4 py-4 sm:px-6">
|
||||||
<SiteNavbar />
|
<SiteNavbar />
|
||||||
<AnnouncementBar
|
<AnnouncementBar
|
||||||
variant="branded"
|
variant="branded"
|
||||||
|
|||||||
+168
-119
@@ -22,6 +22,37 @@ import { SearchCommand } from "@/components/search-command";
|
|||||||
import { useKeyboardShortcutLabel } from "@/lib/use-keyboard-shortcut-label";
|
import { useKeyboardShortcutLabel } from "@/lib/use-keyboard-shortcut-label";
|
||||||
import { NAV_LINKS, SOCIAL_LINKS } from "@/lib/links";
|
import { NAV_LINKS, SOCIAL_LINKS } from "@/lib/links";
|
||||||
|
|
||||||
|
const TOP_ICON_LINKS = [
|
||||||
|
{
|
||||||
|
id: "ui-kit",
|
||||||
|
label: "UI Kit",
|
||||||
|
href: "https://ui.poyrazavsever.com",
|
||||||
|
icon: "mdi:palette-swatch-outline",
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "52-weeks-js",
|
||||||
|
label: "52 Weeks of JS",
|
||||||
|
href: "https://js.poyrazavsever.com",
|
||||||
|
icon: "mdi:code-json",
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "rss",
|
||||||
|
label: "RSS",
|
||||||
|
href: "/rss.xml",
|
||||||
|
icon: "mdi:rss",
|
||||||
|
external: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "cv",
|
||||||
|
label: "CV",
|
||||||
|
href: "/resume.pdf",
|
||||||
|
icon: "mdi:file-account-outline",
|
||||||
|
external: false,
|
||||||
|
},
|
||||||
|
] as const;
|
||||||
|
|
||||||
function getNavLinkClass(isActive: boolean) {
|
function getNavLinkClass(isActive: boolean) {
|
||||||
return [
|
return [
|
||||||
"inline-flex border-b-2 pb-1 text-sm transition-colors",
|
"inline-flex border-b-2 pb-1 text-sm transition-colors",
|
||||||
@@ -42,136 +73,154 @@ export function SiteNavbar() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="flex items-center justify-between gap-3 border-b border-border pb-4">
|
<div className="space-y-3">
|
||||||
<Link href="/" aria-label="Go to home" className="inline-flex items-center">
|
<div className="flex items-center justify-end gap-2 border-b border-border pb-3">
|
||||||
<Avatar className="h-9 w-9 rounded-sm">
|
{TOP_ICON_LINKS.map((item) => (
|
||||||
<AvatarImage src="/logo/logo.jpeg" alt="Poyraz Avsever" />
|
<Link
|
||||||
<AvatarFallback className="rounded-sm bg-muted text-xs font-semibold">
|
key={item.id}
|
||||||
PA
|
href={item.href}
|
||||||
</AvatarFallback>
|
target={item.external ? "_blank" : undefined}
|
||||||
</Avatar>
|
rel={item.external ? "noreferrer" : undefined}
|
||||||
</Link>
|
aria-label={item.label}
|
||||||
|
title={item.label}
|
||||||
<div className="hidden items-center gap-3 md:flex">
|
className="inline-flex h-8 w-8 items-center justify-center rounded-sm border border-border text-muted-foreground transition-colors hover:text-foreground"
|
||||||
<nav aria-label="Main navigation">
|
>
|
||||||
<ul className="flex items-center gap-3">
|
<Icon icon={item.icon} width={16} height={16} />
|
||||||
{NAV_LINKS.map((item, index) => (
|
</Link>
|
||||||
<li key={item.id} className="flex items-center gap-3">
|
))}
|
||||||
{index > 0 && (
|
|
||||||
<Separator orientation="vertical" className="h-4 bg-border" decorative />
|
|
||||||
)}
|
|
||||||
<Link href={item.href} className={getNavLinkClass(isActiveLink(item.href))}>
|
|
||||||
{item.label}
|
|
||||||
</Link>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<Separator orientation="vertical" className="h-4 bg-border" decorative />
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => setSearchOpen(true)}
|
|
||||||
className="inline-flex h-8 w-44 cursor-pointer items-center justify-between rounded-sm border border-border px-2.5 text-sm text-muted-foreground transition-colors hover:text-foreground sm:w-52"
|
|
||||||
aria-label="Open command palette"
|
|
||||||
>
|
|
||||||
<span className="inline-flex items-center gap-2">
|
|
||||||
<Icon icon="mdi:magnify" width={16} height={16} />
|
|
||||||
<span>Search</span>
|
|
||||||
</span>
|
|
||||||
<span className="text-xs text-muted-foreground">{shortcut}</span>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger className="inline-flex h-8 cursor-pointer items-center gap-2 rounded-sm border border-border px-2.5 text-sm text-muted-foreground transition-colors hover:text-foreground">
|
|
||||||
<Icon icon="mdi:share-variant" width={16} height={16} />
|
|
||||||
<span>Social</span>
|
|
||||||
</DropdownMenuTrigger>
|
|
||||||
<DropdownMenuContent align="end" className="w-52 rounded-sm">
|
|
||||||
<DropdownMenuLabel>Social Links</DropdownMenuLabel>
|
|
||||||
<DropdownMenuSeparator />
|
|
||||||
{SOCIAL_LINKS.map((item) => (
|
|
||||||
<DropdownMenuItem key={item.id} asChild>
|
|
||||||
<Link
|
|
||||||
href={item.href}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
className="flex items-center gap-2"
|
|
||||||
>
|
|
||||||
<Icon icon={item.icon} width={16} height={16} />
|
|
||||||
<span>{item.label}</span>
|
|
||||||
</Link>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
))}
|
|
||||||
</DropdownMenuContent>
|
|
||||||
</DropdownMenu>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-2 md:hidden">
|
<header className="flex items-center justify-between gap-3 border-b border-border pb-4">
|
||||||
<Sheet>
|
<Link href="/" aria-label="Go to home" className="inline-flex items-center">
|
||||||
<SheetTrigger className="inline-flex h-8 cursor-pointer items-center gap-2 rounded-sm border border-border px-2.5 text-sm text-muted-foreground transition-colors hover:text-foreground">
|
<Avatar className="h-9 w-9 rounded-sm">
|
||||||
<Icon icon="mdi:menu" width={18} height={18} />
|
<AvatarImage src="/logo/logo.jpeg" alt="Poyraz Avsever" />
|
||||||
<span>Menu</span>
|
<AvatarFallback className="rounded-sm bg-muted text-xs font-semibold">
|
||||||
</SheetTrigger>
|
PA
|
||||||
<SheetContent side="right" className="w-72 p-4">
|
</AvatarFallback>
|
||||||
<SheetTitle className="sr-only">Mobile Menu</SheetTitle>
|
</Avatar>
|
||||||
<div className="flex flex-col gap-4">
|
</Link>
|
||||||
<SheetClose asChild>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => setSearchOpen(true)}
|
|
||||||
className="inline-flex h-9 w-full cursor-pointer items-center justify-between rounded-sm border border-border px-3 text-sm text-muted-foreground transition-colors hover:text-foreground"
|
|
||||||
aria-label="Open command palette"
|
|
||||||
>
|
|
||||||
<span className="inline-flex items-center gap-2">
|
|
||||||
<Icon icon="mdi:magnify" width={16} height={16} />
|
|
||||||
<span>Search</span>
|
|
||||||
</span>
|
|
||||||
<span className="text-xs text-muted-foreground/80">{shortcut}</span>
|
|
||||||
</button>
|
|
||||||
</SheetClose>
|
|
||||||
|
|
||||||
<Separator className="bg-border" decorative />
|
<div className="hidden items-center gap-3 md:flex">
|
||||||
|
<nav aria-label="Main navigation">
|
||||||
|
<ul className="flex items-center gap-3">
|
||||||
|
{NAV_LINKS.map((item, index) => (
|
||||||
|
<li key={item.id} className="flex items-center gap-3">
|
||||||
|
{index > 0 && (
|
||||||
|
<Separator orientation="vertical" className="h-4 bg-border" decorative />
|
||||||
|
)}
|
||||||
|
<Link href={item.href} className={getNavLinkClass(isActiveLink(item.href))}>
|
||||||
|
{item.label}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
<nav aria-label="Mobile navigation">
|
<Separator orientation="vertical" className="h-4 bg-border" decorative />
|
||||||
<ul className="space-y-2">
|
<button
|
||||||
{NAV_LINKS.map((item) => (
|
type="button"
|
||||||
<li key={item.id}>
|
onClick={() => setSearchOpen(true)}
|
||||||
<SheetClose asChild>
|
className="inline-flex h-8 w-44 cursor-pointer items-center justify-between rounded-sm border border-border px-2.5 text-sm text-muted-foreground transition-colors hover:text-foreground sm:w-52"
|
||||||
<Link
|
aria-label="Open command palette"
|
||||||
href={item.href}
|
>
|
||||||
className={getNavLinkClass(isActiveLink(item.href))}
|
<span className="inline-flex items-center gap-2">
|
||||||
>
|
<Icon icon="mdi:magnify" width={16} height={16} />
|
||||||
{item.label}
|
<span>Search</span>
|
||||||
</Link>
|
</span>
|
||||||
</SheetClose>
|
<span className="text-xs text-muted-foreground">{shortcut}</span>
|
||||||
</li>
|
</button>
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<Separator className="bg-border" decorative />
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger className="inline-flex h-8 cursor-pointer items-center gap-2 rounded-sm border border-border px-2.5 text-sm text-muted-foreground transition-colors hover:text-foreground">
|
||||||
<div className="grid grid-cols-2 gap-2">
|
<Icon icon="mdi:share-variant" width={16} height={16} />
|
||||||
{SOCIAL_LINKS.map((item) => (
|
<span>Social</span>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end" className="w-52 rounded-sm">
|
||||||
|
<DropdownMenuLabel>Social Links</DropdownMenuLabel>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
|
{SOCIAL_LINKS.map((item) => (
|
||||||
|
<DropdownMenuItem key={item.id} asChild>
|
||||||
<Link
|
<Link
|
||||||
key={item.id}
|
|
||||||
href={item.href}
|
href={item.href}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="inline-flex items-center gap-2 rounded-sm border border-border px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground"
|
className="flex items-center gap-2"
|
||||||
>
|
>
|
||||||
<Icon icon={item.icon} width={14} height={14} />
|
<Icon icon={item.icon} width={16} height={16} />
|
||||||
<span className="truncate">{item.label}</span>
|
<span>{item.label}</span>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
</DropdownMenuItem>
|
||||||
</div>
|
))}
|
||||||
</div>
|
</DropdownMenuContent>
|
||||||
</SheetContent>
|
</DropdownMenu>
|
||||||
</Sheet>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<SearchCommand open={searchOpen} onOpenChange={setSearchOpen} />
|
<div className="flex items-center gap-2 md:hidden">
|
||||||
</header>
|
<Sheet>
|
||||||
|
<SheetTrigger className="inline-flex h-8 cursor-pointer items-center gap-2 rounded-sm border border-border px-2.5 text-sm text-muted-foreground transition-colors hover:text-foreground">
|
||||||
|
<Icon icon="mdi:menu" width={18} height={18} />
|
||||||
|
<span>Menu</span>
|
||||||
|
</SheetTrigger>
|
||||||
|
<SheetContent side="right" className="w-72 p-4">
|
||||||
|
<SheetTitle className="sr-only">Mobile Menu</SheetTitle>
|
||||||
|
<div className="flex flex-col gap-4">
|
||||||
|
<SheetClose asChild>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSearchOpen(true)}
|
||||||
|
className="inline-flex h-9 w-full cursor-pointer items-center justify-between rounded-sm border border-border px-3 text-sm text-muted-foreground transition-colors hover:text-foreground"
|
||||||
|
aria-label="Open command palette"
|
||||||
|
>
|
||||||
|
<span className="inline-flex items-center gap-2">
|
||||||
|
<Icon icon="mdi:magnify" width={16} height={16} />
|
||||||
|
<span>Search</span>
|
||||||
|
</span>
|
||||||
|
<span className="text-xs text-muted-foreground/80">{shortcut}</span>
|
||||||
|
</button>
|
||||||
|
</SheetClose>
|
||||||
|
|
||||||
|
<Separator className="bg-border" decorative />
|
||||||
|
|
||||||
|
<nav aria-label="Mobile navigation">
|
||||||
|
<ul className="space-y-2">
|
||||||
|
{NAV_LINKS.map((item) => (
|
||||||
|
<li key={item.id}>
|
||||||
|
<SheetClose asChild>
|
||||||
|
<Link
|
||||||
|
href={item.href}
|
||||||
|
className={getNavLinkClass(isActiveLink(item.href))}
|
||||||
|
>
|
||||||
|
{item.label}
|
||||||
|
</Link>
|
||||||
|
</SheetClose>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<Separator className="bg-border" decorative />
|
||||||
|
|
||||||
|
<div className="grid grid-cols-2 gap-2">
|
||||||
|
{SOCIAL_LINKS.map((item) => (
|
||||||
|
<Link
|
||||||
|
key={item.id}
|
||||||
|
href={item.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
className="inline-flex items-center gap-2 rounded-sm border border-border px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground"
|
||||||
|
>
|
||||||
|
<Icon icon={item.icon} width={14} height={14} />
|
||||||
|
<span className="truncate">{item.label}</span>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</SheetContent>
|
||||||
|
</Sheet>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<SearchCommand open={searchOpen} onOpenChange={setSearchOpen} />
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user