Improve docs
This commit is contained in:
@ -107,6 +107,7 @@ export default defineComponent({
|
||||
padding: 32px;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
background: var(--panel);
|
||||
|
||||
&.max-width_500px {
|
||||
padding: 16px;
|
||||
|
@ -1,14 +1,38 @@
|
||||
<template>
|
||||
<div>
|
||||
<main class="_section">
|
||||
<div class="_content">
|
||||
<ul>
|
||||
<li v-for="doc in docs" :key="doc.path">
|
||||
<MkA :to="`/docs/${doc.path}`">{{ doc.title }}</MkA>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="vtaihdtm">
|
||||
<div class="search">
|
||||
<MkInput v-model:value="query" :debounce="true" type="search"><template #icon><i class="fas fa-search"></i></template><span>{{ $ts.search }}</span></MkInput>
|
||||
</div>
|
||||
<MkFolder>
|
||||
<template #header>{{ $ts._docs.generalTopics }}</template>
|
||||
<div class="docs">
|
||||
<MkA v-for="doc in docs.filter(doc => doc.path.startsWith('general/'))" :key="doc.path" :to="`/docs/${doc.path}`" class="doc">
|
||||
<div class="title">{{ doc.title }}</div>
|
||||
<div class="summary">{{ doc.summary }}</div>
|
||||
<div class="read">{{ $ts._docs.continueReading }}</div>
|
||||
</MkA>
|
||||
</div>
|
||||
</main>
|
||||
</MkFolder>
|
||||
<MkFolder>
|
||||
<template #header>{{ $ts._docs.features }}</template>
|
||||
<div class="docs">
|
||||
<MkA v-for="doc in docs.filter(doc => doc.path.startsWith('features/'))" :key="doc.path" :to="`/docs/${doc.path}`" class="doc">
|
||||
<div class="title">{{ doc.title }}</div>
|
||||
<div class="summary">{{ doc.summary }}</div>
|
||||
<div class="read">{{ $ts._docs.continueReading }}</div>
|
||||
</MkA>
|
||||
</div>
|
||||
</MkFolder>
|
||||
<MkFolder>
|
||||
<template #header>{{ $ts._docs.advancedTopics }}</template>
|
||||
<div class="docs">
|
||||
<MkA v-for="doc in docs.filter(doc => doc.path.startsWith('advanced/'))" :key="doc.path" :to="`/docs/${doc.path}`" class="doc">
|
||||
<div class="title">{{ doc.title }}</div>
|
||||
<div class="summary">{{ doc.summary }}</div>
|
||||
<div class="read">{{ $ts._docs.continueReading }}</div>
|
||||
</MkA>
|
||||
</div>
|
||||
</MkFolder>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -16,8 +40,15 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { url, lang } from '@client/config';
|
||||
import * as symbols from '@client/symbols';
|
||||
import MkFolder from '@client/components/ui/folder.vue';
|
||||
import MkInput from '@client/components/ui/input.vue';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MkFolder,
|
||||
MkInput,
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
[symbols.PAGE_INFO]: {
|
||||
@ -25,6 +56,15 @@ export default defineComponent({
|
||||
icon: 'fas fa-question-circle'
|
||||
},
|
||||
docs: [],
|
||||
query: null,
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
query() {
|
||||
fetch(`${url}/docs.json?lang=${lang}&q=${this.query}`).then(res => res.json()).then(docs => {
|
||||
this.docs = docs;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -35,3 +75,48 @@ export default defineComponent({
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.vtaihdtm {
|
||||
background: var(--panel);
|
||||
|
||||
> .search {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.docs {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
|
||||
grid-gap: 12px;
|
||||
margin: var(--margin);
|
||||
|
||||
> .doc {
|
||||
display: inline-block;
|
||||
padding: 16px;
|
||||
border: solid 1px var(--divider);
|
||||
border-radius: 6px;
|
||||
|
||||
&:hover {
|
||||
border: solid 1px var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
> .title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
> .summary {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
> .read {
|
||||
color: var(--link);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -31,7 +31,7 @@ export const router = createRouter({
|
||||
{ path: '/docs', component: page('docs') },
|
||||
{ path: '/theme-editor', component: page('theme-editor') },
|
||||
{ path: '/advanced-theme-editor', component: page('advanced-theme-editor') },
|
||||
{ path: '/docs/:doc', component: page('doc'), props: route => ({ doc: route.params.doc }) },
|
||||
{ path: '/docs/:doc(.*)', component: page('doc'), props: route => ({ doc: route.params.doc }) },
|
||||
{ path: '/explore', component: page('explore') },
|
||||
{ path: '/explore/tags/:tag', props: true, component: page('explore') },
|
||||
{ path: '/search', component: page('search') },
|
||||
|
Reference in New Issue
Block a user