- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.8k
Sticky header demo code #6033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Sticky header demo code #6033
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            16 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      da82a1f
              
                add lib files for sticky-header
              
              
                sllethe 52c6bce
              
                # This is a combination of 7 commits.
              
              
                sllethe 96e6d0c
              
                refine code
              
              
                sllethe 983b0f0
              
                Add demo to sticky-header
              
              
                sllethe 352f87b
              
                revert
              
              
                sllethe a3c1845
              
                deleted HEAD file
              
              
                sllethe 7945a22
              
                removed unused 'id'
              
              
                sllethe da06573
              e43a250
              e47492b
              b9d8523
              
                nit
              
              
                sllethe c15c808
              d329aaa
              3f88ac9
              7caff97
              
                fix white space between different <div>s
              
              
                sllethe 1dc7439
              File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,33 @@ | ||
| <div class="demo-sticky"> | ||
| <div class="demo-centered" cdk-scrollable> | ||
| <div> | ||
| <h1>Sticky-header Demo</h1> | ||
| </div> | ||
|  | ||
| <div class="demo-container"> | ||
|  | ||
| <div> | ||
| <div cdkStickyHeader class="demo-header-style demo-header-color3" > | ||
| <h2>Unread Messages</h2> | ||
| </div> | ||
| <p *ngFor="let item of items">{{item.name}} : {{item.messages}}</p> | ||
| </div> | ||
|  | ||
| <div cdkStickyRegion > | ||
| <div cdkStickyHeader class="demo-header-style demo-header-color2"> | ||
| <h2>Late Messages</h2> | ||
| </div> | ||
| <p *ngFor="let item of items">{{item.name}} : {{item.messages}}</p> | ||
| <p *ngFor="let item of items">{{item.name}} : {{item.messages}}</p> | ||
| </div> | ||
|  | ||
| <div cdkStickyRegion> | ||
| <div cdkStickyHeader class="demo-header-style demo-header-color1" > | ||
| <h2>Read Messages</h2> | ||
| </div> | ||
| <p *ngFor="let item of items">{{item.name}} : {{item.messages}}</p> | ||
| <p *ngFor="let item of items">{{item.name}} : {{item.messages}}</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | 
  
    
      This file contains hidden or 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,80 @@ | ||
| .demo-sticky { | ||
| .demo-centered { | ||
| text-align: left; | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
| height: 500px; | ||
| overflow: auto;} | ||
|  | ||
| button { | ||
| position: fixed; | ||
| margin: 16px; | ||
| z-index: 99; | ||
| } | ||
|  | ||
| * { | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|  | ||
| body { | ||
| font: 14px/1.5 Helvetica, Arial, sans-serif; | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
|  | ||
| } | ||
|  | ||
| h1 { | ||
| font-size: 20px; | ||
| padding: 20px; | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
| } | ||
|  | ||
| h2 { | ||
| font-size: 20px; | ||
| padding: 20px; | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
| } | ||
|  | ||
| p { | ||
| text-indent: 4em; | ||
| padding:15px; | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
| } | ||
|  | ||
| div{ | ||
| margin: 0; border: 0; padding: 0; | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
| } | ||
| } | ||
|  | ||
| .mat-radio-button { | ||
| display: block; | ||
| } | ||
|  | ||
| .demo-container { | ||
| margin: 0; | ||
| -webkit-appearance: none; | ||
| -moz-appearance: none; | ||
| } | ||
|  | ||
| .demo-header-style{ | ||
| -webkit-appearance: none; | ||
| padding: 20px; | ||
| } | ||
|  | ||
| .demo-header-color1 { | ||
| background: #cecece; | ||
| } | ||
|  | ||
| .demo-header-color2 { | ||
| background: #cea7a7; | ||
| } | ||
|  | ||
| .demo-header-color3 { | ||
| background: #c2eae5; | ||
| } | 
  
    
      This file contains hidden or 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,27 @@ | ||
| import {Component} from '@angular/core'; | ||
| import {BrowserModule} from '@angular/platform-browser'; | ||
| import {CdkStickyRegion, CdkStickyHeader} from '@angular/material'; | ||
|  | ||
|  | ||
| @Component({ | ||
| moduleId: module.id, | ||
| selector: 'sticky-header-demo', | ||
| templateUrl: 'sticky-header-demo.html', | ||
| styleUrls: ['sticky-header-demo.css'], | ||
| }) | ||
|  | ||
| export class StickyHeaderDemo { | ||
| items: any[] = [ | ||
| {name: 'Min', messages: 'Brunch is this weekend?'}, | ||
| {name: 'Li', messages: 'Yes'}, | ||
| {name: 'Chan', messages: 'Looking'}, | ||
| {name: 'Chan', messages: 'Forward'}, | ||
| {name: 'Chan', messages: 'To It !'}, | ||
| {name: 'Min', messages: 'Branch is this weekend?'}, | ||
| {name: 'Eat', messages: 'Green Peppers'}, | ||
| {name: 'Chan', messages: 'Where?'}, | ||
| {name: 'Jack', messages: 'Pirate!'}, | ||
| {name: 'Jone', messages: 'Black pearl'}, | ||
| {name: 'Jack', messages: 'Back to the sea!'}, | ||
| ]; | ||
| } | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this to the
navItemsindemo-app.ts?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Added to
navItemsindemo-app.ts