-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
174 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<div class="container mx-auto my-20 px-5"> | ||
<h1 class="text-4xl border-b mb-10">API Documentation</h1> | ||
|
||
<NuxtChild /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,60 @@ | ||
<template> | ||
<div class="container mx-auto my-20"> | ||
<NuxtContent v-if="document" :document="document" /> | ||
<div> | ||
<!-- TODO: Add link to GitHub --> | ||
<div class="card shadow bg-white mb-10"> | ||
<div class="card-body"> | ||
<span class="mb-3 text-lg font-mono">{{ dir }}</span> | ||
<h2 class="mb-5 text-3xl">{{ title }}</h2> | ||
|
||
<div v-else> | ||
<div v-for="item of response" :key="item.path"> | ||
<NuxtLink :to="item.path" v-text="item.slug" /> | ||
<div> | ||
<!-- TODO: Link to module page? --> | ||
<div v-if="module" class="badge badge-primary">{{ module }}</div> | ||
<!-- TODO: Add file type badge; Component, Mixin, etc --> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<NuxtContent | ||
v-if="document" | ||
class=" | ||
prose prose-green prose-sm | ||
sm:prose sm:prose-green | ||
lg:prose-lg | ||
xl:prose-xl | ||
" | ||
:document="document" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
async asyncData({ $content, params, error }) { | ||
name: "AppApiDocument", | ||
async asyncData({ $content, error, params, store, route }) { | ||
let response; | ||
try { | ||
response = await $content("api/", params.pathMatch || "index").fetch(); | ||
const path = | ||
params.pathMatch + (params.pathMatch.endsWith("/") ? "index" : ""); | ||
response = await $content("api/", path).fetch(); | ||
if (Array.isArray(response)) { | ||
response = await $content("api/", params.pathMatch + "/index").fetch(); | ||
} | ||
} catch (e) { | ||
return error({ message: "Document not found" }); | ||
} | ||
return { response }; | ||
store.commit("addRecent", { text: response.title, to: route.path }); | ||
return { document: response }; | ||
}, | ||
computed: { | ||
document: ({ response }) => | ||
!Array.isArray(response) ? response : undefined, | ||
module: ({ document }) => document.dir.split("/packages/")[1], | ||
dir: ({ document }) => document.dir.replace("/api/", "/src/"), | ||
title: ({ document }) => document.title, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
<template> | ||
<div class="container mx-auto my-20"> | ||
<h1 class="text-4xl border-b-3 mb-10">API Documentation</h1> | ||
<div> | ||
<h2 class="text-2xl border-b mb-10">Table of contents</h2> | ||
|
||
<h2 class="text-2xl">Modules</h2> | ||
<ul class="menu"> | ||
<li | ||
v-for="module of $store.state.modules" | ||
:key="module" | ||
> | ||
<NuxtLink :to="`/api/packages/${module}`" v-text="module" /> | ||
</li> | ||
</ul> | ||
<!-- TODO: Add table of contents menu --> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<template> | ||
<div> | ||
<h2 class="text-2xl border-b mb-10">Modules</h2> | ||
|
||
<ul class="menu"> | ||
<li | ||
v-for="module of $store.state.modules" | ||
:key="module" | ||
> | ||
<NuxtLink :to="`/api/packages/${module}/`" v-text="module" /> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters