MobileViewNav.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { PropsWithChildren } from 'react'
  2. import { cn } from 'ui'
  3. import { useAppStateSnapshot } from '@/state/app-state'
  4. interface Props {
  5. title?: string
  6. }
  7. const MobileViewNav = ({ title }: PropsWithChildren<Props>) => {
  8. const { mobileMenuOpen, setMobileMenuOpen } = useAppStateSnapshot()
  9. return (
  10. <nav
  11. className={cn(
  12. 'group px-4 z-10 w-full h-10',
  13. 'border-b border-default',
  14. 'transition-width duration-200',
  15. 'flex md:hidden flex-row items-center gap-1 overflow-x-auto'
  16. )}
  17. >
  18. <button
  19. title="Menu dropdown button"
  20. className={cn(
  21. 'group/view-toggle flex justify-center flex-col border-none space-x-0 items-start gap-1 bg-transparent! rounded-md min-w-[30px] w-[30px] h-[30px]'
  22. )}
  23. onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
  24. >
  25. <div className="h-px inline-block left-0 w-4 transition-all ease-out bg-foreground-lighter group-hover/view-toggle:bg-foreground p-0 m-0" />
  26. <div className="h-px inline-block left-0 w-3 transition-all ease-out bg-foreground-lighter group-hover/view-toggle:bg-foreground p-0 m-0" />
  27. </button>
  28. <div className="flex items-center">
  29. <h4 className="text-base">{title}</h4>
  30. </div>
  31. </nav>
  32. )
  33. }
  34. export default MobileViewNav