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

Commit

Permalink
Fix flat button style and extract h4 from mz-modal-header (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
scote authored and jfcere committed Jan 29, 2018
1 parent 1868099 commit af74f0a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<mz-modal [fixedFooter]="true">
<mz-modal-header>
Modal Title
<h4>Modal Title</h4>
</mz-modal-header>
<mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br>
Expand Down
16 changes: 8 additions & 8 deletions demo-app/src/app/modal/modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h5 class="light">Basic modal</h5>

<mz-modal #basicModal>
<mz-modal-header>
Modal Title
<h4>Modal Title</h4>
</mz-modal-header>
<mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Expand Down Expand Up @@ -42,7 +42,7 @@ <h5 class="light">Fixed footer modal</h5>

<mz-modal #fixedFooterModal [fixedFooter]="true">
<mz-modal-header>
Modal Title
<h4>Modal Title</h4>
</mz-modal-header>
<mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br>
Expand Down Expand Up @@ -77,7 +77,7 @@ <h5 class="light">Bottom sheet modal</h5>

<mz-modal #bottomSheetModal [fixedFooter]="true" [bottomSheet]="true">
<mz-modal-header>
Modal Title
<h4>Modal Title</h4>
</mz-modal-header>
<mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br>
Expand Down Expand Up @@ -112,7 +112,7 @@ <h5 class="light">Fullscreen modal</h5>

<mz-modal #fullscreenModal [fixedFooter]="true" [fullscreen]="true">
<mz-modal-header>
Modal Title
<h4>Modal Title</h4>
</mz-modal-header>
<mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br>
Expand All @@ -133,7 +133,7 @@ <h5 class="light">Fullscreen modal</h5>

<mz-modal #bottomSheetFullscreenModal [fixedFooter]="true" [bottomSheet]="true" [fullscreen]="true">
<mz-modal-header>
Modal Title
<h4>Modal Title</h4>
</mz-modal-header>
<mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br>
Expand Down Expand Up @@ -168,7 +168,7 @@ <h5 class="light">Modal Options</h5>

<mz-modal #optionsModal [fixedFooter]="true" [options]="modalOptions">
<mz-modal-header>
Modal Title
<h4>Modal Title</h4>
</mz-modal-header>
<mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br>
Expand Down Expand Up @@ -230,7 +230,7 @@ <h5 class="light">HTML Structure</h5>

&lt;mz-modal #bottomSheetModal [fixedFooter]="true" [bottomSheet]="true" [options]="modalOptions">
&lt;mz-modal-header>
Modal Title
&lt;h4>Modal Title&lt;/h4>
&lt;/mz-modal-header>
&lt;mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Expand Down Expand Up @@ -326,7 +326,7 @@ <h5 class="light">MzModalService</h5>
<app-code-snippet>
&lt;mz-modal [fixedFooter]="true">
&lt;mz-modal-header>
Modal Title
&lt;h4>Modal Title&lt;/h4>
&lt;/mz-modal-header>
&lt;mz-modal-content>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Expand Down
1 change: 1 addition & 0 deletions src/app/button/button.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class MzButtonDirective extends HandlePropChanges implements OnInit {
}

handleFlat() {
this.renderer.setElementClass(this.elementRef.nativeElement, 'btn', !this.flat);
this.renderer.setElementClass(this.elementRef.nativeElement, 'btn-flat', this.flat);
}

Expand Down
1 change: 1 addition & 0 deletions src/app/button/button.directive.unit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ describe('MzButtonDirective:unit', () => {
directive.flat = true;
directive.handleFlat();

expect(renderer.setElementClass).toHaveBeenCalledWith(mockElementRef.nativeElement, 'btn', !directive.flat);
expect(renderer.setElementClass).toHaveBeenCalledWith(mockElementRef.nativeElement, 'btn-flat', directive.flat);
});

Expand Down
4 changes: 1 addition & 3 deletions src/app/modal/modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
[class.modal-fullscreen]="fullscreen"
>
<div class="modal-content">
<h4>
<ng-content select="mz-modal-header"></ng-content>
</h4>
<ng-content select="mz-modal-header"></ng-content>
<p>
<ng-content select="mz-modal-content"></ng-content>
</p>
Expand Down
7 changes: 7 additions & 0 deletions src/app/modal/modal.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@
}
}
}

#{'/deep/'} mz-modal-header {
h5, h6
{
margin-top: 0;
}
}

0 comments on commit af74f0a

Please sign in to comment.