Skip to content

Commit 8b5d2e0

Browse files
OceansideBillMarkPieszak
authored andcommitted
Pull Request: 1.Changes to the top level scss file to support multiple display widths. 2.Changes to the navmenu component to make the 'hamburger' menu visible on mobile displays. (#372)
1 parent cae82e8 commit 8b5d2e0

File tree

4 files changed

+112
-16
lines changed

4 files changed

+112
-16
lines changed

Client/app/app.component.scss

+41-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,50 @@ $icon-font-path: '~bootstrap-sass/assets/fonts/bootstrap/';
1414
Note: This Component has ViewEncapsulation.None so the styles will bleed out
1515
1616
*/
17+
@media (max-width: 767px) {
18+
body {
19+
background: #f1f1f1;
20+
line-height: 18px;
21+
padding-top: 30px;
22+
}
23+
24+
h1 {
25+
border-bottom: 3px #4189C7 solid;
26+
font-size: 24px;
27+
}
28+
29+
h2 {
30+
font-size: 20px;
31+
}
32+
33+
h1, h2, h3 {
34+
padding: 3px 0;
35+
}
36+
}
37+
38+
@media (min-width: 768px) {
39+
body {
40+
background: #f1f1f1;
41+
line-height: 18px;
42+
padding-top: 0px;
43+
}
44+
45+
h1 {
46+
border-bottom: 5px #4189C7 solid;
47+
font-size: 36px;
48+
}
49+
50+
h2 {
51+
font-size: 30px;
52+
}
53+
54+
h1, h2, h3 {
55+
padding: 10px 0;
56+
}
57+
}
1758

18-
body { background: #f1f1f1; line-height: 18px; }
1959
ul { padding: 10px 25px; }
2060
ul li { padding: 5px 0; }
2161

22-
h1 { border-bottom: 5px #4189C7 solid; }
23-
h1, h2, h3 { padding: 10px 0; }
24-
2562
blockquote { margin: 25px 10px; padding: 10px 35px 10px 10px; border-left: 10px #158a15 solid; background: #edffed; }
2663
blockquote a, blockquote a:hover { color: #068006; }

Client/app/components/navmenu/navmenu.component.css

+49-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
li .glyphicon {
1+
li .glyphicon {
22
margin-right: 10px;
33
}
44

@@ -19,17 +19,65 @@ li.link-active a:focus {
1919
z-index: 1;
2020
}
2121

22+
.icon-bar {
23+
background-color: #4189C7;
24+
}
25+
26+
27+
@media (max-width: 767px) {
28+
/* Apply for small displays */
29+
.main-nav {
30+
width: 100%;
31+
}
32+
33+
.navbar-brand {
34+
font-size: 14px;
35+
background-color: #f1f1f1;
36+
}
37+
.navbar-toggle {
38+
padding: 0px 5px;
39+
margin-top: 0px;
40+
height: 26px;
41+
}
42+
43+
.navbar-link {
44+
margin-top: 4px;
45+
margin-left: 45px;
46+
position: fixed;
47+
}
48+
49+
.navbar-collapse {
50+
background-color: white;
51+
}
52+
53+
.navbar a {
54+
/* If a menu item's text is too long, truncate it */
55+
white-space: nowrap;
56+
overflow: hidden;
57+
text-overflow: ellipsis;
58+
padding-right: 5px;
59+
}
60+
}
61+
2262
@media (min-width: 768px) {
2363
/* On small screens, convert the nav menu to a vertical sidebar */
2464
.main-nav {
2565
height: 100%;
66+
max-width: 330px;
2667
width: calc(25% - 20px);
2768
}
2869
.navbar {
2970
border-radius: 0px;
3071
border-width: 0px;
3172
height: 100%;
3273
}
74+
.navbar-brand{
75+
width: 100%;
76+
}
77+
.navbar-link {
78+
display: block;
79+
width: 100%
80+
}
3381
.navbar-header {
3482
float: none;
3583
}
@@ -51,7 +99,6 @@ li.link-active a:focus {
5199
}
52100
.navbar a {
53101
/* If a menu item's text is too long, truncate it */
54-
width: 100%;
55102
white-space: nowrap;
56103
overflow: hidden;
57104
text-overflow: ellipsis;

Client/app/components/navmenu/navmenu.component.html

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
<div class='main-nav'>
1+
<div class='main-nav'>
22
<div class='navbar'>
33
<div class='navbar-header'>
4-
<button type='button' class='navbar-toggle' data-toggle='collapse' data-target='.navbar-collapse'>
5-
<span class='sr-only'>Toggle navigation</span>
6-
<span class='icon-bar'></span>
7-
<span class='icon-bar'></span>
8-
<span class='icon-bar'></span>
9-
</button>
10-
<a class='navbar-brand' [routerLink]="['/home']">Angular 4 Universal & ASP.NET Core </a>
4+
<div class='navbar-brand'>
5+
<button type='button' class='navbar-toggle' (click)="collapseNavbar()">
6+
<span class='sr-only'>Toggle navigation</span>
7+
<span class='icon-bar'></span>
8+
<span class='icon-bar'></span>
9+
<span class='icon-bar'></span>
10+
</button>
11+
<a [routerLink]="['/home']" class='navbar-link'>Angular 4 Universal & ASP.NET Core</a>
12+
</div>
1113
</div>
1214
<div class='clearfix'></div>
13-
<div class='navbar-collapse collapse'>
15+
<div class='navbar-collapse {{collapse}}'>
1416
<ul class='nav navbar-nav'>
1517
<li [routerLinkActive]="['link-active']">
1618
<a [routerLink]="['/home']">
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
import { Component } from '@angular/core';
1+
import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'nav-menu',
55
templateUrl: './navmenu.component.html',
66
styleUrls: ['./navmenu.component.css']
77
})
8+
89
export class NavMenuComponent {
10+
collapse: string = "collapse";
11+
12+
collapseNavbar(): void {
13+
if (this.collapse.length > 1) {
14+
this.collapse = "";
15+
} else {
16+
this.collapse = "collapse";
17+
}
18+
}
919
}

0 commit comments

Comments
 (0)