HomeButton.tsx raw

   1  import { usePrimaryPage } from '@/PageManager'
   2  import { useKeyboardNavigation } from '@/providers/KeyboardNavigationProvider'
   3  import { Home } from 'lucide-react'
   4  import SidebarItem from './SidebarItem'
   5  
   6  export default function HomeButton({ collapse, navIndex }: { collapse: boolean; navIndex?: number }) {
   7    const { navigate, current, display } = usePrimaryPage()
   8    const { resetPrimarySelection, clearColumn } = useKeyboardNavigation()
   9  
  10    const handleClick = () => {
  11      navigate('home')
  12      clearColumn(1)
  13      resetPrimarySelection()
  14    }
  15  
  16    return (
  17      <SidebarItem
  18        title="Home"
  19        onClick={handleClick}
  20        active={display && current === 'home'}
  21        collapse={collapse}
  22        navIndex={navIndex}
  23      >
  24        <Home />
  25      </SidebarItem>
  26    )
  27  }
  28