Skip to content

Commit

Permalink
feat(docs): enable search functionality (ngrx#2020)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleygrimes authored and jordanpowell88 committed Nov 14, 2019
1 parent 45d48d6 commit 1996834
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
8 changes: 5 additions & 3 deletions projects/ngrx.io/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
<img *ngSwitchCase="true" src="assets/images/badge.svg" width="37" height="40" title="Home" alt="Home">
<img *ngSwitchDefault src="assets/images/badge.svg" width="37" height="40" title="Home" alt="Home">
</a>
<aio-top-menu *ngIf="isSideBySide" [nodes]="topMenuNodes"></aio-top-menu>
<!-- <aio-search-box class="search-container" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
<aio-top-menu *ngIf="isSideBySide" [nodes]="topMenuNodes">
<aio-search-box class="search-container" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
</aio-top-menu>
<aio-search-box class="search-container" *ngIf="!isSideBySide" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
<div class="toolbar-external-icons-container">
<a href="https://twitter.com/ngrx_io" title="Twitter">
<img src="assets/images/logos/twitter-icon.svg"></a>
<a href="https://github.com/ngrx/platform" title="GitHub">
<img src="assets/images/logos/github-icon.svg"></a>
</div> -->
</div>
</mat-toolbar-row>
</mat-toolbar>

Expand Down
15 changes: 8 additions & 7 deletions projects/ngrx.io/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ describe('AppComponent', () => {
MockAioDocViewerComponent,
MockAioDtComponent,
MockAioLazyCeComponent,
MockAioFooterComponent
MockAioFooterComponent,
MockAioSearchBoxComponent
],
imports: [
MatProgressBarModule,
Expand Down Expand Up @@ -370,12 +371,6 @@ describe('AppComponent', () => {
expect(component.showSearchResults).toBe(true);
});

it('should show developer source view if the footer is clicked while holding the meta and alt keys', () => {
component.dtOn = false;
expect(component.onClick({ tagName: 'FOOTER'} as HTMLElement, 0, false, true, true)).toBeFalsy();
expect(component.dtOn).toBeTruthy();
});

it('should return the result of handleAnchorClick when anchor is clicked', () => {
const anchorElement: HTMLAnchorElement = document.createElement('a');
spyOn(locationService, 'handleAnchorClick').and.returnValue(true);
Expand Down Expand Up @@ -618,3 +613,9 @@ class MockAioFooterComponent {
@Input() nodes;
@Input() versionInfo;
}

@Component({
selector: 'aio-search-box',
template: ''
})
class MockAioSearchBoxComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { NavigationNode } from 'app/navigation/navigation.service';
template: `
<ul role="navigation">
<li *ngFor="let node of nodes"><a class="nav-link" [href]="node.url" [title]="node.title">{{ node.title }}</a></li>
<li><ng-content></ng-content></li>
</ul>`
})
export class TopMenuComponent {
Expand Down
2 changes: 1 addition & 1 deletion projects/ngrx.io/src/styles/1-layouts/_top-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ aio-search-box.search-container {
transition: width 0.4s ease-in-out;

&:focus {
width: 50%;
width: 500px;
}
}
@media (max-width: 480px) {
Expand Down

0 comments on commit 1996834

Please sign in to comment.