Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): enable search functionality #2020

Merged
merged 6 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {}
wesleygrimes marked this conversation as resolved.
Show resolved Hide resolved
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