Skip to content

Commit 7b3698c

Browse files
committed
feat(list): add icon support
1 parent a094a33 commit 7b3698c

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

src/components/list/list-item.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="md-list-item">
2-
<ng-content select="[md-list-avatar]"></ng-content>
2+
<ng-content select="[md-list-avatar],[md-list-icon]"></ng-content>
33
<div class="md-list-text"><ng-content select="[md-line]"></ng-content></div>
44
<ng-content></ng-content>
55
</div>

src/components/list/list.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
$md-list-side-padding: 16px;
55
$md-list-avatar-size: 40px;
6+
$md-list-icon-size: 24px;
67

78
/* Normal list variables */
89
$md-list-top-padding: 8px;
@@ -83,6 +84,13 @@ based on whether the list is in dense mode.
8384
height: $md-list-avatar-size;
8485
border-radius: 50%;
8586
}
87+
88+
[md-list-icon] {
89+
width: $md-list-icon-size;
90+
height: $md-list-icon-size;
91+
border-radius: 50%;
92+
padding: 4px;
93+
}
8694
}
8795

8896
/*

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ <h2>Nav lists</h2>
8787
</md-nav-list>
8888
<md-nav-list>
8989
<a md-list-item *ngFor="#link of links" href="http://www.google.com">
90+
<md-icon md-list-icon>folder</md-icon>
9091
<span md-line>{{ link.name }}</span>
9192
<span md-line class="demo-secondary-text"> Description </span>
9293
</a>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
margin-top: 20px;
1414
}
1515

16+
[md-list-icon] {
17+
color: white;
18+
background: rgba(0,0,0,0.3);
19+
}
20+
1621
i {
1722
color: rgba(0,0,0,0.12);
1823
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {Component} from 'angular2/core';
22
import {MdButton} from '../../components/button/button';
33
import {MD_LIST_DIRECTIVES} from '../../components/list/list';
4+
import {MdIcon} from '../../components/icon/icon';
45

56
@Component({
67
selector: 'list-demo',
78
templateUrl: 'demo-app/list/list-demo.html',
89
styleUrls: ['demo-app/list/list-demo.css'],
9-
directives: [MD_LIST_DIRECTIVES, MdButton]
10+
directives: [MD_LIST_DIRECTIVES, MdButton, MdIcon]
1011
})
1112
export class ListDemo {
1213
items: string[] = [

0 commit comments

Comments
 (0)