-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add button to toggle theme in demo-app (#3093)
* update: add button to toggle theme in demo-app * Adds a button to the demo-app toolbar that allows developers to quickly change between dark and light Material themes. This is very useful when building new components or just when confirming that all components work with dark themes. * Improve list-demo in dark-theme * Fix stylelint * Address comments
- Loading branch information
1 parent
194714a
commit 47cc025
Showing
15 changed files
with
100 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
section { | ||
display: flex; | ||
align-items: center; | ||
background-color: #f7f7f7; | ||
margin: 8px; | ||
} | ||
|
||
|
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,16 @@ | ||
@import '@angular/material/core/theming/all-theme'; | ||
|
||
// Include core material styles. | ||
@include mat-core(); | ||
|
||
$primary: mat-palette($mat-indigo); | ||
$accent: mat-palette($mat-pink); | ||
|
||
$light-theme: mat-light-theme($primary, $accent); | ||
$dark-theme: mat-dark-theme($primary, $accent); | ||
|
||
@include angular-material-theme($light-theme); | ||
|
||
.demo-dark-theme { | ||
@include angular-material-theme($dark-theme); | ||
} |
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 |
---|---|---|
@@ -1,41 +1,46 @@ | ||
<md-sidenav-container class="demo-root" fullscreen> | ||
<md-sidenav #start> | ||
<md-nav-list> | ||
<a *ngFor="let navItem of navItems" | ||
md-list-item | ||
(click)="start.close()" | ||
[routerLink]="[navItem.route]"> | ||
{{navItem.name}} | ||
</a> | ||
<!-- Theme class needs to be applied above sidenav-container to style content background. --> | ||
<div [class.demo-dark-theme]="isDarkTheme"> | ||
<md-sidenav-container class="demo-root" fullscreen> | ||
<md-sidenav #start> | ||
<md-nav-list> | ||
<a *ngFor="let navItem of navItems" | ||
md-list-item | ||
(click)="start.close()" | ||
[routerLink]="[navItem.route]"> | ||
{{navItem.name}} | ||
</a> | ||
|
||
<hr> | ||
<hr> | ||
|
||
<a md-list-item | ||
(click)="start.close()" | ||
[routerLink]="['baseline']"> | ||
Baseline | ||
</a> | ||
</md-nav-list> | ||
<button md-button (click)="start.close()">CLOSE</button> | ||
</md-sidenav> | ||
<div> | ||
<md-toolbar color="primary"> | ||
<button md-icon-button (click)="start.open()"> | ||
<md-icon class="md-24" >menu</md-icon> | ||
</button> | ||
<div class="demo-toolbar"> | ||
<h1>Angular Material Demos</h1> | ||
<button md-button (click)="toggleFullscreen()" title="Toggle fullscreen"> | ||
Fullscreen | ||
<a md-list-item | ||
(click)="start.close()" | ||
[routerLink]="['baseline']"> | ||
Baseline | ||
</a> | ||
</md-nav-list> | ||
<button md-button (click)="start.close()">CLOSE</button> | ||
</md-sidenav> | ||
<div> | ||
<md-toolbar color="primary"> | ||
<button md-icon-button (click)="start.open()"> | ||
<md-icon class="md-24" >menu</md-icon> | ||
</button> | ||
<button md-button (click)="root.dir = (root.dir == 'rtl' ? 'ltr' : 'rtl')" title="Toggle between RTL and LTR"> | ||
{{root.dir.toUpperCase()}} | ||
</button> | ||
</div> | ||
</md-toolbar> | ||
<div class="demo-toolbar"> | ||
<h1>Angular Material Demos</h1> | ||
<span class="demo-flex-fill"></span> | ||
<button md-button (click)="isDarkTheme = !isDarkTheme">Toggle Theme</button> | ||
<button md-button (click)="toggleFullscreen()" title="Toggle fullscreen"> | ||
Fullscreen | ||
</button> | ||
<button md-button (click)="root.dir = (root.dir == 'rtl' ? 'ltr' : 'rtl')" title="Toggle between RTL and LTR"> | ||
{{root.dir.toUpperCase()}} | ||
</button> | ||
</div> | ||
</md-toolbar> | ||
|
||
<div #root="$implicit" dir="ltr" class="demo-content"> | ||
<router-outlet></router-outlet> | ||
<div #root="$implicit" dir="ltr" class="demo-content"> | ||
<router-outlet></router-outlet> | ||
</div> | ||
</div> | ||
</div> | ||
</md-sidenav-container> | ||
</md-sidenav-container> | ||
</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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
} | ||
|
||
.demo-section { | ||
background-color: #f7f7f7; | ||
margin: 8px; | ||
padding: 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
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
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