mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-21 06:09:41 +02:00
add blur
This commit is contained in:
parent
79592f0a1d
commit
794067c663
2 changed files with 16 additions and 6 deletions
|
@ -92,6 +92,10 @@ export default class Search {
|
||||||
this.nodes.overlay.classList.toggle('search-overlay--visible', this.isVisible);
|
this.nodes.overlay.classList.toggle('search-overlay--visible', this.isVisible);
|
||||||
document.body.classList.toggle('noscroll', this.isVisible);
|
document.body.classList.toggle('noscroll', this.isVisible);
|
||||||
|
|
||||||
|
try {
|
||||||
|
document.getElementsByClassName('docs')[0].classList.toggle('blurred', this.isVisible);
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
this.nodes.searchInput.focus();
|
this.nodes.searchInput.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +104,11 @@ export default class Search {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSearchResults(text) {
|
getSearchResults(text) {
|
||||||
// this.showSearchResult(text);
|
if (!text) {
|
||||||
|
this.clearSearchResults();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// call api to get search results
|
|
||||||
axios.get('/api/search', {
|
axios.get('/api/search', {
|
||||||
params: {
|
params: {
|
||||||
text: text
|
text: text
|
||||||
|
@ -111,11 +117,12 @@ export default class Search {
|
||||||
.then(this.showSearchResult.bind(this));
|
.then(this.showSearchResult.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
showSearchResult({ data }) {
|
clearSearchResults() {
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
this.nodes.searchResultsWrapper.innerHTML = '';
|
this.nodes.searchResultsWrapper.innerHTML = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
showSearchResult({ data }) {
|
||||||
|
this.clearSearchResults();
|
||||||
|
|
||||||
data.result.pages.forEach(page => {
|
data.result.pages.forEach(page => {
|
||||||
const result = document.createElement('a');
|
const result = document.createElement('a');
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: rgba(0, 0, 0, 0.5);
|
background: rgba(0, 0, 0, 0.5);
|
||||||
z-index: 999;
|
|
||||||
display: none;
|
display: none;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
|
||||||
|
@ -75,4 +74,8 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.blurred {
|
||||||
|
filter: blur(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue