Commit 79b61a39 authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

Add search bar back to Kaleidoscope

Change-Id: I362f36de0759cb75892a102c3658885b3dd9b7ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410738Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815650}
parent 022292aa
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
z-index: 99; z-index: 99;
} }
</style> </style>
<cr-toolbar id="toolbar" show-menu show-search="[[showSearch]]" menu-label="[[menuLabel]]" page-name="[[pageName]]"></cr-toolbar> <cr-toolbar id="toolbar" show-menu on-search-changed="onSearchChanged_" menu-label="[[menuLabel]]" page-name="[[pageName]]"></cr-toolbar>
...@@ -17,9 +17,6 @@ class KaleidoscopeToolbarElement extends PolymerElement { ...@@ -17,9 +17,6 @@ class KaleidoscopeToolbarElement extends PolymerElement {
static get properties() { static get properties() {
return { return {
// Controls whether the search field is shown.
showSearch: {type: Boolean, value: false},
// Sets the tooltip text displayed on the menu button. // Sets the tooltip text displayed on the menu button.
menuLabel: {type: String, value: ''}, menuLabel: {type: String, value: ''},
...@@ -27,6 +24,27 @@ class KaleidoscopeToolbarElement extends PolymerElement { ...@@ -27,6 +24,27 @@ class KaleidoscopeToolbarElement extends PolymerElement {
pageName: {type: String, value: ''}, pageName: {type: String, value: ''},
}; };
} }
constructor() {
super();
this.timeoutInterval_ = null;
}
/**
* @param {!CustomEvent<string>} e
* @private
*/
onSearchChanged_(e) {
clearInterval(this.timeoutInterval_);
// Add a 300ms debounce so we don't fire for every character but should not
// be noticeable to the user.
this.timeoutInterval_ = setTimeout(() => {
const event = new CustomEvent('ks-search-updated', {detail: e.detail});
this.dispatchEvent(event);
}, 300);
}
} }
customElements.define( customElements.define(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment