index.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React from 'react'
  2. import NavLink from './navLink'
  3. import AppBasic from './basic'
  4. import type { NavIcon } from './navLink'
  5. export type IAppDetailNavProps = {
  6. iconType?: 'app' | 'dataset' | 'notion'
  7. title: string
  8. desc: string
  9. icon: string
  10. icon_background: string
  11. navigation: Array<{
  12. name: string
  13. href: string
  14. icon: NavIcon
  15. selectedIcon: NavIcon
  16. }>
  17. extraInfo?: React.ReactNode
  18. }
  19. const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInfo, iconType = 'app' }: IAppDetailNavProps) => {
  20. return (
  21. <div className="flex flex-col w-56 overflow-y-auto bg-white border-r border-gray-200 shrink-0">
  22. <div className="flex flex-shrink-0 p-4">
  23. <AppBasic iconType={iconType} icon={icon} icon_background={icon_background} name={title} type={desc} />
  24. </div>
  25. <nav className="flex-1 p-4 space-y-1 bg-white">
  26. {navigation.map((item, index) => {
  27. return (
  28. <NavLink key={index} iconMap={{ selected: item.selectedIcon, normal: item.icon }} name={item.name} href={item.href} />
  29. )
  30. })}
  31. {extraInfo ?? null}
  32. </nav>
  33. </div>
  34. )
  35. }
  36. export default React.memo(AppDetailNav)