summaryrefslogtreecommitdiff
path: root/src/client/pages/docs.vue
blob: e677fe0cbe5b864d6bf11264eb7d481c68224620 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
<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>
	</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>

<script lang="ts">
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]: {
				title: this.$ts.help,
				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;
			});
		}
	},

	created() {
		fetch(`${url}/docs.json?lang=${lang}`).then(res => res.json()).then(docs => {
			this.docs = docs;
		});
	},
});
</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>