aboutsummaryrefslogtreecommitdiff
path: root/src/tools/html-wysiwyg-editor/editor/menu-bar-item.vue
blob: 9a4cf1bdded2d2ada7adcf9528a2f16524bb2611 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script setup lang="ts">
import type { Component } from 'vue';

const props = defineProps<{ icon: Component; title: string; action: () => void; isActive?: () => boolean }>();
const { icon, title, action, isActive } = toRefs(props);
</script>

<template>
  <n-tooltip trigger="hover">
    <template #trigger>
      <c-button circle variant="text" :type="isActive?.() ? 'primary' : 'default'" @click="action">
        <n-icon :component="icon" />
      </c-button>
    </template>

    {{ title }}
  </n-tooltip>
</template>