Files
chatwoot/app/javascript/dashboard/modules/search/components/SearchResultSection.vue
Nithin David Thomas 402428fb4d feat: Splits search api by resources to improve query time [cw-47] (#6942)
* feat: Splits search api by resources to improve query time

* Review fixes

* Spacing fixes

* Update app/javascript/dashboard/modules/search/components/SearchView.vue

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>

* Review fixes

* Refactor searchview

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2023-04-25 17:59:38 +05:30

85 lines
1.6 KiB
Vue

<template>
<section class="result-section">
<div v-if="showTitle" class="header">
<h3 class="text-block-title">{{ title }}</h3>
</div>
<woot-loading-state v-if="isFetching" :message="'Searching'" />
<slot v-else />
<div v-if="empty && !isFetching" class="empty">
<fluent-icon icon="info" size="16px" class="icon" />
<p class="empty-state__text">
{{ $t('SEARCH.EMPTY_STATE', { item: titleCase, query }) }}
</p>
</div>
</section>
</template>
<script>
export default {
props: {
title: {
type: String,
default: '',
},
empty: {
type: Boolean,
default: false,
},
query: {
type: String,
default: '',
},
showTitle: {
type: Boolean,
default: true,
},
isFetching: {
type: Boolean,
default: true,
},
},
computed: {
titleCase() {
return this.title.toLowerCase();
},
},
};
</script>
<style scoped lang="scss">
.result-section {
margin: var(--space-small) 0;
}
.search-list {
list-style: none;
margin: 0;
padding: var(--spacing-normal) 0;
}
.header {
position: sticky;
top: 0;
padding: var(--space-small);
z-index: 50;
background: var(--white);
margin-bottom: var(--space-micro);
}
.empty {
display: flex;
align-items: center;
justify-content: center;
padding: var(--space-medium) var(--space-normal);
margin: var(--space-small);
background: var(--s-25);
border-radius: var(--border-radius-medium);
.icon {
color: var(--s-500);
}
.empty-state__text {
text-align: center;
color: var(--s-500);
margin: 0 var(--space-small);
}
}
</style>