Skip to content

Commit

Permalink
chore(#150): update API page and components
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Aug 28, 2021
1 parent 629bb1b commit b61f2ff
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 48 deletions.
36 changes: 1 addition & 35 deletions docs/components/app/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,7 @@
<span class="text-lg font-bold">{{ title }}</span>
</div>
<div class="flex-none hidden lg:block">
<ul class="horizontal menu">
<li v-for="(link, key) of links" :key="key">
<component
:is="link.component"
class="rounded-btn"
v-bind="link.props"
v-text="link.text"
/>
</li>
</ul>
<AppMenu class="horizontal" />
</div>
</div>
</template>
Expand All @@ -43,30 +34,5 @@ export default {
required: true,
},
},
data: () => ({
links: [
{
component: "NuxtLink",
text: "Home",
props: { to: "/" },
},
{
component: "NuxtLink",
text: "API",
props: { to: "/api" },
},
// TODO: Add guide.
// TODO: Add external icon.
{
component: "a",
text: "GitHub",
props: {
href: "https://github.com/druxt/druxt.js",
target: "_blank",
},
},
],
}),
};
</script>
4 changes: 2 additions & 2 deletions docs/components/app/Menu.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<ul class="menu">
<slot name="title" />
<li v-for="item of $store.state.menu" :key="item.path">
<NuxtLink class="rounded-btn" :to="item.path" v-text="item.title" />
<li v-for="(item, key) of $store.state.menu" :key="key">
<component :is="item.component" class="rounded-btn" v-bind="item.props" v-text="item.text" />
</li>
</ul>
</template>
4 changes: 2 additions & 2 deletions docs/components/app/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<li>
<NuxtLink class="rounded-btn" to="/api/packages">Packages</NuxtLink>
<!-- <ul class="menu">
<li v-for="module of $store.state.modules" :key="module">
<NuxtLink class="rounded-btn" :to="`/api/packages/${module}`" v-text="module" />
<li v-for="item of $store.state.packages" :key="item">
<NuxtLink class="rounded-btn" :to="`/api/packages/${item}/`" v-text="item" />
</li>
</ul> -->
</li>
Expand Down
10 changes: 7 additions & 3 deletions docs/pages/api/_.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<!-- 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>
<div class="text-sm breadcrumbs">
<ul>
<li v-for="dir of dirs" :key="dir" v-text="dir" />
</ul>
</div>
<h2 class="mb-5 text-3xl">{{ title }}</h2>

<div>
Expand Down Expand Up @@ -50,9 +54,9 @@ export default {
},
computed: {
module: ({ document }) => document.dir.split("/packages/")[1],
module: ({ document }) => document.dir.split("/")[3],
dir: ({ document }) => document.dir.replace("/api/", "/src/"),
dirs: ({ document }) => document.dir.replace("/api/", "src/").split("/"),
title: ({ document }) => document.title,
},
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/api/packages.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<div>
<h2 class="text-2xl border-b mb-10">Modules</h2>
<h2 class="text-2xl border-b mb-10">Packages</h2>

<ul class="menu">
<li
v-for="module of $store.state.modules"
:key="module"
v-for="item of $store.state.packages"
:key="item"
>
<NuxtLink :to="`/api/packages/${module}/`" v-text="module" />
<NuxtLink :to="`/api/packages/${item}/`" v-text="item" />
</li>
</ul>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/store/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default () => ({
path: '/api',
}],

// Module list.
// Package list.
// TODO: get this data programatically.
modules: [
packages: [
'druxt',
'breadcrumb',
'blocks',
Expand Down

0 comments on commit b61f2ff

Please sign in to comment.