import React from 'react' import clsx from 'clsx' import Link from 'next/link' import { trackCallback } from 'web/lib/service/analytics' export type Item = { name: string trackingEventName?: string href?: string key?: string icon?: React.ComponentType<{ className?: string }> } export function SidebarItem(props: { item: Item currentPage: string onClick?: (key: string) => void }) { const { item, currentPage, onClick } = props const isCurrentPage = item.href != null ? item.href === currentPage : item.key === currentPage const sidebarItem = ( {item.icon && ( ) if (item.href) { return ( {sidebarItem} ) } else { return onClick ? ( ) : ( <> ) } }