Skip to content

Commit 22c1ea3

Browse files
committed
feat(list): add nav list styles
1 parent dfee018 commit 22c1ea3

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed

src/components/list/list.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ based on whether the list is in dense mode.
125125
}
126126
}
127127

128-
md-list {
128+
md-list, md-nav-list {
129129
padding-top: $md-list-top-padding;
130130
display: block;
131131

@@ -152,7 +152,7 @@ md-list {
152152
}
153153

154154

155-
md-list[dense] {
155+
md-list[dense], md-nav-list[dense] {
156156
padding-top: $md-dense-top-padding;
157157
display: block;
158158

@@ -182,4 +182,19 @@ md-divider {
182182
display: block;
183183
border-top: 1px solid md-color($md-foreground, divider);
184184
margin: 0;
185+
}
186+
187+
md-nav-list {
188+
a {
189+
text-decoration: none;
190+
color: inherit;
191+
}
192+
193+
.md-list-item {
194+
cursor: pointer;
195+
196+
&:hover {
197+
background: md-color($md-background, 'hover');
198+
}
199+
}
185200
}

src/core/style/_palette.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ $md-light-theme-background: (
332332
status-bar: map_get($md-grey, 300),
333333
app-bar: map_get($md-grey, 100),
334334
background: map_get($md-grey, 50),
335+
hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
335336
card: white,
336337
dialog: white,
337338
disabled-button: rgba(black, 0.12)
@@ -342,6 +343,7 @@ $md-dark-theme-background: (
342343
status-bar: black,
343344
app-bar: map_get($md-grey, 900),
344345
background: #303030,
346+
hover: rgba(white, 0.04), // TODO(kara): check style with Material Design UX
345347
card: map_get($md-grey, 800),
346348
dialog: map_get($md-grey, 800),
347349
disabled-button: rgba(white, 0.12)

src/demo-app/list/list-demo.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ <h4 md-line>{{message.from}}</h4>
3939
<p md-line class="demo-secondary-text">{{message.message}} </p>
4040
</md-list-item>
4141
</md-list>
42+
<div *ngIf="infoClicked">
43+
More info!
44+
</div>
45+
<md-nav-list>
46+
<md-list-item *ngFor="#link of links">
47+
<a md-line href="http://www.google.com">{{ link.name }}</a>
48+
<button md-icon-button (click)="infoClicked=!infoClicked">
49+
<i class="material-icons">info</i>
50+
</button>
51+
</md-list-item>
52+
</md-nav-list>
4253
</div>
4354

4455
<div>
@@ -66,5 +77,13 @@ <h4 md-line>{{message.from}}</h4>
6677
<p md-line class="demo-secondary-text">{{message.message}} </p>
6778
</md-list-item>
6879
</md-list>
80+
<md-nav-list dense>
81+
<md-list-item *ngFor="#link of links">
82+
<a md-line href="http://www.google.com">{{ link.name }}</a>
83+
<button md-icon-button (click)="infoClicked=!infoClicked">
84+
<i class="material-icons">info</i>
85+
</button>
86+
</md-list-item>
87+
</md-nav-list>
6988
</div>
7089
</div>

src/demo-app/list/list-demo.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
width: 350px;
44
display: flex;
55

6-
md-list {
6+
md-list, md-nav-list {
77
border: 1px solid rgba(0,0,0,0.12);
88
width: 350px;
99
margin: 20px;
@@ -12,6 +12,10 @@
1212
h2 {
1313
margin: 0 20px;
1414
}
15+
16+
i {
17+
color: rgba(0,0,0,0.12);
18+
}
1519
}
1620

1721
.demo-button {

src/demo-app/list/list-demo.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ export class ListDemo {
4242
}
4343
];
4444

45-
thirdLine: boolean = false;
45+
links: any[] = [
46+
{name: 'Inbox'},
47+
{name: 'Outbox'},
48+
{name: 'Spam'},
49+
{name: 'Trash'}
50+
51+
];
4652

53+
thirdLine: boolean = false;
54+
infoClicked: boolean = false;
4755
}

0 commit comments

Comments
 (0)