Skip to content

Commit

Permalink
feat(list): add icon support
Browse files Browse the repository at this point in the history
  • Loading branch information
kara committed Apr 25, 2016
1 parent a094a33 commit 7b3698c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/list/list-item.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="md-list-item">
<ng-content select="[md-list-avatar]"></ng-content>
<ng-content select="[md-list-avatar],[md-list-icon]"></ng-content>
<div class="md-list-text"><ng-content select="[md-line]"></ng-content></div>
<ng-content></ng-content>
</div>
8 changes: 8 additions & 0 deletions src/components/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

$md-list-side-padding: 16px;
$md-list-avatar-size: 40px;
$md-list-icon-size: 24px;

/* Normal list variables */
$md-list-top-padding: 8px;
Expand Down Expand Up @@ -83,6 +84,13 @@ based on whether the list is in dense mode.
height: $md-list-avatar-size;
border-radius: 50%;
}

[md-list-icon] {
width: $md-list-icon-size;
height: $md-list-icon-size;
border-radius: 50%;
padding: 4px;
}
}

/*
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/list/list-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ <h2>Nav lists</h2>
</md-nav-list>
<md-nav-list>
<a md-list-item *ngFor="#link of links" href="http://www.google.com">
<md-icon md-list-icon>folder</md-icon>
<span md-line>{{ link.name }}</span>
<span md-line class="demo-secondary-text"> Description </span>
</a>
Expand Down
5 changes: 5 additions & 0 deletions src/demo-app/list/list-demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
margin-top: 20px;
}

[md-list-icon] {
color: white;
background: rgba(0,0,0,0.3);
}

i {
color: rgba(0,0,0,0.12);
}
Expand Down
3 changes: 2 additions & 1 deletion src/demo-app/list/list-demo.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {Component} from 'angular2/core';
import {MdButton} from '../../components/button/button';
import {MD_LIST_DIRECTIVES} from '../../components/list/list';
import {MdIcon} from '../../components/icon/icon';

@Component({
selector: 'list-demo',
templateUrl: 'demo-app/list/list-demo.html',
styleUrls: ['demo-app/list/list-demo.css'],
directives: [MD_LIST_DIRECTIVES, MdButton]
directives: [MD_LIST_DIRECTIVES, MdButton, MdIcon]
})
export class ListDemo {
items: string[] = [
Expand Down

0 comments on commit 7b3698c

Please sign in to comment.