File size: 1,712 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { House, Files, Code } from 'phosphor-react'
import * as Toolbar from '@radix-ui/react-toolbar'
import * as Tooltip from '@radix-ui/react-tooltip'

import { NavigationButton, NavigationButtonProps } from '../Buttons/NavButton'
import { HeaderSubNavigation } from './HeaderSubNavigation'
import { SiteThemePicker } from '../Site/SiteThemePicker'
import clsx from 'clsx'
import { navList, navSeperator } from './HeaderNavigation.css'

interface NavigationProps {
  className?: string
  showSubNav?: boolean
  showLabels?: boolean
  showThemePicker?: boolean
}

const MAIN_NAV: NavigationButtonProps[] = [
  {
    title: 'Home',
    href: '/',
    Icon: House,
  },
  {
    title: 'Docs',
    href: '/docs',
    Icon: Files,
  },
  // {
  //   title: 'Tutorials',
  //   href: '/tutorials',
  //   Icon: Books,
  // },
  {
    title: 'Examples',
    href: '/examples',
    Icon: Code,
  },
]

export const HeaderNavigation = ({
  className,
  showSubNav = true,
  showLabels = false,
  showThemePicker = true,
}: NavigationProps) => {
  return (
    <Tooltip.TooltipProvider>
      <Toolbar.Root className={clsx(navList, className)}>
        {MAIN_NAV.map(props => (
          <NavigationButton
            showLabel={showLabels}
            key={props.title}
            {...props}
          />
        ))}
        {showSubNav && (
          <>
            <Toolbar.Separator className={navSeperator} />
            <HeaderSubNavigation showLabels={showLabels} />
          </>
        )}
        {showThemePicker && (
          <>
            <Toolbar.Separator className={navSeperator} />
            <SiteThemePicker />
          </>
        )}
      </Toolbar.Root>
    </Tooltip.TooltipProvider>
  )
}