This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(subheader): add subheader component
references: #216
- Loading branch information
1 parent
d5d7e8d
commit c377a36
Showing
12 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
material-subheader { | ||
color: $text-medium; | ||
display: block; | ||
font-size: $subheader-font-size; | ||
font-weight: $subheader-font-weight; | ||
line-height: $subheader-line-height; | ||
padding: $subheader-padding; | ||
margin: $subheader-margin; | ||
|
||
&.material-subheader-colored { | ||
color: $theme-light-blue | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
<div ng-app="app" ng-controller="AppCtrl"> | ||
<material-content layout="vertical"> | ||
<section> | ||
<material-subheader class="material-subheader-colored">Unread Messages</material-subheader> | ||
<material-list layout="vertical"> | ||
<material-item ng-repeat="message in messages"> | ||
<div class="material-tile-left"> | ||
<img ng-src="{{message.face}}" class="face" alt="{{message.who}}"> | ||
</div> | ||
<div class="material-tile-content"> | ||
<h2>{{message.what}}</h2> | ||
<h3>{{message.who}}</h3> | ||
<p> | ||
{{message.notes}} | ||
</p> | ||
</div> | ||
</material-item> | ||
</material-list> | ||
</section> | ||
<section> | ||
<material-subheader>Read Messages</material-subheader> | ||
<material-list layout="vertical"> | ||
<material-item ng-repeat="message in messages"> | ||
<div class="material-tile-left"> | ||
<img ng-src="{{message.face}}" class="face" alt="{{message.who}}"> | ||
</div> | ||
<div class="material-tile-content"> | ||
<h2>{{message.what}}</h2> | ||
<h3>{{message.who}}</h3> | ||
<p> | ||
{{message.notes}} | ||
</p> | ||
</div> | ||
</material-item> | ||
</material-list> | ||
</section> | ||
</material-content> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
angular.module('app', ['ngMaterial']) | ||
|
||
.controller('AppCtrl', function($scope) { | ||
$scope.messages = [ | ||
{ | ||
face : '/img/list/60.jpeg', | ||
what: 'Brunch this weekend?', | ||
who: 'Min Li Chan', | ||
when: '3:08PM', | ||
notes: " I'll be in your neighborhood doing errands" | ||
}, | ||
{ | ||
face : '/img/list/60.jpeg', | ||
what: 'Brunch this weekend?', | ||
who: 'Min Li Chan', | ||
when: '3:08PM', | ||
notes: " I'll be in your neighborhood doing errands" | ||
}, | ||
]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
material-content { | ||
margin-right: 7px; | ||
} | ||
|
||
.face { | ||
border-radius: 30px; | ||
border: 1px solid #ddd; | ||
width: 48px; | ||
margin: 16px; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"module": "material.components.subheader", | ||
"name": "SubHeader", | ||
"demos": { | ||
"basic": { | ||
"name": "Basic Usage", | ||
"files": ["demos/basic/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* @ngdoc module | ||
* @name material.components.subheader | ||
* @description | ||
* SubHeader module | ||
*/ | ||
angular.module('material.components.subheader', []) | ||
|
||
.directive('materialSubheader', [ | ||
materialSubheaderDirective | ||
]); | ||
|
||
/** | ||
* @ngdoc directive | ||
* @name materialSubheader | ||
* @module material.components.subheader | ||
* | ||
* @restrict E | ||
* | ||
* @description | ||
* The `<material-subheader>` directive is a subheader for a section | ||
* | ||
* @usage | ||
* <hljs lang="html"> | ||
* <material-subheader>Online Friends</material-subheader> | ||
* </hljs> | ||
*/ | ||
|
||
function materialSubheaderDirective() { | ||
return { | ||
restrict: 'E', | ||
compile: function($el, $attr) { | ||
$el.attr({ | ||
'role' : Constant.ARIA.ROLE.HEADING | ||
}); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe('materialSubheader', function() { | ||
beforeEach(module('material.components.subheader')); | ||
|
||
it('should set aria role', inject(function($compile, $rootScope) { | ||
var $el = $compile('<material-subheader>Hello world!</material-header>')($rootScope); | ||
expect($el.attr('role')).toEqual('heading'); | ||
})); | ||
|
||
it('should preserve content', inject(function($compile, $rootScope) { | ||
var $scope = $rootScope.$new(); | ||
$scope.to = 'world'; | ||
var $el = $compile('<material-subheader>Hello {{ to }}!</material-subheader>')($scope); | ||
$scope.$digest(); | ||
expect($el.html()).toEqual('Hello world!'); | ||
})); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters