import { useState, useEffect } from 'react' import { ThemePicker, ns as themeNs } from 'shared/components/theme-picker/index.mjs' import { LocalePicker, ns as localeNs } from 'shared/components/locale-picker/index.mjs' import { CloseIcon, CommunityIcon, DesignIcon, DiscordIcon, DocsIcon, GithubIcon, HeartIcon, HelpIcon, HomeIcon, MenuIcon, RssIcon, SearchIcon, ShowcaseIcon, UserIcon, ThemeIcon, I18nIcon, } from 'shared/components/icons.mjs' import { Ribbon } from 'shared/components/ribbon.mjs' import { WordMark } from 'shared/components/wordmark.mjs' import Link from 'next/link' import { useTranslation } from 'next-i18next' import { ModalThemePicker } from 'shared/components/modal/theme-picker.mjs' export const ns = [...new Set(['header', ...themeNs, ...localeNs])] const MainMenu = () =>

Main menu here

const NavButton = ({ href, label, color, children, onClick = false, extraClasses = '' }) => { const className = 'border-0 px-1 lg:px-4 text-base py-3 lg:py-4 text-center flex flex-col items-center 2xl:w-36 ' + `hover:bg-${color}-400 text-${color}-400 hover:text-neutral grow lg:grow-0 ${extraClasses}` const span = {label} return onClick ? ( ) : ( {children} {span} ) } const NavSpacer = () => (
|
) const NavIcons = ({ app }) => { const { t } = useTranslation(['header']) const iconSize = 'h-6 w-6 lg:h-12 lg:w-12' return ( <> app.setModal()} label={t('header:menu')} color="red"> app.setModal()} label={t('header:theme')} color="blue" > setSearch(true)} label={t('header:search')} color="violet"> ) } export const Header = ({ app, setSearch }) => { const [prevScrollPos, setPrevScrollPos] = useState(0) const [show, setShow] = useState(true) useEffect(() => { if (typeof window !== 'undefined') { const handleScroll = () => { const curScrollPos = typeof window !== 'undefined' ? window.pageYOffset : 0 if (curScrollPos >= prevScrollPos) { if (show && curScrollPos > 20) setShow(false) } else setShow(true) setPrevScrollPos(curScrollPos) } window.addEventListener('scroll', handleScroll) return () => window.removeEventListener('scroll', handleScroll) } }, [prevScrollPos, show]) return (
{/* Non-mobile content */}
{/* Mobile content */}
) }