Skip to content

Commit 3cc4f3d

Browse files
wesleygrimesbrandonroberts
authored andcommitted
feat(docs): enable search functionality (#2020)
1 parent 9d413c9 commit 3cc4f3d

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

projects/ngrx.io/src/app/app.component.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@
2626
<img *ngSwitchCase="true" src="assets/images/badge.svg" width="37" height="40" title="Home" alt="Home">
2727
<img *ngSwitchDefault src="assets/images/badge.svg" width="37" height="40" title="Home" alt="Home">
2828
</a>
29-
<aio-top-menu *ngIf="isSideBySide" [nodes]="topMenuNodes"></aio-top-menu>
30-
<!-- <aio-search-box class="search-container" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
29+
<aio-top-menu *ngIf="isSideBySide" [nodes]="topMenuNodes">
30+
<aio-search-box class="search-container" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
31+
</aio-top-menu>
32+
<aio-search-box class="search-container" *ngIf="!isSideBySide" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
3133
<div class="toolbar-external-icons-container">
3234
<a href="https://twitter.com/ngrx_io" title="Twitter">
3335
<img src="assets/images/logos/twitter-icon.svg"></a>
3436
<a href="https://github.com/ngrx/platform" title="GitHub">
3537
<img src="assets/images/logos/github-icon.svg"></a>
36-
</div> -->
38+
</div>
3739
</mat-toolbar-row>
3840
</mat-toolbar>
3941

projects/ngrx.io/src/app/app.component.spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ describe('AppComponent', () => {
4242
MockAioDocViewerComponent,
4343
MockAioDtComponent,
4444
MockAioLazyCeComponent,
45-
MockAioFooterComponent
45+
MockAioFooterComponent,
46+
MockAioSearchBoxComponent
4647
],
4748
imports: [
4849
MatProgressBarModule,
@@ -370,12 +371,6 @@ describe('AppComponent', () => {
370371
expect(component.showSearchResults).toBe(true);
371372
});
372373

373-
it('should show developer source view if the footer is clicked while holding the meta and alt keys', () => {
374-
component.dtOn = false;
375-
expect(component.onClick({ tagName: 'FOOTER'} as HTMLElement, 0, false, true, true)).toBeFalsy();
376-
expect(component.dtOn).toBeTruthy();
377-
});
378-
379374
it('should return the result of handleAnchorClick when anchor is clicked', () => {
380375
const anchorElement: HTMLAnchorElement = document.createElement('a');
381376
spyOn(locationService, 'handleAnchorClick').and.returnValue(true);
@@ -618,3 +613,9 @@ class MockAioFooterComponent {
618613
@Input() nodes;
619614
@Input() versionInfo;
620615
}
616+
617+
@Component({
618+
selector: 'aio-search-box',
619+
template: ''
620+
})
621+
class MockAioSearchBoxComponent {}

projects/ngrx.io/src/app/layout/top-menu/top-menu.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { NavigationNode } from 'app/navigation/navigation.service';
66
template: `
77
<ul role="navigation">
88
<li *ngFor="let node of nodes"><a class="nav-link" [href]="node.url" [title]="node.title">{{ node.title }}</a></li>
9+
<li><ng-content></ng-content></li>
910
</ul>`
1011
})
1112
export class TopMenuComponent {

projects/ngrx.io/src/styles/1-layouts/_top-menu.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ aio-search-box.search-container {
189189
transition: width 0.4s ease-in-out;
190190

191191
&:focus {
192-
width: 50%;
192+
width: 500px;
193193
}
194194
}
195195
@media (max-width: 480px) {

0 commit comments

Comments
 (0)