import Link from 'next/link' import { Badge, Button, Menu } from 'ui' import { ProductMenuGroupItem } from './ProductMenu.types' import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip' interface ProductMenuItemProps { item: ProductMenuGroupItem isActive: boolean target?: '_blank' | '_self' hoverText?: string onClick?: () => void } export const ProductMenuItem = ({ item, isActive, target = '_self', hoverText = '', onClick, }: ProductMenuItemProps) => { const { name = '', url = '', icon, rightIcon, isExternal, label, disabled, shortcutId } = item const menuItem = (
{name} {label !== undefined && ( {label} )}
{rightIcon &&
{rightIcon}
}
) if (disabled) { return
{menuItem}
} if (url) { if (isExternal) { const externalLink = ( ) return shortcutId ? ( {externalLink} ) : ( externalLink ) } const link = ( {menuItem} ) return shortcutId ? ( {link} ) : ( link ) } return menuItem }