NavFooter.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { type ComponentPropsWithoutRef } from 'react';
  2. import { Icon } from '@/common/Icon';
  3. import { type NavItem } from '@/common/types';
  4. import { SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '@/shadcn/sidebar';
  5. export function NavFooter({
  6. items,
  7. className,
  8. ...props
  9. }: ComponentPropsWithoutRef<typeof SidebarGroup> & {
  10. items: NavItem[];
  11. }) {
  12. return (
  13. <SidebarGroup {...props} className={`group-data-[collapsible=icon]:p-0 ${className || ''}`}>
  14. <SidebarGroupContent>
  15. <SidebarMenu>
  16. {items.map((item) => (
  17. <SidebarMenuItem key={item.title}>
  18. <SidebarMenuButton
  19. asChild
  20. className="text-neutral-600 hover:text-neutral-800 dark:text-neutral-300 dark:hover:text-neutral-100"
  21. >
  22. <a href={typeof item.href === 'string' ? item.href : item.href.url} target="_blank" rel="noopener noreferrer">
  23. {item.icon && <Icon iconNode={item.icon} className="h-5 w-5" />}
  24. <span>{item.title}</span>
  25. </a>
  26. </SidebarMenuButton>
  27. </SidebarMenuItem>
  28. ))}
  29. </SidebarMenu>
  30. </SidebarGroupContent>
  31. </SidebarGroup>
  32. );
  33. }