From 4740d6070fa9e39314926e9bf972e848ba0e7006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20K=C3=B6nig?= Date: Wed, 17 Apr 2024 21:22:38 +0200 Subject: [PATCH] refactor --- src/components/search/SearchResult.vue | 11 +++-------- src/composables/components/search/SearchResult.ts | 10 +++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/search/SearchResult.vue b/src/components/search/SearchResult.vue index 688e9c67..6135d675 100644 --- a/src/components/search/SearchResult.vue +++ b/src/components/search/SearchResult.vue @@ -24,22 +24,17 @@ import EditDocument from './EditDocument.vue' import { useSearchResult } from '../../composables/components/search/SearchResult.ts' import type { SearchResultProps } from '../../composables/components/search/SearchResult.ts' - import { ref } from 'vue' const props = defineProps() const emit = defineEmits<{ reload: [] }>() - const buttonsVisible = ref(false) - const onIntersection = (entry: IntersectionObserverEntry) => { - if (entry.isIntersecting) console.log("yes") - buttonsVisible.value = entry.isIntersecting - return true - } const { resultColumns, edit, showDocument, deleteDocument, - renderValue + renderValue, + buttonsVisible, + onIntersection } = useSearchResult(props, emit) diff --git a/src/composables/components/search/SearchResult.ts b/src/composables/components/search/SearchResult.ts index 0bc7ccc5..edb6ec11 100644 --- a/src/composables/components/search/SearchResult.ts +++ b/src/composables/components/search/SearchResult.ts @@ -48,11 +48,19 @@ export const useSearchResult = (props: SearchResultProps, emit: any) => { } } + const buttonsVisible = ref(false) + const onIntersection = (entry: IntersectionObserverEntry) => { + buttonsVisible.value = entry.isIntersecting + return true + } + return { resultColumns, edit, showDocument, deleteDocument, - renderValue + renderValue, + buttonsVisible, + onIntersection } } \ No newline at end of file