/* This example requires Tailwind CSS v2.0+ */ import { Button } from '@fluid-design/fluid-ui'; import { motion, useTransform } from 'framer-motion'; import Link from 'next/link'; import { useEffect, useRef, useState } from 'react'; import { IoLogoGithub } from 'react-icons/io'; import { useScrolled } from '@/lib'; import clsxm from '@/lib/clsxm'; import { MobileSearch, Search } from '@/components/framework/Search'; import { MobileSidebar } from '@/components/framework/Sidebar'; import { TOC } from '../mdx'; import { ThemeSwitch } from '../ThemeSwitch'; import AppLogo from '../ui/AppLogo'; export const Navbar = ({ sidebar, ...props }) => { const menuBarRef = useRef(null); const [hasScrolled, scrollY] = useScrolled(); const bgOpacityLight = useTransform(scrollY, [0, 128], [0.5, 0.9]); const bgOpacityDark = useTransform(scrollY, [0, 128], [0, 0.8]); const [isWithinTop, setWithinTop] = useState(true); const scrollHandler = () => { setWithinTop(window.scrollY < 100); }; useEffect(() => { return scrollY.on('change', scrollHandler); }, [scrollY]); return ( ); };