35 lines
673 B
Vue
35 lines
673 B
Vue
<template>
|
|
<span>
|
|
<span v-html="props.label"></span>
|
|
|
|
<span
|
|
v-if="isAsc() || isDesc()"
|
|
class="text-black-50"
|
|
>
|
|
<i
|
|
v-if="isAsc()"
|
|
class="ms-1 fa-solid fa-sort-up"
|
|
></i>
|
|
<i
|
|
v-if="isDesc()"
|
|
class="ms-1 fa-solid fa-sort-down"
|
|
></i>
|
|
</span>
|
|
</span>
|
|
</template>
|
|
|
|
<script setup>
|
|
const props = defineProps(['currentOrder', 'currentSort', 'order', 'label'])
|
|
|
|
const isActive = () => {
|
|
return props.currentOrder === props.order
|
|
}
|
|
|
|
const isAsc = () => {
|
|
return isActive() && props.currentSort === 'asc'
|
|
}
|
|
|
|
const isDesc = () => {
|
|
return isActive() && props.currentSort === 'desc'
|
|
}
|
|
</script>
|