All files / web/src/components/shared SearchInfo.vue

0% Statements 0/11
100% Branches 1/1
100% Functions 1/1
0% Lines 0/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54                                                                                                           
<script setup lang="ts">
import { ElButton } from 'element-plus'
 
interface Props {
  count: number
  searchQuery: string
  itemName?: string
}
 
withDefaults(defineProps<Props>(), {
  itemName: 'item'
})
 
const emit = defineEmits<{
  clear: []
}>()
 
function handleClear() {
  emit('clear')
}
</script>
 
<template>
  <div v-if="searchQuery" class="search-info">
    <span class="search-info__text">
      Found {{ count }} {{ itemName }}{{ count !== 1 ? 's' : '' }} matching "{{ searchQuery }}"
    </span>
    <ElButton link @click="handleClear">Clear</ElButton>
  </div>
</template>
 
<style lang="scss" scoped>
.search-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--rf-spacing-md) var(--rf-spacing-lg);
  margin-top: var(--rf-spacing-lg);
  background: var(--rf-color-info-lighter);
  border-radius: var(--rf-radius-base);
 
  &__text {
    color: var(--rf-color-text-regular);
    font-size: var(--rf-font-size-sm);
  }
}
 
html.dark {
  .search-info {
    background: var(--rf-color-bg-container);
    border: 1px solid var(--rf-color-border-lighter);
  }
}
</style>