chore: Add native API docs to website

This commit is contained in:
Matt Kilgore
2024-10-31 21:41:07 -04:00
parent e2740a9b79
commit 76b6c34533
2 changed files with 32 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ export default defineConfig({
},
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'API', link: 'https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/sysadminsmedia/homebox/main/docs/docs/api/openapi-2.0.json' },
{ text: 'API Docs', link: '/en/api' },
{ text: 'Demo', link: 'https://demo.homebox.software' },
],

31
docs/en/api.md Normal file
View File

@@ -0,0 +1,31 @@
---
layout: page
sidebar: false
---
<script setup lang="ts">
import { useData } from 'vitepress';
const elementScript = document.createElement('script');
elementScript.src = 'https://unpkg.com/@stoplight/elements/web-components.min.js';
document.head.appendChild(elementScript);
const elementStyle = document.createElement('link');
elementStyle.rel = 'stylesheet';
elementStyle.href = 'https://unpkg.com/@stoplight/elements/styles.min.css';
document.head.appendChild(elementStyle);
const { isDark } = useData();
let theme = 'light';
if (isDark.value) {
theme = 'dark';
}
</script>
<elements-api
apiDescriptionUrl="https://cdn.jsdelivr.net/gh/sysadminsmedia/homebox@main/docs/docs/api/openapi-2.0.json"
router="hash"
layout="responsive"
hideSchemas="true"
:data-theme="theme"
/>