Skip to content

Commit

Permalink
fix query value in search input
Browse files Browse the repository at this point in the history
  • Loading branch information
tayronemachadozup committed Jul 3, 2020
1 parent 8bfb2b6 commit aac614c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
16 changes: 16 additions & 0 deletions search/search.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
.navbar__search__input{
border: 1px solid #4c5c67;
color: #819789;
}
.navbar__search__input:hover{
border: none;
outline: none;
padding: 10px;
padding-left: 40px;
border: 1px solid #c9d9dd;
color: #ffff;
border-radius: 3px;
background-color: #18202b;
position: relative;
}

.search{
width: 98%;
margin: 0 auto;
Expand Down
15 changes: 10 additions & 5 deletions search/search.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
const inputElement = document.querySelector('#search-input');
const resultsElement = document.querySelector('#search-results');
const infoResultsElement = document.querySelector('#info-results')
const data = getToStorage('search-result');
const query = getToStorage('query-value');

function returnInputValue(queryValue){
inputElement.value = queryValue;
}

function renderResults(){

const results = `
<ul class="search__results__list">
${data.results.map(movie => `
Expand All @@ -13,14 +18,14 @@ function renderResults(){
resultsElement.innerHTML = results;
}

function getInfoResults(data,name){
function getInfoResults(data,queryValue){
const info = `
<p class="search__info__result--text"> ${data.total_results} resultado(s) para ${name.variavel} </p>
<p class="search__info__result--text"> ${data.total_results} resultado(s) para "${queryValue}" </p>
`
infoResultsElement.innerHTML = info;
}



returnInputValue(query);
getInfoResults(data,query);
renderResults();
getInfoResults(data);

0 comments on commit aac614c

Please sign in to comment.