it-tools/src/layouts/tool.layout.vue

109 lines
2.2 KiB
Vue
Raw Normal View History

2022-04-04 00:24:45 +02:00
<script lang="ts" setup>
import { useRoute } from 'vue-router';
2022-04-22 23:31:40 +02:00
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';
2022-04-04 00:24:45 +02:00
2022-04-22 23:31:40 +02:00
const route = useRoute();
2022-04-04 00:24:45 +02:00
2022-06-02 00:58:31 +02:00
const head = computed<HeadObject>(() => ({
2022-04-22 23:31:40 +02:00
title: `${route.meta.name} - IT Tools`,
meta: [
{
name: 'description',
content: route.meta?.description as string,
2022-04-22 23:31:40 +02:00
},
{
name: 'keywords',
content: ((route.meta.keywords ?? []) as string[]).join(','),
2022-04-22 23:31:40 +02:00
},
],
2022-06-02 00:58:31 +02:00
}));
2022-04-22 23:31:40 +02:00
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)));
2022-04-04 00:24:45 +02:00
</script>
<template>
<BaseLayout>
2022-04-15 23:10:47 +02:00
<div class="tool-layout">
<div class="tool-header">
2023-05-27 17:36:15 +02:00
<div flex flex-nowrap items-center justify-between>
<n-h1>
{{ toolTitle }}
</n-h1>
<div>
<FavoriteButton :tool="{ name: route.meta.name, path: route.path } as Tool" />
</div>
2023-05-27 17:36:15 +02:00
</div>
2022-04-15 23:10:47 +02:00
<div class="separator" />
2022-04-15 23:10:47 +02:00
<div class="description">
{{ toolDescription }}
2022-04-04 00:24:45 +02:00
</div>
2022-04-15 23:10:47 +02:00
</div>
</div>
2022-04-15 23:10:47 +02:00
<div class="tool-content">
2022-04-15 23:10:47 +02:00
<slot />
</div>
</BaseLayout>
2022-04-04 00:24:45 +02:00
</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;
}
}
2022-04-04 00:24:45 +02:00
.tool-layout {
max-width: 600px;
2022-04-22 23:31:40 +02:00
margin: 0 auto;
box-sizing: border-box;
2022-04-04 00:24:45 +02:00
2022-04-22 23:31:40 +02:00
.tool-header {
padding: 40px 0;
width: 100%;
2022-04-15 12:21:09 +02:00
2022-04-22 23:31:40 +02:00
.n-h1 {
opacity: 0.9;
font-size: 40px;
font-weight: 400;
margin: 0;
line-height: 1;
}
2022-04-15 12:21:09 +02:00
2022-04-22 23:31:40 +02:00
.separator {
width: 200px;
height: 2px;
background: rgb(161, 161, 161);
opacity: 0.2;
2022-04-04 00:24:45 +02:00
2022-04-22 23:31:40 +02:00
margin: 10px 0;
}
2022-04-15 12:21:09 +02:00
2022-04-22 23:31:40 +02:00
.description {
margin: 0;
2022-04-04 00:24:45 +02:00
2022-04-22 23:31:40 +02:00
opacity: 0.7;
2022-04-04 00:24:45 +02:00
}
2022-04-22 23:31:40 +02:00
}
2022-04-04 00:24:45 +02:00
}
2022-04-22 23:31:40 +02:00
</style>