adrema/resources/js/components/ui/TableToggleButton.vue

44 lines
943 B
Vue
Raw Normal View History

2024-06-19 22:00:18 +02:00
<template>
<div class="flex space-x-2" :class="levelMap[level]">
<a
2024-06-19 22:36:24 +02:00
v-if="value.children_count > 0"
2024-06-19 22:00:18 +02:00
v-tooltip="active ? 'Schließen' : 'Öffnen'"
href="#"
class="inline-flex items-center justify-center bg-blue-700 text-blue-100 rounded w-5 h-5"
@click.prevent="emit('toggle')"
>
<ui-sprite class="w-3 h-3" :src="active ? 'close' : 'plus'"></ui-sprite>
</a>
<span v-text="text"></span>
</div>
</template>
<script setup>
const emit = defineEmits(['toggle']);
const levelMap = {
0: '',
1: 'pl-7',
2: 'pl-14',
};
const props = defineProps({
text: {
required: true,
type: String,
},
2024-06-19 22:36:24 +02:00
value: {
type: Object,
2024-06-19 22:00:18 +02:00
required: true,
},
active: {
type: Boolean,
required: true,
},
level: {
required: true,
type: Number,
},
});
</script>