Skip to content

Commit 208cd65

Browse files
devversionjelbourn
authored andcommitted
feat(button): add md-icon-button styling.
* Added md-icon-button component * Showcased the md-icon-button in the button demos. Fixes #188 Closes #206
1 parent e7beecd commit 208cd65

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

src/components/button/_button-base.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ $md-button-margin: 0 !default;
1313
$md-button-line-height: 36px !default;
1414
$md-button-border-radius: 3px !default;
1515

16+
// Icon Button standards
17+
$md-icon-button-size: 40px !default;
18+
$md-icon-button-border-radius: 50px !default;
19+
$md-icon-button-line-height: 24px !default;
20+
1621
// Fab standards
1722
$md-fab-border-radius: 50% !default;
1823
$md-fab-size: 56px !default;

src/components/button/button.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,28 @@
3131
@include md-fab($md-mini-fab-size, $md-mini-fab-padding)
3232
}
3333

34+
[md-icon-button] {
35+
@extend %md-button-base;
36+
37+
min-width: 0;
38+
padding: 0;
39+
40+
width: $md-icon-button-size;
41+
height: $md-icon-button-size;
42+
43+
line-height: $md-icon-button-line-height;
44+
border-radius: $md-icon-button-border-radius;
45+
46+
&.md-button-focus {
47+
background-color: md-color($md-foreground, base, 0.12);
48+
@include md-button-theme('background-color', 0.12);
49+
}
50+
51+
.md-button-wrapper > * {
52+
vertical-align: middle;
53+
}
54+
}
55+
3456
// Applies a clearer border for high-contrast mode (a11y)
3557
@media screen and (-ms-high-contrast: active) {
3658
.md-raised-button, .md-fab, .md-mini-fab {

src/components/button/button.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import {TimerWrapper} from 'angular2/src/facade/async';
1616

1717

1818
@Component({
19-
selector: '[md-button]:not(a), [md-raised-button]:not(a), [md-fab]:not(a), [md-mini-fab]:not(a)',
19+
selector: '[md-button]:not(a), [md-raised-button]:not(a), [md-icon-button]:not(a), ' +
20+
'[md-fab]:not(a), [md-mini-fab]:not(a)',
2021
inputs: ['color'],
2122
host: {
2223
'[class.md-button-focus]': 'isKeyboardFocused',
@@ -79,7 +80,7 @@ export class MdButton {
7980
}
8081

8182
@Component({
82-
selector: 'a[md-button], a[md-raised-button], a[md-fab], a[md-mini-fab]',
83+
selector: 'a[md-button], a[md-raised-button], a[md-icon-button], a[md-fab], a[md-mini-fab]',
8384
inputs: ['color'],
8485
host: {
8586
'[class.md-button-focus]': 'isKeyboardFocused',

src/demo-app/button/button-demo.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@
4545
</button>
4646
</section>
4747

48+
<section>
49+
<button md-icon-button color="primary">
50+
<i class="material-icons md-24">menu</i>
51+
</button>
52+
53+
<button md-icon-button color="accent">
54+
<i class="material-icons md-24">favorite</i>
55+
</button>
56+
57+
<button md-icon-button>
58+
<i class="material-icons md-24">more_vert</i>
59+
</button>
60+
</section>
61+
4862
<section>
4963
<div>
5064
<span>isDisabled: {{isDisabled}}</span>
@@ -57,5 +71,9 @@
5771
<button md-mini-fab [disabled]="isDisabled">
5872
<i class="material-icons md-24">check</i>
5973
</button>
74+
75+
<button md-icon-button color="accent" [disabled]="isDisabled">
76+
<i class="material-icons md-24">favorite</i>
77+
</button>
6078
</section>
6179
</div>

0 commit comments

Comments
 (0)