mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 05:47:10 -04:00
parent
b430baef40
commit
c2e55b1a3f
2 changed files with 26 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useHead } from '@vueuse/head';
|
import { useHead } from '@vueuse/head';
|
||||||
import type { HeadObject } from '@vueuse/head';
|
import type { HeadObject } from '@vueuse/head';
|
||||||
|
import VueMarkdown from 'vue-markdown-render';
|
||||||
|
|
||||||
import BaseLayout from './base.layout.vue';
|
import BaseLayout from './base.layout.vue';
|
||||||
import FavoriteButton from '@/components/FavoriteButton.vue';
|
import FavoriteButton from '@/components/FavoriteButton.vue';
|
||||||
|
@ -28,6 +29,19 @@ const { t } = useI18n();
|
||||||
const i18nKey = computed<string>(() => route.path.trim().replace('/', ''));
|
const i18nKey = computed<string>(() => route.path.trim().replace('/', ''));
|
||||||
const toolTitle = computed<string>(() => t(`tools.${i18nKey.value}.title`, String(route.meta.name)));
|
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)));
|
const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.description`, String(route.meta.description)));
|
||||||
|
const toolFooter = computed<string>(() => {
|
||||||
|
const createLink = (linkText: string, url: string) => {
|
||||||
|
return `[${linkText.replace('[', '\\[').replace(']', '\\]')}](${url.replace('(', '%28').replace(')', '%29')})`;
|
||||||
|
};
|
||||||
|
const footer = t(`tools.${i18nKey.value}.footer`, String(route.meta.footer));
|
||||||
|
const npmPackages = (route.meta.npmPackages as string[] || [])
|
||||||
|
.map(
|
||||||
|
packageName => createLink(
|
||||||
|
packageName,
|
||||||
|
packageName.includes('://') ? packageName : `https://www.npmjs.com/package/${packageName}`),
|
||||||
|
);
|
||||||
|
return ((npmPackages.length > 0 ? `Made with ${npmPackages.join(', ')}\n` : '') + footer).trim();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -55,6 +69,10 @@ const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.descrip
|
||||||
<div class="tool-content">
|
<div class="tool-content">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="tool-footer">
|
||||||
|
<VueMarkdown :source="toolFooter" />
|
||||||
|
</div>
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -66,9 +84,11 @@ const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.descrip
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
overflow-x: auto;
|
||||||
|
|
||||||
::v-deep(& > *) {
|
::v-deep(& > *) {
|
||||||
flex: 0 1 600px;
|
flex: 0 1 600px;
|
||||||
|
min-width:0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,5 +124,9 @@ const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.descrip
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.tool-footer {
|
||||||
|
opacity: 0.7;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -10,6 +10,8 @@ export interface Tool {
|
||||||
redirectFrom?: string[]
|
redirectFrom?: string[]
|
||||||
isNew: boolean
|
isNew: boolean
|
||||||
createdAt?: Date
|
createdAt?: Date
|
||||||
|
npmPackages?: string[]
|
||||||
|
footer?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ToolCategory {
|
export interface ToolCategory {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue