Skip to content

Commit

Permalink
Revert "docs: added full text search component FullTextSearch.vue and…
Browse files Browse the repository at this point in the history
… search field in default.vue (#197)"

This reverts commit 3146c18.
  • Loading branch information
captaindav authored and Decipher committed May 18, 2022
1 parent 1e52f4c commit 32577e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 195 deletions.
125 changes: 0 additions & 125 deletions docs/components/app/FullTextSearch.vue

This file was deleted.

80 changes: 10 additions & 70 deletions docs/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
<template>
<div class="flex flex-col h-screen">
<AppHeader
class="inset-x-0 top-0 z-50 w-full sticky"
title="DruxtJS"
/>
<FullTextSearch />

<div>
<input
v-model="searchQuery"
type="search"
autocomplete="off"
>

<ul v-if="results.length">
<li
v-for="result of results"
:key="result.key"
>
<router-link :to="result.path">
{{ result.title }}
</router-link>
</li>
</ul>
</div>
<AppHeader class="inset-x-0 top-0 z-50 w-full sticky" title="DruxtJS" />

<div
class="shadow bg-basr aw- grow"
class="shadow bg-base-200 drawer flex-grow"
:class="{ 'drawer-mobile': $route.path !== '/' }"
>
<input
id="sidebar"
v-model="sidebar"
type="checkbox"
class="drawer-toggle"
>
v-model="sidebar"
/>

<main
ref="main"
Expand All @@ -51,10 +28,7 @@
</main>

<div class="drawer-side">
<label
for="sidebar"
class="drawer-overlay"
/>
<label for="sidebar" class="drawer-overlay"></label>
<AppSidebar />
</div>
</div>
Expand All @@ -65,50 +39,16 @@
export default {
data: () => ({
sidebar: false,
searchQuery: "",
results: [],
}),
watch: {
$route() {
// Close the sidebar.
this.sidebar = false;
this.sidebar = false
// Scroll to the top of the main div.
this.$refs.main.scrollTop = 0;
},
async searchQuery(searchQuery) {
if (!searchQuery) {
this.results = [];
return;
}
var newResults = [];
newResults = await this.$content("guide")
.sortBy("createdAt", "asc")
.limit(100)
.search(searchQuery)
.fetch();
newResults.forEach(function (result, index) {
//result.path += result.extension
//console.log(item, index);
})
console.log(newResults[1]);
// newResults.push( await this.$content('guide')
// .sortBy('createdAt', 'asc')
// .limit(100)
// .search(searchQuery)
// .fetch())
// newResults.push( await this.$content('module')
// .sortBy('createdAt', 'asc')
// .limit(100)
// .search(searchQuery)
// .fetch())
this.results = newResults;
console.log(newResults[1]);
},
},
};
this.$refs.main.scrollTop = 0
}
}
}
</script>

0 comments on commit 32577e1

Please sign in to comment.