From ad2667a86f74bb2ab80e780b4676cc1979306fc9 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Mon, 30 Aug 2021 10:20:27 +0000 Subject: [PATCH] feat(#179): add Modules section to docs site --- docs/components/app/icon/Modules.vue | 16 ++++++++++++ docs/pages/modules.vue | 7 +++++ docs/pages/modules/_.vue | 38 ++++++++++++++++++++++++++++ docs/pages/modules/index.vue | 7 +++++ docs/store/index.js | 28 ++++++++++++++------ docs/store/state.js | 13 +++++++--- 6 files changed, 98 insertions(+), 11 deletions(-) create mode 100644 docs/components/app/icon/Modules.vue create mode 100644 docs/pages/modules.vue create mode 100644 docs/pages/modules/_.vue create mode 100644 docs/pages/modules/index.vue diff --git a/docs/components/app/icon/Modules.vue b/docs/components/app/icon/Modules.vue new file mode 100644 index 000000000..7d4370d72 --- /dev/null +++ b/docs/components/app/icon/Modules.vue @@ -0,0 +1,16 @@ + diff --git a/docs/pages/modules.vue b/docs/pages/modules.vue new file mode 100644 index 000000000..0810a8967 --- /dev/null +++ b/docs/pages/modules.vue @@ -0,0 +1,7 @@ + diff --git a/docs/pages/modules/_.vue b/docs/pages/modules/_.vue new file mode 100644 index 000000000..391957d48 --- /dev/null +++ b/docs/pages/modules/_.vue @@ -0,0 +1,38 @@ + + + diff --git a/docs/pages/modules/index.vue b/docs/pages/modules/index.vue new file mode 100644 index 000000000..cf1fb7062 --- /dev/null +++ b/docs/pages/modules/index.vue @@ -0,0 +1,7 @@ + diff --git a/docs/store/index.js b/docs/store/index.js index 415e8b2e6..fb0b74d74 100644 --- a/docs/store/index.js +++ b/docs/store/index.js @@ -1,23 +1,35 @@ export const actions = { - async nuxtServerInit ({ commit }, { $content }) { + async nuxtServerInit({ commit }, { $content }) { try { + // Add Modules menu children to the vuex store. + const moduleIndex = await $content("modules").sortBy("title").only(["path", "title"]).fetch(); + const modules = moduleIndex + .filter((o) => !o.path.endsWith("/README")) + .map((o) => ({ + component: "NuxtLink", + text: o.title, + props: { to: o.path }, + })); + commit("addMenuChildren", { children: modules, parent: "/modules" }); + // Add Guide menu children to the vuex store. - const apiIndex = await $content("api").only(["path", "title"]).fetch(); - const apiChildren = apiIndex.map((o) => ({ + const guideIndex = await $content("guide").only(["path", "title"]).fetch(); + const guideChildren = guideIndex.map((o) => ({ component: "NuxtLink", text: o.title, props: { to: o.path.replace("/README", "") }, })); - commit("addMenuChildren", { children: apiChildren, parent: "/api" }); + commit("addMenuChildren", { children: guideChildren, parent: "/guide" }); - // Add Guide menu children to the vuex store. - const guideIndex = await $content("guide").only(["path", "title"]).fetch(); - const guideChildren = guideIndex.map((o) => ({ + // Add API menu children to the vuex store. + const apiIndex = await $content("api").only(["path", "title"]).fetch(); + const apiChildren = apiIndex.map((o) => ({ component: "NuxtLink", text: o.title, props: { to: o.path.replace("/README", "") }, })); - commit("addMenuChildren", { children: guideChildren, parent: "/guide" }); + commit("addMenuChildren", { children: apiChildren, parent: "/api" }); + } catch (err) { console.log(err) } diff --git a/docs/store/state.js b/docs/store/state.js index 64cd03a1a..57c495858 100644 --- a/docs/store/state.js +++ b/docs/store/state.js @@ -9,9 +9,9 @@ export default () => ({ }, { component: "NuxtLink", - text: "API", - icon: "api", - props: { to: "/api" }, + text: "Modules", + icon: "modules", + props: { to: "/modules" }, children: [], }, { @@ -21,6 +21,13 @@ export default () => ({ props: { to: "/guide" }, children: [], }, + { + component: "NuxtLink", + text: "API", + icon: "api", + props: { to: "/api" }, + children: [], + }, { component: "a", text: "GitHub",