feat(tool): improved favorite tool management

This commit is contained in:
Corentin Thomasset 2022-12-17 15:33:52 +01:00
parent 274ff02b54
commit af075dcccc
No known key found for this signature in database
GPG key ID: DBD997E935996158
3 changed files with 83 additions and 71 deletions

View file

@ -3,22 +3,22 @@ import { useRoute } from 'vue-router';
import { useHead } from '@vueuse/head';
import type { HeadObject } from '@vueuse/head';
import { computed } from 'vue';
import { useThemeVars } from 'naive-ui';
import FavoriteButton from '@/components/FavoriteButton.vue';
import type { Tool } from '@/tools/tools.types';
import BaseLayout from './base.layout.vue';
const route = useRoute();
const theme = useThemeVars();
const head = computed<HeadObject>(() => ({
title: `${route.meta.name} - IT Tools`,
meta: [
{
name: 'description',
content: route.meta.description,
content: route.meta?.description as string,
},
{
name: 'keywords',
content: route.meta.keywords,
content: ((route.meta.keywords ?? []) as string[]).join(','),
},
],
}));
@ -29,22 +29,18 @@ useHead(head);
<base-layout>
<div class="tool-layout">
<div class="tool-header">
<n-h1>
{{ route.meta.name }}
<n-space align="center" justify="space-between" :wrap="false">
<n-h1>
{{ route.meta.name }}
</n-h1>
<n-tag
v-if="route.meta.isNew"
round
type="success"
:bordered="false"
:color="{ color: theme.primaryColor, textColor: theme.tagColor }"
>
New tool
</n-tag>
<!-- <span class="new-tool-badge">New !</span> -->
</n-h1>
<div>
<favorite-button :tool="{name: route.meta.name} as Tool" />
</div>
</n-space>
<div class="separator" />
<div class="description">
{{ route.meta.description }}
</div>
@ -92,6 +88,7 @@ useHead(head);
width: 200px;
height: 2px;
background: rgb(161, 161, 161);
opacity: 0.2;
margin: 10px 0;
}