aboutsummaryrefslogtreecommitdiff
path: root/src/components/FavoriteButton.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/FavoriteButton.vue')
-rw-r--r--src/components/FavoriteButton.vue39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/components/FavoriteButton.vue b/src/components/FavoriteButton.vue
index 60b2a2b..16df18a 100644
--- a/src/components/FavoriteButton.vue
+++ b/src/components/FavoriteButton.vue
@@ -1,29 +1,13 @@
-<template>
- <n-tooltip trigger="hover">
- <template #trigger>
- <c-button
- variant="text"
- circle
- :type="buttonType"
- :style="{ opacity: isFavorite ? 1 : 0.2 }"
- @click="toggleFavorite"
- >
- <n-icon :component="FavoriteFilled" />
- </c-button>
- </template>
- {{ isFavorite ? 'Remove from favorites' : 'Add to favorites' }}
- </n-tooltip>
-</template>
-
<script setup lang="ts">
import { FavoriteFilled } from '@vicons/material';
+import { computed, toRefs } from 'vue';
import { useToolStore } from '@/tools/tools.store';
import type { Tool } from '@/tools/tools.types';
-import { computed, toRefs } from 'vue';
+
+const props = defineProps<{ tool: Tool }>();
const toolStore = useToolStore();
-const props = defineProps<{ tool: Tool }>();
const { tool } = toRefs(props);
const isFavorite = computed(() => toolStore.isToolFavorite({ tool }));
@@ -40,3 +24,20 @@ function toggleFavorite(event: MouseEvent) {
toolStore.addToolToFavorites({ tool });
}
</script>
+
+<template>
+ <n-tooltip trigger="hover">
+ <template #trigger>
+ <c-button
+ variant="text"
+ circle
+ :type="buttonType"
+ :style="{ opacity: isFavorite ? 1 : 0.2 }"
+ @click="toggleFavorite"
+ >
+ <n-icon :component="FavoriteFilled" />
+ </c-button>
+ </template>
+ {{ isFavorite ? 'Remove from favorites' : 'Add to favorites' }}
+ </n-tooltip>
+</template>