1
- import { Component , Input } from '@angular/core'
1
+ import { Component , Input , Renderer2 , Inject } from '@angular/core'
2
+ import { sizes , colors , fonts , media , constants } from '../styles'
3
+ import { DOCUMENT } from '@angular/platform-browser'
2
4
3
5
@Component ( {
4
6
selector : 'ui-guides-list' ,
5
7
template : `
8
+ <div class="navbar" *ngIf="!showNav">
9
+ <button (click)="openNav()">menu</button>
10
+ </div>
11
+ <div class="mobile-nav" *ngIf="showNav">
12
+ <div class="overlay"></div>
13
+ <div class="nav-content">
14
+ <button (click)="closeNav()">close</button>
15
+ <div
16
+ class="item link"
17
+ *ngFor="let uiGuide of uiGuides"
18
+ [routerLink]="['/', uiGuide.id]"
19
+ (click)="closeNav()"
20
+ >
21
+ {{uiGuide.name}}
22
+ </div>
23
+ </div>
24
+ </div>
25
+
6
26
<div class="ui-guides-list">
7
27
<div class="title link" [routerLink]="['/', 'components']">
8
28
Components
@@ -18,6 +38,38 @@ import { Component , Input } from '@angular/core'
18
38
</div>
19
39
` ,
20
40
styles : [ `
41
+ .navbar {
42
+ height: ${ sizes . navbarHeight } ;
43
+ position: fixed;
44
+ top: 0;
45
+ left: 0;
46
+ width: 100%;
47
+ padding: 1rem;
48
+ background-color: ${ colors . main } ;
49
+ color: ${ colors . white } ;
50
+ }
51
+
52
+ .nav-content {
53
+ position: fixed;
54
+ top: 0;
55
+ left: 0;
56
+ width: ${ sizes . mobileNavHeight } ;
57
+ padding: 1rem 0px;
58
+ height: 100%;
59
+ overflow-y: scroll;
60
+ background-color: ${ colors . main } ;
61
+ color: ${ colors . white } ;
62
+ z-index: ${ constants . maxZ }
63
+ }
64
+ .overlay {
65
+ background-color: rgba(0,0,0,0.7);
66
+ position: fixed;
67
+ top: 0; right: 0; bottom: 0; left: 0;
68
+ z-index: ${ constants . maxZ - 1 } ;
69
+ }
70
+ .mobile-nav {}
71
+ ${ media . greaterThanPhone ( '.navbar{display: none; visibility: hidden}' ) }
72
+
21
73
.link:active {
22
74
border: 0px;
23
75
outline: none;
@@ -28,36 +80,53 @@ import { Component , Input } from '@angular/core'
28
80
border: 0px;
29
81
}
30
82
.ui-guides-list {
31
- height: 100vh;
32
- max-height: 100vh;
83
+ height: ${ sizes . fullHeight } ;
33
84
overflow-y: scroll;
34
- background-color: #E91E63 ;
35
- color: #FAFAFA ;
85
+ background-color: ${ colors . main } ;
86
+ color: ${ colors . white } ;
36
87
padding: 1.4rem 0px;
37
88
position: fixed;
89
+ top: 0;
90
+ left: 0;
91
+ width: ${ sizes . sidbarWidth } ;
38
92
}
93
+ ${ media . phone ( '.ui-guides-list{display: none; visibility: hidden}' ) }
39
94
.title {
40
- font-size: 1.5rem ;
95
+ font-size: ${ fonts . sizes . large } ;
41
96
text-align: left;
42
- line-height: 2rem;
43
- width: 100%;
44
- font-weight: 500;
45
97
padding: .5rem 1rem;
46
98
transition: background-color .1s ease-in;
47
99
}
48
100
.item {
49
- font-size: .8rem ;
50
- font-weight: 300 ;
101
+ font-size: ${ fonts . sizes . small } ;
102
+ font-weight: ${ fonts . thickness . light } ;
51
103
padding: .5rem 1rem;
52
- line-height: 1rem ;
104
+ line-height: ${ fonts . sizes . regular } ;
53
105
width: 100%;
54
106
text-align: left;
55
107
}
56
108
.item:hover, .item.active, .title:hover, .title.active {
57
- background-color: #C2185B ;
109
+ background-color: ${ colors . mainDark } ;
58
110
}
59
111
` ]
60
112
} )
61
113
export class UIGudiesListComponent {
114
+ showNav = false
62
115
@Input ( ) uiGuides = [ ]
116
+
117
+
118
+ constructor (
119
+ public renderer : Renderer2 ,
120
+ @Inject ( DOCUMENT ) public docuemnt : Document
121
+ ) { }
122
+
123
+ openNav ( ) {
124
+ this . renderer . addClass ( this . docuemnt . body , 'nav-open' )
125
+ this . showNav = true
126
+ }
127
+
128
+ closeNav ( ) {
129
+ this . renderer . removeClass ( this . docuemnt . body , 'nav-open' )
130
+ this . showNav = false
131
+ }
63
132
}
0 commit comments