File tree Expand file tree Collapse file tree 6 files changed +82
-10
lines changed Expand file tree Collapse file tree 6 files changed +82
-10
lines changed Original file line number Diff line number Diff line change 1
1
2
2
@import ' variables' ;
3
3
@import ' elevation' ;
4
+ @import ' mixins' ;
4
5
5
6
// TODO(jelbourn): This goes away.
6
7
@import ' default-theme' ;
@@ -34,12 +35,7 @@ $md-mini-fab-padding: 8px !default;
34
35
position : relative ;
35
36
36
37
// Reset browser <button> styles.
37
- background : transparent ;
38
- text-align : center ;
39
- cursor : pointer ;
40
- user-select : none ;
41
- outline : none ;
42
- border : none ;
38
+ @include md-button-reset ();
43
39
44
40
// Make anchors render like buttons.
45
41
display : inline-block ;
@@ -52,6 +48,7 @@ $md-mini-fab-padding: 8px !default;
52
48
font-family : $md-font-family ;
53
49
font-weight : 500 ;
54
50
color : currentColor ;
51
+ text-align : center ;
55
52
56
53
// Sizing.
57
54
margin : $md-button-margin ;
Original file line number Diff line number Diff line change
1
+ < div class ="md-menu ">
2
+ < ng-content > </ ng-content >
3
+ </ div >
4
+
Original file line number Diff line number Diff line change
1
+ // TODO(kara): update vars for desktop when MD team responds
2
+
3
+ @import ' variables' ;
4
+ @import ' elevation' ;
5
+ @import ' default-theme' ;
6
+ @import ' mixins' ;
7
+
8
+ // menu width must be a multiple of 56px
9
+ $md-menu-overlay-min-width : 112px !default ; // 56 * 2
10
+ $md-menu-overlay-max-width : 280px !default ; // 56 * 5
11
+
12
+ $md-menu-overlay-max-height : calc (100vh + $md-menu-item-height ) !default ;
13
+ $md-menu-item-height : 48px !default ;
14
+ $md-menu-font-size : 16px !default ;
15
+ $md-menu-side-padding : 16px !default ;
16
+
17
+ .md-menu {
18
+ @include md-elevation (2 );
19
+ min-width : $md-menu-overlay-min-width ;
20
+ max-width : $md-menu-overlay-max-width ;
21
+ max-height : $md-menu-overlay-max-height ;
22
+
23
+ background : md-color ($md-background , ' background' );
24
+ }
25
+
26
+ [md-menu-item ] {
27
+ @include md-button-reset ();
28
+
29
+ display : block ;
30
+ width : 100% ;
31
+ height : $md-menu-item-height ;
32
+ padding : 0 $md-menu-side-padding ;
33
+
34
+ font-size : $md-menu-font-size ;
35
+ font-family : $md-font-family ;
36
+ text-align : start ;
37
+ color : md-color ($md-foreground , ' text' );
38
+
39
+ & [disabled ] {
40
+ color : md-color ($md-foreground , ' disabled' );
41
+ }
42
+
43
+ & :hover:not ([disabled ]) {
44
+ background : md-color ($md-background , ' hover' );
45
+ }
46
+ }
47
+
Original file line number Diff line number Diff line change 1
- import { Component , ViewEncapsulation } from '@angular/core' ;
1
+ import { Component , Directive , ViewEncapsulation } from '@angular/core' ;
2
2
3
3
@Component ( {
4
4
moduleId : module . id ,
5
5
selector : 'md-menu' ,
6
+ host : { 'role' : 'menu' } ,
6
7
templateUrl : 'menu.html' ,
7
8
styleUrls : [ 'menu.css' ] ,
8
- encapsulation : ViewEncapsulation . None
9
+ encapsulation : ViewEncapsulation . None ,
10
+ exportAs : 'mdMenu'
9
11
} )
10
12
export class MdMenu { }
11
13
12
- export const MD_MENU_DIRECTIVES = [ MdMenu ] ;
14
+ @Directive ( {
15
+ selector : '[md-menu-item]' ,
16
+ host : { 'role' : 'menuitem' }
17
+ } )
18
+ export class MdMenuItem { }
19
+
20
+ export const MD_MENU_DIRECTIVES = [ MdMenu , MdMenuItem ] ;
13
21
Original file line number Diff line number Diff line change 38
38
}
39
39
}
40
40
41
+ /* *
42
+ * This mixin overrides default button styles like the gray background,
43
+ * the border, and the outline.
44
+ */
45
+ @mixin md-button-reset {
46
+ background : transparent ;
47
+ cursor : pointer ;
48
+ user-select : none ;
49
+ outline : none ;
50
+ border : none ;
51
+ }
52
+
41
53
/* *
42
54
* A mixin, which generates temporary ink ripple on a given component.
43
55
* When $bindToParent is set to true, it will check for the focused class on the same selector as you included
Original file line number Diff line number Diff line change 1
- menu
1
+ < md-menu >
2
+ < button md-menu-item > Refresh</ button >
3
+ < button md-menu-item > Settings</ button >
4
+ < button md-menu-item disabled > Help</ button >
5
+ </ md-menu >
You can’t perform that action at this time.
0 commit comments