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

46 lines
1005 B
Vue
Raw Permalink 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>
2024-07-25 00:17:31 +02:00
<span v-if="text" v-text="text"></span>
<slot></slot>
2024-06-19 22:00:18 +02:00
</div>
</template>
<script setup>
const emit = defineEmits(['toggle']);
const levelMap = {
0: '',
1: 'pl-7',
2: 'pl-14',
};
const props = defineProps({
text: {
2024-07-25 00:17:31 +02:00
required: false,
2024-06-19 22:00:18 +02:00
type: String,
2024-07-25 00:17:31 +02:00
default: () => '',
2024-06-19 22:00:18 +02:00
},
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>