jointrashposs/components/docs/ReadersNav.vue

34 lines
807 B
Vue
Raw Normal View History

2023-07-10 19:54:13 +02:00
<template>
2023-07-11 19:19:32 +02:00
<section>
<h2 class="text-2xl lg:text-3xl font-bold mb-4">
{{ $t(`_docs._${sectionId}.title`) }}
</h2>
<MkIndex :wide="true" :base-path="basePath" />
</section>
2023-07-10 19:54:13 +02:00
</template>
<script setup lang="ts">
2023-07-11 19:19:32 +02:00
const props = defineProps<{
sectionId: "forUsers" | "forAdmin" | "forDevelopers";
2023-07-10 19:54:13 +02:00
}>();
2023-07-11 19:19:32 +02:00
const { locale } = useI18n();
const convertToKebabCase = (str: string): string => {
if (typeof str !== "string") return str;
2023-07-10 19:54:13 +02:00
2023-07-11 19:19:32 +02:00
str = str.replace(/^ *?[A-Z]/, function (allStr) {
return allStr.toLowerCase();
});
str = str.replace(/_/g, "-");
str = str.replace(/ *?[A-Z]/g, function (allStr, i) {
return "-" + allStr.replace(/\s/g, "").toLowerCase();
});
return str;
};
const basePath = `/${locale.value}/docs/${convertToKebabCase(props.sectionId)}/`;
</script>
2023-07-10 19:54:13 +02:00
2023-07-11 19:19:32 +02:00
<style scoped></style>