Repository navigation
feat(divider): move divider out of mat-list - #5862
Conversation
e7d1a42 to
7c93bf2
Compare
|
@CaerusKaru in divider.scss you need to add: Otherwise the color will be black and not following the standard |
|
@Gustav0ar the color is set in _divider-theme.scss |
|
Ah, ok, my bad. I missed reviewing that file |
| </mat-list-item> | ||
| </mat-list> | ||
|
|
||
| <<<<<<< HEAD |
There was a problem hiding this comment.
Did you forgot to remove this? Also in line 43.
There was a problem hiding this comment.
Resolved, thanks for the catch. I rebased and for some reason Git missed this.
917ce22 to
7da32ed
Compare
01aea89 to
06dd188
Compare
b8ed704 to
8647d64
Compare
|
@CaerusKaru if you rebase from master the errors should be resolved. |
|
Thanks @crisbeto, rebased and ready for review. |
| </mat-card-content> | ||
| <mat-divider [inset]="true"></mat-divider> | ||
| <mat-card-actions> | ||
| <button md-button>LIKE</button> |
| <span>{{message.subject}} -- </span> | ||
| <span class="demo-secondary-text">{{message.message}}</span> | ||
| </p> | ||
| <mat-divider [inset]="true" *ngIf="!last"></mat-divider> |
There was a problem hiding this comment.
You forgot to bind last to a local variable: *ngFor="let message of messages; last as last"
There was a problem hiding this comment.
Added, this got cut from a previous commit when rebased, good catch
| | 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 | |
There was a problem hiding this comment.
IMO the values column is covered by them both having boolean type. Further, I'm not sure this table is even necessary, since it will be available on the api page.
There was a problem hiding this comment.
Originally pulled from list, but now I see it's been removed. Will fix.
| `<mat-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) --> |
There was a problem hiding this comment.
There doesn't seem to be a divider example?
There was a problem hiding this comment.
Do you mean in the material-examples directory?
There was a problem hiding this comment.
I see now that the prose is wrong here, will correct.
There was a problem hiding this comment.
Yep. It would probably be good to add one in with this PR anyway.
f5985ae to
d55f5d4
Compare
| }); | ||
| }); | ||
|
|
||
| @Component({ |
There was a problem hiding this comment.
Rather than creating a number of Components that have to be recompiled on every run, can you create a single Component that is altered through attributes for tests?
We have found a bottleneck in our tests comes from having to recompile many components on each test run.
@Component({
template: `<mat-divider [inset]="inset" [vertical]="vertical"></mat-divider>`
})
class MatDividerTestComponent {
vertical: boolean;
inset: boolean;
}Then in tests you would do:
it('should apply a vertical class', () => {
fixture.componentInstance.vertical = true;
fixture.detechChanges();
expect(divider.nativeElement.className).toContain('mat-divider-vertical');
});There was a problem hiding this comment.
Great suggestions, added
| })); | ||
|
|
||
| it('should not apply any additional class to a list without lines', () => { | ||
| const fixture = TestBed.createComponent(MatDividerBase); |
There was a problem hiding this comment.
Instead of calling TestBed.createComponent in every test, set up a beforeEach block to do this setup.
let fixture: ComponentFixture;
beforeEach(() => {
fixture = TestBed.createComponent(MatDividerTestComponent);
});
| * found in the LICENSE file at https://angular.io/license | ||
| */ | ||
|
|
||
| import { |
There was a problem hiding this comment.
Please put one import per line if it doesn't fit on a single line:
import {
ChangeDetectionStrategy,
Component,
Input,
ViewEncapsulation
} from '@angular/core';|
|
||
| .mat-list-item { | ||
| .mat-divider { | ||
| position: absolute; |
There was a problem hiding this comment.
There seems to be inconsistent spacing between attributes, can you make the spacing more consistent?
| border-top: 0; | ||
| border-right-width: 1px; | ||
| border-right-style: solid; | ||
| position: static; |
There was a problem hiding this comment.
position: static and width: auto should not be necessary as these are the default values on any custom element.
| } | ||
|
|
||
| &.mat-divider-inset { | ||
| margin-left: 80px; |
There was a problem hiding this comment.
Where does this 80px size come from? Can you put in a comment explaining it?
There was a problem hiding this comment.
It came from AngularJS Material found here. baseline-grid = 8.
There was a problem hiding this comment.
I don't really have an explanation for it, I couldn't find one in the original repo. Is there any way you can reach out to the internal UX team to find verification/justification?
| } | ||
|
|
||
| &.mat-divider-inset { | ||
| margin-left: 80px; |
There was a problem hiding this comment.
For the inset's margin size, can you move the value (80px) into a variable at the top of the file?
| .mat-divider { | ||
| display: block; | ||
| margin: 0; | ||
| border-top-width: 1px; |
There was a problem hiding this comment.
For the dividers line width (based on the border width), can you move the value (1px) into a variable at the top of the file?
| } | ||
| } | ||
|
|
||
| .mat-list-item { |
There was a problem hiding this comment.
Rules specific to other components should be in the the respective component since it is an override specifically for the component.
| export class MatDivider { | ||
| /** Whether the divider is vertically aligned. */ | ||
| @Input() get vertical(): boolean { return this._vertical; } | ||
| set vertical(value: boolean) { |
There was a problem hiding this comment.
for both setter methods, you should be able to move them to a single line which might be a bit more readable.
bc1c86b to
9ee8778
Compare
| 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. |
There was a problem hiding this comment.
What about:
If combining both, please mMake sure to avoid adding an inset divider to the last element in a list, because it will overlap with the section divider
6da04fa to
eeec51f
Compare
| padding: $mat-card-default-padding; | ||
| border-radius: $mat-card-border-radius; | ||
|
|
||
| .mat-divider { |
There was a problem hiding this comment.
can you separate the attributes from the rules here?
.mat-divider {
position: absolute;
left: 0;
width: 100%;
[dir='rtl'] & {
left: auto;
right: 0;
}
&.mat-divider-inset {
position: static;
margin: 0;
}
}| padding: 4px; | ||
| } | ||
|
|
||
| .mat-divider { |
There was a problem hiding this comment.
can you separate the attributes from the rules here?
.mat-divider {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
[dir='rtl'] & {
left: auto;
right: 0;
}
&.mat-divider-inset {
left: $mat-list-item-inset-divider-offset;
width: calc(100% - #{$mat-list-item-inset-divider-offset});
margin: 0;
[dir='rtl'] & {
left: auto;
right: 72px;
}
}
}- 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
|
Caretaker Note: This change should be entirely transparent to end users, but we should take careful note on it to be sure that nothing changes as it is swapping out internal component usage. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Moves
mat-dividerout ofMatListModule, replaced with temporary import to prevent breaking changes. Also includes support for inset and vertical dividers.Fixes #5524.
Fixes #2017.