fix(aio): make the search-pane larger (and improve the search-box) (#17105)

* fix(aio): make the search-pane larger

Fixes #17094

* feat(aio): give the search-box a type of "search"

This enables browsers to style it better (e.g. add an `x` button for clearing
the field, which allows users to quickly reset the search query and hide
results).
This commit is contained in:
George Kalpakas 2017-05-31 01:15:54 +03:00 committed by Victor Berchet
parent b056adc032
commit 2f35392cd8
3 changed files with 12 additions and 3 deletions

View File

@ -44,6 +44,14 @@ describe('SearchBoxComponent', () => {
})); }));
}); });
describe('on input', () => {
it('should trigger the search event', () => {
const input = fixture.debugElement.query(By.css('input'));
input.triggerEventHandler('input', { target: { value: 'some query' } });
expect(host.doSearch).toHaveBeenCalledWith('some query');
});
});
describe('on keyup', () => { describe('on keyup', () => {
it('should trigger the search event', () => { it('should trigger the search event', () => {
const input = fixture.debugElement.query(By.css('input')); const input = fixture.debugElement.query(By.css('input'));

View File

@ -14,8 +14,10 @@ import { LocationService } from 'app/shared/location.service';
@Component({ @Component({
selector: 'aio-search-box', selector: 'aio-search-box',
template: `<input #searchBox template: `<input #searchBox
type="search"
aria-label="search" aria-label="search"
placeholder="Search" placeholder="Search"
(input)="onSearch($event.target.value)"
(keyup)="onSearch($event.target.value)" (keyup)="onSearch($event.target.value)"
(focus)="onSearch($event.target.value)" (focus)="onSearch($event.target.value)"
(click)="onSearch($event.target.value)">` (click)="onSearch($event.target.value)">`

View File

@ -10,7 +10,7 @@ aio-search-results {
padding: 68px 32px 0; padding: 68px 32px 0;
color: $offwhite; color: $offwhite;
width: auto; width: auto;
max-height: 50%; max-height: 95vh;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@ -18,11 +18,10 @@ aio-search-results {
z-index: 5; z-index: 5;
background-color: $darkgray; background-color: $darkgray;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.3); box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.3);
box-sizing: border-box;
@media (max-width: 480px) { @media (max-width: 480px) {
display: block; display: block;
max-height: 70%;
box-sizing: border-box;
.search-area { .search-area {
display: block; display: block;
margin: 16px 16px; margin: 16px 16px;