'use client'; import React, { useEffect, useState } from 'react'; import { Button, Image } from '@nextui-org/react'; import { IoFileTrayFull, IoHome, IoInformationCircle, IoLogoGithub, IoMail, IoPencil, IoPricetags, IoSearch } from 'react-icons/io5'; import Link from 'next/link'; import ThemeSwitcher from '@/components/ThemeSwitcher'; import { usePathname } from 'next/navigation'; const entries: { display_name: string; href: string; icon: React.ReactNode }[] = [ { icon: , display_name: 'Home', href: '/' }, { icon: , display_name: 'About', href: '/about' }, { icon: , display_name: 'Blog', href: '/blog' }, { icon: , display_name: 'Tags', href: '/tags' }, { icon: , display_name: 'Archive', href: '/archive' }, { icon: , display_name: 'Search', href: '/search' } ]; const connections: { label: string, href: string, icon: React.ReactNode }[] = [ { label: 'Github', href: 'https://github.com/Lumither', icon: }, { label: 'email', href: 'mailto:lumither@outlook.com', icon: } ]; function Navbar() { const [ scrolled, setScrolled ] = useState(false); useEffect(() => { const handleScroll = () => { const isScrolled = window.scrollY > 0; setScrolled(isScrolled); }; window.addEventListener('scroll', handleScroll); return () => { window.removeEventListener('scroll', handleScroll); }; }, []); const path = usePathname(); const [ shownPath, setShownPath ] = useState(path); useEffect(() => { let trimmed_path = path.split(`/`)[1]; if (trimmed_path === '') { setShownPath('HOME'); } else { setShownPath(trimmed_path.toUpperCase()); } }, [ path ]); const minMobileWidth: number = 768; const [ isMobile, setIsMobile ] = useState(false); useEffect(() => { const updateMobileWidth = () => { if (window.innerWidth <= minMobileWidth) { setIsMobile(true); } else { setIsMobile(false); } }; updateMobileWidth(); window.addEventListener('resize', updateMobileWidth); return () => { window.removeEventListener('resize', updateMobileWidth); }; }, []); return ( <>
{

Lumither Tao

Ad Astra

    { connections.map((conn, key) => (
  • )) }
    { entries.map((meta, key) => (
  • )) }

{ shownPath }

); } export default Navbar;