update search results

This commit is contained in:
2023-05-23 21:16:48 +02:00
parent 3a40c95496
commit f82b28b896
10 changed files with 174 additions and 85 deletions

View File

@@ -8,30 +8,27 @@ const props = defineProps<{
}>()
const emit = defineEmits<{
goToNote: []
goToNote: [element: HTMLElement | null]
}>()
console.log(props.activeResult)
const element = ref<HTMLElement | null>(null)
</script>
<template>
<li class="flex flex-row">
<li class="flex w-full flex-row" ref="element">
<a
class="flex-grow items-center px-2 py-1"
@click.stop.prevent="() => emit('goToNote')"
class="items-center px-2 py-1 w-full"
@click.stop.prevent="() => emit('goToNote', element)"
@mousedown.prevent
:class="{
disabled: activeNote?.id === result.id,
active: props.activeResult?.id === result.id,
active: props.activeResult?.id === result.id
}"
>
<span
class="badge-ghost badge badge-sm mr-0.5"
v-if="activeNote?.id === result.id"
>
<span class="badge-ghost badge badge-sm mr-0.5" v-if="activeNote?.id === result.id">
current
</span>
<span class="flex-grow">{{ result.title }}</span>
<span>{{ formatDate(result.modified) }}</span>
<span class="flex-grow overflow-hidden whitespace-nowrap">{{ result.title }}</span>
<span class="whitespace-nowrap">{{ formatDate(result.modified) }}</span>
</a>
</li>
</template>