Skip to content

Commit

Permalink
feat(my-history): change history query filters' prop
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramargar committed Nov 2, 2023
1 parent b78ef52 commit ffc4441
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
13 changes: 5 additions & 8 deletions src/components/history-query-filters.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<template>
<div
v-if="suggestion.selectedFilters && suggestion.selectedFilters.length"
class="x-text1-sm x-flex x-gap-8 x-text-lead-50"
>
<div v-if="filtersList && filtersList.length" class="x-text1-sm x-flex x-gap-8 x-text-lead-50">
<div class="x-truncate">
<span v-for="filter in suggestion.selectedFilters" :key="filter.id" class="x-pr-8">
<span v-for="filter in filtersList" :key="filter.id" class="x-pr-8">
{{ filter.label }}
</span>
</div>
<span>({{ suggestion.selectedFilters.length }})</span>
<span>({{ filtersList.length }})</span>
</div>
</template>

Expand All @@ -18,8 +15,8 @@
export default defineComponent({
props: {
suggestion: {
type: Object as PropType<HistoryQuery>,
filtersList: {
type: Array as PropType<HistoryQuery['selectedFilters']>,
required: true
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/my-history/custom-my-history.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
<div class="x-group x-flex x-flex-col x-gap-2">
<p class="group-hover:x-underline">{{ suggestion.query }}</p>

<HistoryQueryFilters class="x-w-224 desktop:x-w-320" :suggestion="suggestion" />
<HistoryQueryFilters
class="x-w-224 desktop:x-w-320"
:filtersList="suggestion.selectedFilters"
/>

<p class="x-text1 x-text1-sm x-text-neutral-75">
{{ formatTime(suggestion.timestamp) }}
Expand Down
5 changes: 4 additions & 1 deletion src/components/predictive-layer/full-width-predictive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
:highlight="query"
class="group-hover:x-underline"
/>
<HistoryQueryFilters class="x-w-128" :suggestion="suggestion" />
<HistoryQueryFilters
class="x-w-128"
:filtersList="suggestion.selectedFilters"
/>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/components/predictive-layer/predictive-layer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<Highlight :text="suggestion.query" :highlight="query" />
<HistoryQueryFilters
class="x-w-192 desktop:x-w-128"
:suggestion="suggestion"
:filtersList="suggestion.selectedFilters"
/>
</div>
</template>
Expand Down

0 comments on commit ffc4441

Please sign in to comment.