Skip to content

Commit

Permalink
Designed DOM of search input (input #133).
Browse files Browse the repository at this point in the history
  • Loading branch information
gigafiga21 committed Feb 13, 2018
1 parent 4c3343d commit fb35b87
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/build/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/build/bundle.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions public/javascripts/searcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export default class Searcher {
* @constructor
*/
constructor() {
/**
* DOM tree of class
* @type {Object}
*/
this.DOM = {
input: document.getElementsByClassName('searcher__input')[0],
foldersContainer: document.getElementsByName('js-folders-container')[0],
Expand All @@ -16,6 +20,12 @@ export default class Searcher {
}
};

/**
* Default value in the search input form
* @type {String}
*/
this.defaultInputValue = 'Search';

/**
* Where to search
* @type {Array}
Expand All @@ -28,6 +38,12 @@ export default class Searcher {
*/
this.found = [];

this.DOM.input.addEventListener('focus', () => {
if (this.DOM.input.value == this.defaultInputValue) {
this.DOM.input.value = '';
}
});

this.DOM.input.addEventListener('keyup', () => {
this.search(this.DOM.input.value);
});
Expand Down
6 changes: 5 additions & 1 deletion public/stylesheets/components/searcher.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.searcher {

&__input {

background: none;
}

&__input:focus {
outline: none;
}

}
3 changes: 1 addition & 2 deletions src/views/aside.pug
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
//-
//- Search
//-
.searcher
input.searcher__input
input.searcher__input.add-note-button(value="Search")

//-
//- Scrollable zone
Expand Down

0 comments on commit fb35b87

Please sign in to comment.