Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
feat(subheader): add subheader component with sticky scroll
Browse files Browse the repository at this point in the history
Closes #216. Closes #269.
  • Loading branch information
rschmukler authored and ajoslin committed Oct 4, 2014
1 parent 6162156 commit 7787c9c
Show file tree
Hide file tree
Showing 21 changed files with 817 additions and 22 deletions.
4 changes: 4 additions & 0 deletions config/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ module.exports = {
'src/components/animate/noEffect.js',
'src/components/animate/inkCssRipple.js',

// Sticky Components
'src/components/sticky/sticky.js',

// Components
'src/components/buttons/buttons.js',
'src/components/card/card.js',
Expand All @@ -90,6 +93,7 @@ module.exports = {
'src/components/sidenav/sidenav.js',
'src/components/slider/slider.js',
'src/components/switch/switch.js',
'src/components/subheader/subheader.js',
'src/components/tabs/tabs.js',
'src/components/tabs/js/*.js',
'src/components/toast/toast.js',
Expand Down
5 changes: 1 addition & 4 deletions src/components/content/_content.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
material-content {

display: block;
position: relative;
overflow: auto;
-webkit-overflow-scrolling: touch;

Expand All @@ -18,10 +19,6 @@ material-content {
&.material-content-padding {
padding: 8px;
}

&[scroll-shrink] {
position: relative;
}
}

@media (min-width: $layout-breakpoint-sm) {
Expand Down
5 changes: 3 additions & 2 deletions src/components/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ angular.module('material.components.content', [
function materialContentDirective() {
return {
restrict: 'E',
controller: ['$element', ContentController],
controller: ['$scope', '$element', ContentController],
link: function($scope, $element, $attr) {
$scope.$broadcast('$materialContentLoaded', $element);
}
};

function ContentController($element) {
function ContentController($scope, $element) {
this.$scope = $scope;
this.$element = $element;
}
}
14 changes: 9 additions & 5 deletions src/components/list/_list.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
material-list {
padding: $list-padding-top $list-padding-right $list-padding-bottom $list-padding-left;

&.with-subheader {
padding-top: 0px;
}
}

material-item {
Expand Down Expand Up @@ -35,16 +39,16 @@ material-item-content {

text-overflow: ellipsis;

h2 {
margin: $list-h2-margin;
font-weight: $list-h2-font-weight;
font-size: $list-h2-font-size;
}
h3 {
margin: $list-h3-margin;
font-weight: $list-h3-font-weight;
font-size: $list-h3-font-size;
}
h4 {
margin: $list-h4-margin;
font-weight: $list-h4-font-weight;
font-size: $list-h4-font-size;
}
p {
margin: $list-p-margin;
font-size: $list-p-font-size;
Expand Down
4 changes: 2 additions & 2 deletions src/components/list/demo1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<img ng-src="{{item.face}}" class="face" alt="{{item.who}}">
</div>
<div class="material-tile-content">
<h2>{{item.what}}</h2>
<h3>{{item.who}}</h3>
<h3>{{item.what}}</h3>
<h4>{{item.who}}</h4>
<p>
{{item.notes}}
</p>
Expand Down
4 changes: 2 additions & 2 deletions src/components/list/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ angular.module('material.components.list', [])
* <img ng-src="{{item.face}}" class="face" alt="{{item.who}}">
* </div>
* <div class="material-tile-content">
* <h2>{{item.what}}</h2>
* <h3>{{item.who}}</h3>
* <h3>{{item.what}}</h3>
* <h4>{{item.who}}</h4>
* <p>
* {{item.notes}}
* </p>
Expand Down
30 changes: 30 additions & 0 deletions src/components/sticky/_sticky.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@






.material-subheader {
position:relative;
}
.material-sticky-invisible {
opacity: 0;
}

.material-sticky-container {
position: absolute;
z-index: 2;
overflow: hidden;
pointer-events: none;

.material-sticky-clone {
top: 0;
left: 0;
right: 24px;
position: absolute;
@include transform(translate3d(0, 0, 0));
&:not(.material-sticky-active) {
@include transform(translate3d(-9999px, -9999px, 0));
}
}
}
Loading

0 comments on commit 7787c9c

Please sign in to comment.