ff-admin/src/views/docs/DocPage.vue

88 lines
1.8 KiB
Vue
Raw Normal View History

2025-01-03 16:27:39 +01:00
<template>
<MainTemplate :useStagedOverviewLink="false">
2025-01-04 19:18:14 +01:00
<!-- <template #topBar>
2025-01-03 16:27:39 +01:00
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
<h1 class="font-bold text-xl h-8">{{page}}</h1>
</div>
2025-01-04 19:18:14 +01:00
</template> -->
<template #diffMain>
<div class="flex flex-col gap-2 h-full px-4 overflow-hidden">
<div class="markdown-container overflow-y-scroll">
<component v-if="markdownComponent" :is="markdownComponent" />
<p v-else>Diese Seite existiert nicht.</p>
</div>
2025-01-29 08:53:42 +01:00
</div>
2025-01-03 16:27:39 +01:00
</template>
</MainTemplate>
</template>
<script setup lang="ts">
2025-01-29 08:53:42 +01:00
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
2025-01-03 16:27:39 +01:00
import MainTemplate from "@/templates/Main.vue";
2025-01-29 08:53:42 +01:00
import "highlight.js/styles/atom-one-dark.css";
2025-01-03 16:27:39 +01:00
</script>
<script lang="ts">
export default defineComponent({
props: {
2025-01-29 08:53:42 +01:00
page: String,
2025-01-03 16:27:39 +01:00
},
2025-01-29 08:53:42 +01:00
watch: {
2025-01-03 16:27:39 +01:00
page() {
2025-01-29 08:53:42 +01:00
this.loadPage();
},
2025-01-03 16:27:39 +01:00
},
data() {
return {
2025-01-29 08:53:42 +01:00
markdownComponent: null as any,
2025-01-03 16:27:39 +01:00
};
},
async mounted() {
2025-01-29 08:53:42 +01:00
this.loadPage();
2025-01-03 16:27:39 +01:00
},
2025-01-29 08:53:42 +01:00
methods: {
loadPage() {
this.markdownComponent = null;
2025-01-03 16:27:39 +01:00
this.markdownComponent = markRaw(defineAsyncComponent(() => import(`$/${this.page?.toLowerCase()}.md`)));
2025-01-29 08:53:42 +01:00
},
},
2025-01-03 16:27:39 +01:00
});
2025-01-04 19:18:14 +01:00
</script>
<style>
.markdown-container {
2025-01-29 08:53:42 +01:00
font-family: "Open Sans", sans-serif;
2025-01-04 19:18:14 +01:00
color: #555;
background-color: #f8f8f8;
border: 2px solid gray;
padding: 20px;
border-radius: 5px;
2025-01-29 08:53:42 +01:00
height: 100%;
2025-01-04 19:18:14 +01:00
}
.markdown-container h1 {
font-size: 2rem !important;
color: #222;
}
.markdown-container h2 {
font-size: 1.25rem !important;
color: #222;
}
.markdown-container hr {
background-color: #222;
margin: 8px 0;
padding: 1px;
}
.markdown-container p {
margin: 10px 0;
}
.markdown-container ul {
list-style-type: disc;
margin-left: 20px;
}
2025-01-29 08:53:42 +01:00
</style>