Files
tolaria/src/components/WikilinkSuggestionMenu.tsx
Luca Rossi f351ed9a1d feat: use light type color as background for note type labels (#93)
Type labels in autocomplete dropdowns (wiki-link [[, relation add,
Cmd+P quick open) and search panel now use the light/muted variant
of the type color as background instead of grey. This matches the
existing color convention used in wiki-link chips and inspector panels.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:43:29 +00:00

40 lines
1.1 KiB
TypeScript

import type { ComponentType, SVGAttributes } from 'react'
import { NoteSearchList } from './NoteSearchList'
import './WikilinkSuggestionMenu.css'
export interface WikilinkSuggestionItem {
title: string
onItemClick: () => void
noteType?: string
typeColor?: string
typeLightColor?: string
TypeIcon?: ComponentType<SVGAttributes<SVGSVGElement>>
aliases?: string[]
entryTitle?: string
path?: string
}
interface WikilinkSuggestionMenuProps {
items: WikilinkSuggestionItem[]
loadingState: 'loading-initial' | 'loading' | 'loaded'
selectedIndex: number | undefined
onItemClick?: (item: WikilinkSuggestionItem) => void
}
export function WikilinkSuggestionMenu({ items, selectedIndex, onItemClick }: WikilinkSuggestionMenuProps) {
return (
<div className="wikilink-menu">
<NoteSearchList
items={items}
selectedIndex={selectedIndex ?? 0}
getItemKey={(item, i) => `${item.title}-${item.path ?? i}`}
onItemClick={(item) => {
item.onItemClick()
onItemClick?.(item)
}}
emptyMessage="No results"
/>
</div>
)
}