1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<script lang="ts" setup>
import { useRoute } from 'vue-router';
import { useHead } from '@vueuse/head';
import type { HeadObject } from '@vueuse/head';
import BaseLayout from './base.layout.vue';
import FavoriteButton from '@/components/FavoriteButton.vue';
import type { Tool } from '@/tools/tools.types';
const route = useRoute();
const head = computed<HeadObject>(() => ({
title: `${route.meta.name} - IT Tools`,
meta: [
{
name: 'description',
content: route.meta?.description as string,
},
{
name: 'keywords',
content: ((route.meta.keywords ?? []) as string[]).join(','),
},
],
}));
useHead(head);
const { t } = useI18n();
const i18nKey = computed<string>(() => route.path.trim().replace('/', ''));
const toolTitle = computed<string>(() => t(`tools.${i18nKey.value}.title`, String(route.meta.name)));
const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.description`, String(route.meta.description)));
</script>
<template>
<BaseLayout>
<div class="tool-layout">
<div class="tool-header">
<div flex flex-nowrap items-center justify-between>
<n-h1>
{{ toolTitle }}
</n-h1>
<div>
<FavoriteButton :tool="{ name: route.meta.name } as Tool" />
</div>
</div>
<div class="separator" />
<div class="description">
{{ toolDescription }}
</div>
</div>
</div>
<div class="tool-content">
<slot />
</div>
</BaseLayout>
</template>
<style lang="less" scoped>
.tool-content {
display: flex;
flex-direction: row;
justify-content: center;
align-items: flex-start;
flex-wrap: wrap;
gap: 16px;
::v-deep(& > *) {
flex: 0 1 600px;
}
}
.tool-layout {
max-width: 600px;
margin: 0 auto;
box-sizing: border-box;
.tool-header {
padding: 40px 0;
width: 100%;
.n-h1 {
opacity: 0.9;
font-size: 40px;
font-weight: 400;
margin: 0;
line-height: 1;
}
.separator {
width: 200px;
height: 2px;
background: rgb(161, 161, 161);
opacity: 0.2;
margin: 10px 0;
}
.description {
margin: 0;
opacity: 0.7;
}
}
}
</style>
|