Skip to content

Commit 291a562

Browse files
committed
Top menu bar looking good.
1 parent a9f2d16 commit 291a562

File tree

14 files changed

+132
-114
lines changed

14 files changed

+132
-114
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
<app-navbar></app-navbar>
2-
32
<router-outlet></router-outlet>
Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1+
@import './styles/variables.scss';
2+
13
:host {
2-
display: block;
34
height: 100%;
4-
display: flex;
5-
flex-direction: column;
6-
7-
ul {
8-
list-style: none;
9-
display: flex;
10-
padding: 0;
11-
12-
li {
13-
14-
a {
15-
margin-right: 10px;
16-
}
17-
}
18-
}
5+
display: block;
6+
box-sizing: border-box;
7+
border-top: $navPrimaryHeight + $navSecondaryHeight solid transparent;
198
}

apps/docs/src/app/components/components.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { ReactComponentsModule } from '../react-components/react-components.modu
88
import { TriangleComponent } from './triangle/triangle.component';
99
import { NavbarComponent } from './navbar/navbar.component';
1010
import { MaterialModule } from '../material.module';
11+
import { SidebarComponent } from './sidebar/sidebar.component';
1112

1213

1314
const components = [
1415
DotComponent,
1516
TriangleComponent,
1617
NavbarComponent,
18+
SidebarComponent,
1719
];
1820

1921
@NgModule({
Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
1-
<nav class="docs-navbar-header">
2-
<a mat-button class="docs-button" routerLink="/" aria-label="Angular-React">
3-
<!-- <img class="docs-angular-logo"
4-
src="../../../assets/img/homepage/angular-white-transparent.svg"
5-
alt="angular-react"> -->
6-
<span>Angular-React</span>
7-
</a>
8-
<a mat-button class="docs-navbar-hide-small docs-button" routerLink="perf/angular">Angular Perf</a>
9-
<a mat-button class="docs-navbar-hide-small docs-button" routerLink="perf/mixed">Mixed Perf</a>
10-
<a mat-button class="docs-navbar-hide-small docs-button" routerLink="components/fabric">Fabric Components</a>
11-
<a mat-button class="docs-navbar-hide-small docs-button" routerLink="components/material">Material Components</a>
1+
<mat-toolbar #primary class="primary">
2+
<a mat-button routerLink=".">
3+
<mat-icon>
4+
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="simpleicons-angular-icon" role="img" viewBox="0 0 24 24"><title id="simpleicons-angular-icon">Angular icon</title><path d="M9.93 12.645h4.134L11.996 7.74"/><path d="M11.996.009L.686 3.988l1.725 14.76 9.585 5.243 9.588-5.238L23.308 3.99 11.996.01zm7.058 18.297h-2.636l-1.42-3.501H8.995l-1.42 3.501H4.937l7.06-15.648 7.057 15.648z"/></svg>
5+
</mat-icon>
6+
<b>-</b>
7+
<mat-icon>
8+
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="simpleicons-react-icon" role="img" viewBox="0 0 24 24"><title id="simpleicons-react-icon">React icon</title><circle cx="12" cy="12" r="2.139"/><path d="M6.008 16.255l-.472-.12C2.018 15.246 0 13.737 0 11.996s2.018-3.25 5.536-4.139l.472-.119.133.468a23.53 23.53 0 0 0 1.363 3.578l.101.213-.101.213a23.307 23.307 0 0 0-1.363 3.578l-.133.467zM5.317 8.95c-2.674.751-4.315 1.9-4.315 3.046 0 1.145 1.641 2.294 4.315 3.046a24.95 24.95 0 0 1 1.182-3.046A24.752 24.752 0 0 1 5.317 8.95zM17.992 16.255l-.133-.469a23.357 23.357 0 0 0-1.364-3.577l-.101-.213.101-.213a23.42 23.42 0 0 0 1.364-3.578l.133-.468.473.119c3.517.889 5.535 2.398 5.535 4.14s-2.018 3.25-5.535 4.139l-.473.12zm-.491-4.259c.48 1.039.877 2.06 1.182 3.046 2.675-.752 4.315-1.901 4.315-3.046 0-1.146-1.641-2.294-4.315-3.046a24.788 24.788 0 0 1-1.182 3.046z"/><path d="M5.31 8.945l-.133-.467C4.188 4.992 4.488 2.494 6 1.622c1.483-.856 3.864.155 6.359 2.716l.34.349-.34.349a23.552 23.552 0 0 0-2.422 2.967l-.135.193-.235.02a23.657 23.657 0 0 0-3.785.61l-.472.119zm1.896-6.63c-.268 0-.505.058-.705.173-.994.573-1.17 2.565-.485 5.253a25.122 25.122 0 0 1 3.233-.501 24.847 24.847 0 0 1 2.052-2.544c-1.56-1.519-3.037-2.381-4.095-2.381zM16.795 22.677c-.001 0-.001 0 0 0-1.425 0-3.255-1.073-5.154-3.023l-.34-.349.34-.349a23.53 23.53 0 0 0 2.421-2.968l.135-.193.234-.02a23.63 23.63 0 0 0 3.787-.609l.472-.119.134.468c.987 3.484.688 5.983-.824 6.854a2.38 2.38 0 0 1-1.205.308zm-4.096-3.381c1.56 1.519 3.037 2.381 4.095 2.381h.001c.267 0 .505-.058.704-.173.994-.573 1.171-2.566.485-5.254a25.02 25.02 0 0 1-3.234.501 24.674 24.674 0 0 1-2.051 2.545z"/><path d="M18.69 8.945l-.472-.119a23.479 23.479 0 0 0-3.787-.61l-.234-.02-.135-.193a23.414 23.414 0 0 0-2.421-2.967l-.34-.349.34-.349C14.135 1.778 16.515.767 18 1.622c1.512.872 1.812 3.37.824 6.855l-.134.468zM14.75 7.24c1.142.104 2.227.273 3.234.501.686-2.688.509-4.68-.485-5.253-.988-.571-2.845.304-4.8 2.208A24.849 24.849 0 0 1 14.75 7.24zM7.206 22.677A2.38 2.38 0 0 1 6 22.369c-1.512-.871-1.812-3.369-.823-6.854l.132-.468.472.119c1.155.291 2.429.496 3.785.609l.235.02.134.193a23.596 23.596 0 0 0 2.422 2.968l.34.349-.34.349c-1.898 1.95-3.728 3.023-5.151 3.023zm-1.19-6.427c-.686 2.688-.509 4.681.485 5.254.987.563 2.843-.305 4.8-2.208a24.998 24.998 0 0 1-2.052-2.545 24.976 24.976 0 0 1-3.233-.501z"/><path d="M12 16.878c-.823 0-1.669-.036-2.516-.106l-.235-.02-.135-.193a30.388 30.388 0 0 1-1.35-2.122 30.354 30.354 0 0 1-1.166-2.228l-.1-.213.1-.213a30.3 30.3 0 0 1 1.166-2.228c.414-.716.869-1.43 1.35-2.122l.135-.193.235-.02a29.785 29.785 0 0 1 5.033 0l.234.02.134.193a30.006 30.006 0 0 1 2.517 4.35l.101.213-.101.213a29.6 29.6 0 0 1-2.517 4.35l-.134.193-.234.02c-.847.07-1.694.106-2.517.106zm-2.197-1.084c1.48.111 2.914.111 4.395 0a29.006 29.006 0 0 0 2.196-3.798 28.585 28.585 0 0 0-2.197-3.798 29.031 29.031 0 0 0-4.394 0 28.477 28.477 0 0 0-2.197 3.798 29.114 29.114 0 0 0 2.197 3.798z"/></svg>
9+
</mat-icon>
10+
</a>
11+
<a mat-button routerLink=".">Performance</a>
12+
<a mat-button routerLink=".">Components</a>
13+
<a mat-button routerLink=".">Docs</a>
14+
<div class="spacer"></div>
15+
<a mat-button href="https://github.com/benfeely/angular-react">
16+
<mat-icon>
17+
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="simpleicons-github-icon" role="img" viewBox="0 0 24 24"><title id="simpleicons-github-icon">GitHub icon</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>
18+
</mat-icon>
19+
</a>
20+
</mat-toolbar>
1221

13-
<div class="flex-spacer"></div>
14-
15-
<a mat-button class="docs-button docs-navbar-hide-small" href="https://github.com/benfeely/angular-react"
16-
aria-label="GitHub Repository">
17-
<!-- <img class="docs-angular-logo"
18-
src="../../../assets/img/homepage/github-circle-white-transparent.svg"
19-
alt="angular"> -->
20-
GitHub
21-
</a>
22-
<a mat-icon-button class="docs-button docs-navbar-show-small"
23-
href="https://github.com/benfeely/angular-react" aria-label="GitHub Repository">
24-
<!-- <img class="docs-angular-logo"
25-
src="../../../assets/img/homepage/github-circle-white-transparent.svg"
26-
alt="angular"> -->
27-
</a>
28-
</nav>
29-
<nav class="docs-navbar docs-navbar-show-small">
30-
<a mat-button class="docs-navbar-link" routerLink="guides">Guides</a>
31-
<a mat-button class="docs-navbar-link" routerLink="guides">Guides</a>
32-
<a mat-button class="docs-navbar-link" routerLink="guides">Guides</a>
33-
</nav>
22+
<mat-toolbar class="secondary" [class.collapse]="collapseSecondaryNav">
23+
My secondary toolbar
24+
</mat-toolbar>
Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,31 @@
1-
.docs-navbar-header {
2-
display: flex;
3-
flex-wrap: wrap;
4-
align-items: center;
5-
padding: 8px 16px;
6-
7-
> .mat-button {
8-
&:last-child {
9-
margin-left: auto;
10-
}
1+
@import '../../styles/variables.scss';
2+
3+
:host {
4+
display: block;
5+
position: fixed;
6+
top: 0;
7+
left: 0;
8+
right: 0;
9+
10+
mat-toolbar.primary {
11+
height: $navPrimaryHeight * 4;
12+
margin-top: 0 - $navPrimaryHeight * 3;
13+
padding-top: $navPrimaryHeight * 3;
14+
background: rgba(30, 30, 30, 0.94);
15+
color: #fff;
1116
}
12-
}
13-
14-
.flex-spacer {
15-
flex-grow: 1;
16-
}
1717

18-
.docs-angular-logo {
19-
height: 26px;
20-
margin: 0 4px 3px 0;
21-
vertical-align: middle;
22-
}
23-
24-
.docs-github-logo {
25-
height: 21px;
26-
margin: 0 7px 2px 0;
27-
vertical-align: middle;
28-
}
29-
30-
.docs-navbar-link {
31-
text-decoration: inherit;
32-
flex: 1;
33-
}
18+
mat-toolbar.secondary {
19+
height: $navSecondaryHeight;
20+
background: rgba(240, 240, 240, 0.94);
21+
transition: height 500ms;
3422

35-
.docs-navbar {
36-
display: none;
37-
}
38-
39-
.docs-navbar-show-small {
40-
display: none;
41-
}
42-
43-
/**
44-
* Rules for when the device is detected to be a small screen.
45-
* Moves content two rows instead of one.
46-
*/
47-
@media (max-width: 720px) {
48-
.docs-navbar-hide-small {
49-
display: none;
50-
}
51-
52-
.docs-navbar-show-small {
53-
display: block;
54-
}
55-
56-
.docs-navbar {
57-
display: flex;
23+
&.collapse {
24+
height: $navSecondaryHeight / 3;
25+
}
5826
}
5927

60-
.docs-navbar--github-logo {
61-
margin: 0;
28+
.spacer {
29+
flex: 1 1 auto;
6230
}
6331
}
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, AfterViewInit, ViewChild, ElementRef } from '@angular/core';
2+
import { fromEvent } from 'rxjs/observable/fromEvent';
3+
import { throttleTime } from 'rxjs/operators';
24

35
@Component({
46
selector: 'app-navbar',
57
templateUrl: './navbar.component.html',
68
styleUrls: ['./navbar.component.scss']
79
})
8-
export class NavbarComponent implements OnInit {
10+
export class NavbarComponent implements AfterViewInit {
911

10-
constructor() { }
12+
@ViewChild('primary', { read: ElementRef }) primaryNav: ElementRef;
1113

12-
ngOnInit() {
14+
collapseSecondaryNav = false;
15+
16+
ngAfterViewInit() {
17+
fromEvent(window, 'scroll')
18+
// .pipe(throttleTime(1))
19+
.subscribe(e => {
20+
this.collapseSecondaryNav = window.pageYOffset >
21+
this.primaryNav.nativeElement.offsetHeight / 4;
22+
});
1323
}
1424

1525
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
sidebar works!
3+
</p>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:host {
2+
border: 1px solid green;
3+
4+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { SidebarComponent } from './sidebar.component';
4+
5+
describe('SidebarComponent', () => {
6+
let component: SidebarComponent;
7+
let fixture: ComponentFixture<SidebarComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ SidebarComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(SidebarComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-sidebar',
5+
templateUrl: './sidebar.component.html',
6+
styleUrls: ['./sidebar.component.scss']
7+
})
8+
export class SidebarComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit() {
13+
}
14+
15+
}

0 commit comments

Comments
 (0)