Skip to content

Commit 79ce524

Browse files
committed
Merge remote-tracking branch 'origin/master' into jw-cm-fix-link
2 parents b3a4531 + 6283639 commit 79ce524

File tree

12 files changed

+92
-92
lines changed

12 files changed

+92
-92
lines changed

.eslintrc.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ module.exports = {
2323
'no-console': 'off',
2424
'ember/no-new-mixins': 'off',
2525
'ember/no-mixins': 'off',
26-
'ember/native-classes': 'off',
2726
'ember/require-tagless-components': 'off',
28-
'ember/no-test-this-render': 'off',
2927
'ember/no-classic-classes': 'off',
3028
'ember/no-get': 'off',
31-
'ember/no-actions-hash': 'off',
3229
'ember/no-classic-components': 'off',
3330
'ember/no-private-routing-service': 'off',
3431
},

app/components/loading-spinner.hbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class='loading-spinner'>
2+
<div class='sk-folding-cube'>
3+
<div class='sk-cube1 sk-cube'></div>
4+
<div class='sk-cube2 sk-cube'></div>
5+
<div class='sk-cube4 sk-cube'></div>
6+
<div class='sk-cube3 sk-cube'></div>
7+
</div>
8+
{{yield}}
9+
</div>

app/components/loading-spinner.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/components/search-input.hbs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<div class='search-input'>
2+
<input
3+
id='search-input'
4+
type='search'
5+
value={{this.value}}
6+
oninput={{perform this.search value='target.value'}}
7+
onfocus={{action 'onfocus'}}
8+
onblur={{action 'onblur'}}
9+
placeholder='Search'
10+
data-test-search-input
11+
/>
12+
{{! Search results dropdown }}
13+
<EmberTether
14+
@target='#search-input'
15+
@targetAttachment='bottom left'
16+
@attachment='top left'
17+
@constraints={{this._resultTetherConstraints}}
18+
@class='ds-dropdown-results'
19+
>
20+
<SearchInput::Dropdown
21+
@isVisible={{this._focused}}
22+
@results={{this.searchService.results}}
23+
@noResults={{if
24+
(and
25+
(and (not this.searchService.search.isRunning) this.queryIsPresent)
26+
(eq this.searchService.results.length 0)
27+
)
28+
true
29+
false
30+
}}
31+
/>
32+
</EmberTether>
33+
</div>

app/components/search-input.js

Lines changed: 34 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,65 @@
1-
import { A } from '@ember/array';
21
import { inject as service } from '@ember/service';
3-
import Component from '@ember/component';
4-
import { get, set, computed } from '@ember/object';
5-
import { isPresent, isEmpty } from '@ember/utils';
2+
import Component from '@glimmer/component';
3+
import { get } from '@ember/object';
4+
import { isPresent } from '@ember/utils';
65
import { task, timeout } from 'ember-concurrency';
6+
import { action } from '@ember/object';
7+
import { tracked } from '@glimmer/tracking';
78

89
const SEARCH_DEBOUNCE_PERIOD = 300;
910
const SEARCH_CLOSE_PERIOD = 200;
1011

11-
export default Component.extend({
12-
query: '',
12+
export default class SearchInput extends Component {
13+
@tracked query = '';
14+
@tracked _focused = false;
1315

14-
classNames: ['search-input'],
15-
searchService: service('search'),
16+
@service('search') searchService;
1617

17-
_results: A(),
18-
_focused: false,
19-
_resultTetherConstraints: null,
18+
_resultTetherConstraints = null;
19+
20+
constructor() {
21+
super(...arguments);
2022

21-
init() {
2223
this._resultTetherConstraints = [
2324
{
2425
to: 'window',
2526
pin: ['left', 'right'],
2627
},
2728
];
28-
this._super(...arguments);
29-
},
30-
31-
noResults: computed(
32-
'query',
33-
'searchService.{results.[],search.isRunning}',
34-
function () {
35-
if (get(this, 'searchService.search.isRunning')) {
36-
return false;
37-
}
38-
return (
39-
isPresent(this.query) && isEmpty(get(this, 'searchService.results'))
40-
);
41-
}
42-
),
29+
}
30+
31+
get queryIsPresent() {
32+
return isPresent(this.query);
33+
}
4334

44-
search: task(function* (query) {
35+
@task({ restartable: true }) *search(query) {
4536
yield timeout(SEARCH_DEBOUNCE_PERIOD);
4637

47-
set(this, 'query', query);
38+
this.query = query;
4839

4940
// Hide and don't run query if there's no search query
5041
if (!query) {
51-
return set(this, '_focused', false);
42+
this._focused = false;
43+
return;
5244
}
5345

5446
// ensure search results are visible if the menu was previously closed above
55-
set(this, '_focused', true);
47+
this._focused = true;
5648

5749
yield get(this, 'searchService.search').perform(query);
58-
}).restartable(),
50+
}
5951

60-
closeMenu: task(function* () {
52+
@task *closeMenu() {
6153
yield timeout(SEARCH_CLOSE_PERIOD);
6254

63-
set(this, '_focused', false);
64-
}),
55+
this._focused = false;
56+
}
6557

66-
actions: {
67-
onfocus() {
68-
set(this, '_focused', true);
69-
},
58+
@action onfocus() {
59+
this._focused = true;
60+
}
7061

71-
onblur() {
72-
this.closeMenu.perform();
73-
},
74-
},
75-
});
62+
@action onblur() {
63+
this.closeMenu.perform();
64+
}
65+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<div class='ds-suggestion'>
2+
<div class='algolia-docsearch-suggestion algolia-docsearch-suggestion__main'>
3+
<div class='algolia-docsearch-suggestion--category-header'>
4+
<span class='algolia-docsearch-suggestion--category-header-lvl0'>
5+
{{yield}}
6+
</span>
7+
</div>
8+
<div class='algolia-docsearch-suggestion--wrapper'></div>
9+
</div>
10+
</div>

app/components/search-input/dropdown-header.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/templates/components/loading-spinner.hbs

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/templates/components/search-input.hbs

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/templates/components/search-input/dropdown-header.hbs

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)