mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 08:46:15 -04:00
refactor(about, i18n): improved i18n dx with markdown (#753)
This commit is contained in:
parent
de1ee69ef9
commit
bd3edcb528
8 changed files with 113 additions and 79 deletions
|
@ -1,63 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { useHead } from '@vueuse/head';
|
||||
import { useTracker } from '@/modules/tracker/tracker.services';
|
||||
|
||||
useHead({ title: 'About - IT Tools' });
|
||||
const { tracker } = useTracker();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div mx-auto mt-50px max-w-600px>
|
||||
<h1>{{ $t('about.h1') }}</h1>
|
||||
<p text-justify>
|
||||
{{ $t('about.h1p1') }}
|
||||
<c-link href="https://github.com/CorentinTh" target="_blank" rel="noopener">
|
||||
Corentin Thomasset
|
||||
</c-link>{{ $t('about.h1p2') }}
|
||||
</p>
|
||||
<p text-justify>
|
||||
{{ $t('about.h1p3') }}
|
||||
<c-link
|
||||
href="https://www.buymeacoffee.com/cthmsst"
|
||||
rel="noopener"
|
||||
target="_blank"
|
||||
@click="() => tracker.trackEvent({ eventName: 'Support button clicked' })"
|
||||
>
|
||||
{{ $t('about.h1p4') }}
|
||||
</c-link>.
|
||||
</p>
|
||||
|
||||
<h2>{{ $t('about.h2') }}</h2>
|
||||
<p text-justify>
|
||||
{{ $t('about.h2p1') }}
|
||||
<c-link href="https://github.com/CorentinTh/it-tools/blob/main/package.json" rel="noopener" target="_blank">
|
||||
package.json
|
||||
</c-link>
|
||||
{{ $t('about.h2p2') }}
|
||||
</p>
|
||||
|
||||
<h2>{{ $t('about.h3') }}</h2>
|
||||
<p text-justify>
|
||||
{{ $t('about.h3p1') }}
|
||||
<c-link
|
||||
href="https://github.com/CorentinTh/it-tools/issues/new/choose"
|
||||
rel="noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{{ $t('about.h3p2') }}
|
||||
</c-link>
|
||||
{{ $t('about.h3p3') }}
|
||||
</p>
|
||||
<p text-justify>
|
||||
{{ $t('about.h3p4') }}
|
||||
<c-link
|
||||
href="https://github.com/CorentinTh/it-tools/issues/new/choose"
|
||||
rel="noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{{ $t('about.h3p5') }}
|
||||
</c-link>
|
||||
{{ $t('about.h3p6') }}
|
||||
</p>
|
||||
</div>
|
||||
<c-markdown :markdown="$t('about.content')" mx-auto mt-50px max-w-600px />
|
||||
</template>
|
||||
|
|
18
src/ui/c-markdown/c-markdown.demo.vue
Normal file
18
src/ui/c-markdown/c-markdown.demo.vue
Normal file
|
@ -0,0 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
const md = `
|
||||
# IT Tools
|
||||
|
||||
## About
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nisl quis
|
||||
mollis blandit, nunc nisl aliquam nunc, vitae aliquam nisl nunc vitae nisl.
|
||||
|
||||
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
- Sed euismod, nisl quis mollis blandit, nunc nisl aliquam nunc, vitae aliquam nisl nunc vitae nisl.
|
||||
|
||||
[it-tools](https://it-tools.tech)
|
||||
`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<c-markdown :markdown="md" />
|
||||
</template>
|
21
src/ui/c-markdown/c-markdown.vue
Normal file
21
src/ui/c-markdown/c-markdown.vue
Normal file
|
@ -0,0 +1,21 @@
|
|||
<script setup lang="ts">
|
||||
import { marked } from 'marked';
|
||||
import DomPurify from 'dompurify';
|
||||
|
||||
const props = withDefaults(defineProps<{ markdown?: string }>(), { markdown: '' });
|
||||
const { markdown } = toRefs(props);
|
||||
|
||||
marked.use({
|
||||
renderer: {
|
||||
link(href, title, text) {
|
||||
return `<a class="text-primary transition decoration-none hover:underline" href="${href}" target="_blank" rel="noopener">${text}</a>`;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const html = computed(() => DomPurify.sanitize(marked(markdown.value), { ADD_ATTR: ['target'] }));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-html="html" />
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue