"use client"; import { Icon } from "@iconify/react"; import dynamic from "next/dynamic"; import { Link, usePathname } from "@/i18n/routing"; import { useLocale, useTranslations } from "next-intl"; import { LanguageSwitcher } from "@/components/language-switcher"; import { useState } from "react"; import { Button, ButtonIcon, ButtonLabel, Logo, Separator, } from "poyraz-ui/atoms"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Sheet, SheetClose, SheetContent, SheetTitle, SheetTrigger, Tabs, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "poyraz-ui/molecules"; import { NavbarTopBar, NavbarTopBarSection } from "poyraz-ui/organisms"; import { useKeyboardShortcutLabel } from "@/lib/use-keyboard-shortcut-label"; import { getResumeHref, NAV_LINKS, SOCIAL_LINKS, TOP_ICON_LINKS } from "@/lib/links"; import type { ThemeMode } from "@/components/app-shell"; const SearchCommand = dynamic( () => import("@/components/search-command").then((mod) => mod.SearchCommand), { ssr: false }, ); const slowShineClassName = "[--poyraz-motion-duration-deliberate:1100ms]"; function getNavLinkClass(isActive: boolean) { return [ "inline-flex border-b-2 pb-1 text-sm transition-colors md:border-0 md:pb-0", isActive ? "border-red-600 text-foreground" : "border-transparent text-foreground/55 hover:text-foreground", ].join(" "); } type ThemeToggleProps = { theme: ThemeMode; onThemeChange: (theme: ThemeMode) => void; }; function ThemeToggle({ theme, onThemeChange }: ThemeToggleProps) { const nextTheme = theme === "dark" ? "light" : "dark"; const label = theme === "dark" ? "Light mode" : "Dark mode"; return ( ); } type SiteNavbarProps = ThemeToggleProps; export function SiteNavbar({ theme, onThemeChange }: SiteNavbarProps) { const pathname = usePathname(); const [searchOpen, setSearchOpen] = useState(false); const shortcut = useKeyboardShortcutLabel(); const t = useTranslations("Nav"); const locale = useLocale(); const isActiveLink = (href: string) => { if (href === "/") return pathname === "/"; return pathname === href || pathname.startsWith(`${href}/`); }; const activeTab = NAV_LINKS.find((item) => isActiveLink(item.href))?.id; const languageLabel = locale === "tr" ? "Switch to English" : "Türkçe'ye geç"; return (
{TOP_ICON_LINKS.map((item) => { const href = item.id === "cv" ? getResumeHref(locale) : item.href; const label = t.has(item.id) ? t(item.id) : item.label; return ( {label} ); })} {languageLabel} {locale === "tr" ? "Tema değiştir" : "Toggle theme"}
{NAV_LINKS.map((item, index) => (
{index > 0 && ( )} {t(item.id)}
))}
{t("socialLinks")} {SOCIAL_LINKS.map((item) => ( {item.label} ))}
{t("mobileMenu")}
{SOCIAL_LINKS.map((item) => ( {item.label} ))}
); }