chore: Search improvements (#10801)

- Adds pagination support for search.
- Use composition API on all search related component.
- Minor UI improvements.
- Adds missing specs

Loom video
https://www.loom.com/share/5b01afa5c9204e7d97ff81b215621dde?sid=82ca6d22-ca8c-4d5e-8740-ba06ca4051ba
This commit is contained in:
Sivin Varghese
2025-02-03 19:34:50 +05:30
committed by GitHub
parent 3fb77fe806
commit bd94e5062d
20 changed files with 898 additions and 646 deletions

View File

@@ -1,39 +1,38 @@
<script>
export default {
props: {
tabs: {
type: Array,
default: () => [],
},
selectedTab: {
type: Number,
default: 0,
},
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
tabs: {
type: Array,
default: () => [],
},
emits: ['tabChange'],
data() {
return {
activeTab: 0,
};
},
watch: {
selectedTab(value, oldValue) {
if (value !== oldValue) {
this.activeTab = this.selectedTab;
}
},
},
methods: {
onTabChange(index) {
this.activeTab = index;
this.$emit('tabChange', this.tabs[index].key);
},
selectedTab: {
type: Number,
default: 0,
},
});
const emit = defineEmits(['tabChange']);
const activeTab = ref(props.selectedTab);
watch(
() => props.selectedTab,
(value, oldValue) => {
if (value !== oldValue) {
activeTab.value = props.selectedTab;
}
}
);
const onTabChange = index => {
activeTab.value = index;
emit('tabChange', props.tabs[index].key);
};
</script>
<template>
<div class="tab-container">
<div class="mt-1 border-b border-n-weak">
<woot-tabs :index="activeTab" :border="false" @change="onTabChange">
<woot-tabs-item
v-for="(item, index) in tabs"
@@ -41,13 +40,8 @@ export default {
:index="index"
:name="item.name"
:count="item.count"
:show-badge="item.showBadge"
/>
</woot-tabs>
</div>
</template>
<style lang="scss" scoped>
.tab-container {
@apply mt-1 border-b border-solid border-slate-100 dark:border-slate-800/50;
}
</style>