-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(divider): move divider out of mat-list
- Creates an independent mat-divider component - Adds inset capability with special accomodations for mat-list-item - Adds vertical option - Removed mat-divider from MatListModule with temporary import to prevent breaking changes - Added styling for dividers in cards - Add demos for use in list, card, and menu
- Loading branch information
1 parent
0ea4370
commit d32fe60
Showing
27 changed files
with
428 additions
and
40 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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Please see the official documentation at https://material.angular.io/components/component/divider |
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,15 @@ | ||
@import '../core/theming/palette'; | ||
@import '../core/theming/theming'; | ||
|
||
|
||
@mixin mat-divider-theme($theme) { | ||
$foreground: map-get($theme, foreground); | ||
|
||
.mat-divider { | ||
border-top-color: mat-color($foreground, divider); | ||
} | ||
|
||
.mat-divider-vertical { | ||
border-right-color: mat-color($foreground, divider); | ||
} | ||
} |
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,30 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {NgModule} from '@angular/core'; | ||
import {MatCommonModule} from '@angular/material/core'; | ||
import { | ||
MatDivider, | ||
MatDividerCssMatStyler, | ||
} from './divider'; | ||
import {CommonModule} from '@angular/common'; | ||
|
||
|
||
@NgModule({ | ||
imports: [MatCommonModule, CommonModule], | ||
exports: [ | ||
MatDivider, | ||
MatDividerCssMatStyler, | ||
MatCommonModule, | ||
], | ||
declarations: [ | ||
MatDivider, | ||
MatDividerCssMatStyler, | ||
], | ||
}) | ||
export class MatDividerModule {} |
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,64 @@ | ||
`<md-divider>` is a container component that wraps and formats a series of line items. As the base | ||
list component, it provides Material Design styling, but no behavior of its own. | ||
|
||
<!-- example(divider-overview) --> | ||
|
||
|
||
### Simple divider | ||
|
||
An `<md-divider>` element can be used on its own to create a vertical line styled with a Material theme | ||
|
||
```html | ||
<md-divider></md-divider> | ||
``` | ||
|
||
Here are the available global options: | ||
|
||
| Name | Type | Values | Description | | ||
| --------------- | ------- | ----------- | ----------------------------------------- | | ||
| inset | boolean | true, false | Whether the divider is an inset divider | | ||
| vertical | boolean | true, false | Whether the divider is a vertical divider | | ||
|
||
|
||
### Inset divider | ||
|
||
Add the `inset` attribute in order to set whether or not the divider is an inset divider. | ||
|
||
```html | ||
<md-divider [inset]="true"></md-divider> | ||
``` | ||
|
||
### Vertical divider | ||
|
||
Add the `vertical` attribute in order to set whether or not the divider is vertically-oriented. | ||
|
||
```html | ||
<md-divider [vertical]="true"></md-divider> | ||
``` | ||
|
||
|
||
### Lists with inset dividers | ||
|
||
Dividers can be added to lists as a means of separating content into distinct sections. | ||
Inset dividers can also be added to provide the appearance of distinct elements in a list without cluttering content | ||
like avatar images or icons. If combining both, please make sure to avoid adding an inset divider to the last element | ||
in a list, because it will overlap with the section divider. | ||
|
||
```html | ||
<md-list> | ||
<h3 md-subheader>Folders</h3> | ||
<md-list-item *ngFor="let folder of folders; last as last"> | ||
<md-icon md-list-icon>folder</md-icon> | ||
<h4 md-line>{{folder.name}}</h4> | ||
<p md-line class="demo-2"> {{folder.updated}} </p> | ||
<md-divider [inset]="true" *ngIf="!last"></md-divider> | ||
</md-list-item> | ||
<md-divider></md-divider> | ||
<h3 md-subheader>Notes</h3> | ||
<md-list-item *ngFor="let note of notes"> | ||
<md-icon md-list-icon>note</md-icon> | ||
<h4 md-line>{{note.name}}</h4> | ||
<p md-line class="demo-2"> {{note.updated}} </p> | ||
</md-list-item> | ||
</md-list> | ||
``` |
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,66 @@ | ||
.mat-divider { | ||
display: block; | ||
margin: 0; | ||
border-top-width: 1px; | ||
border-top-style: solid; | ||
|
||
&.mat-divider-vertical { | ||
border-top: 0; | ||
border-right-width: 1px; | ||
border-right-style: solid; | ||
position: static !important; | ||
width: auto !important; | ||
} | ||
|
||
&.mat-divider-inset { | ||
margin-left: 80px; | ||
[dir='rtl'] & { | ||
margin-left: auto; | ||
margin-right: 80px; | ||
} | ||
} | ||
} | ||
|
||
.mat-list-item { | ||
.mat-divider { | ||
position: absolute; | ||
bottom: 0; | ||
|
||
left: 0; | ||
[dir='rtl'] & { | ||
left: auto; | ||
right: 0; | ||
} | ||
|
||
width: 100%; | ||
&.mat-divider-inset { | ||
left: 72px; | ||
[dir='rtl'] & { | ||
left: auto; | ||
right: 72px; | ||
} | ||
|
||
width: calc(100% - 72px); | ||
margin: 0 !important; | ||
} | ||
} | ||
} | ||
|
||
.mat-card { | ||
.mat-divider { | ||
position: absolute; | ||
|
||
left: 0; | ||
[dir='rtl'] & { | ||
left: auto; | ||
right: 0; | ||
} | ||
|
||
width: 100%; | ||
|
||
&.mat-divider-inset { | ||
position: static; | ||
margin: 0 !important; | ||
} | ||
} | ||
} |
Oops, something went wrong.