From b23fbb32daedf581d50657a2ed515e73f7b416bb Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Tue, 17 Dec 2024 14:21:56 +0100 Subject: [PATCH] refactor: refator variables names --- .../components/related-prompt.vue | 18 ++++++------- .../components/related-prompts-tag-list.vue | 26 ++++++++++++------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/packages/x-components/src/x-modules/related-prompts/components/related-prompt.vue b/packages/x-components/src/x-modules/related-prompts/components/related-prompt.vue index d8068d7e6..a0d663ede 100644 --- a/packages/x-components/src/x-modules/related-prompts/components/related-prompt.vue +++ b/packages/x-components/src/x-modules/related-prompts/components/related-prompt.vue @@ -2,13 +2,13 @@ @@ -49,7 +49,11 @@ type: Object as PropType, required: true }, - isVisible: { + arePromptsVisible: { + type: Boolean, + default: false + }, + isSelected: { type: Boolean, default: false }, @@ -66,14 +70,10 @@ x.emit('UserSelectedARelatedPrompt', index); }; - const isSelected = (index: number): boolean => selectedPrompt.value === index; - return { - isSelected, selectedPrompt, toggleSuggestion }; } }); - diff --git a/packages/x-components/src/x-modules/related-prompts/components/related-prompts-tag-list.vue b/packages/x-components/src/x-modules/related-prompts/components/related-prompts-tag-list.vue index db41a23e1..2bc9dc5bb 100644 --- a/packages/x-components/src/x-modules/related-prompts/components/related-prompts-tag-list.vue +++ b/packages/x-components/src/x-modules/related-prompts/components/related-prompts-tag-list.vue @@ -28,14 +28,22 @@ }" class="x-related-prompt x-staggered-initial" :class="[ - { 'x-staggered-animation': isVisible }, - { 'x-hidden': shouldHideButton(index) }, + { 'x-staggered-animation': arePromptsVisible }, + { 'x-hidden': hidePrompt(index) }, { 'x-related-prompt-selected': isSelected(index) } ]" data-test="related-prompt-item" > - - + + @@ -68,10 +76,10 @@ ]); const slidingPanelContent = ref(); - const isVisible = ref(false); + const arePromptsVisible = ref(false); const observer = new IntersectionObserver(([entry]) => { - isVisible.value = entry.isIntersecting; + arePromptsVisible.value = entry.isIntersecting; }); onMounted(() => { @@ -84,12 +92,12 @@ const isSelected = (index: number): boolean => selectedPrompt.value === index; - const shouldHideButton = (index: number): boolean => + const hidePrompt = (index: number): boolean => selectedPrompt.value !== -1 && selectedPrompt.value !== index; return { - isVisible, - shouldHideButton, + arePromptsVisible, + hidePrompt, isSelected, relatedPrompts, selectedPrompt,