-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): added basic Modal example
- Loading branch information
1 parent
42f8a4f
commit 0db75d1
Showing
7 changed files
with
112 additions
and
8 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
1 change: 1 addition & 0 deletions
1
packages/mosaic-examples/mosaic/modal/modal-overview/modal-overview-example.css
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 @@ | ||
/** No CSS for this example */ |
1 change: 1 addition & 0 deletions
1
packages/mosaic-examples/mosaic/modal/modal-overview/modal-overview-example.html
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 @@ | ||
<button mc-button color="primary" (click)="openModal()">Open Modal</button> |
57 changes: 57 additions & 0 deletions
57
packages/mosaic-examples/mosaic/modal/modal-overview/modal-overview-example.ts
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,57 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { McModalRef, McModalService } from '@ptsecurity/mosaic/modal'; | ||
|
||
|
||
/** | ||
* @title Basic Modal | ||
*/ | ||
@Component({ | ||
selector: 'modal-overview-example', | ||
templateUrl: 'modal-overview-example.html', | ||
styleUrls: ['modal-overview-example.css'] | ||
}) | ||
export class ModalOverviewExample { | ||
|
||
constructor( | ||
private modalService: McModalService | ||
) {} | ||
|
||
openModal() { | ||
this.modalService.open({ | ||
mcComponent: McModalCustomComponent | ||
}); | ||
} | ||
} | ||
|
||
@Component({ | ||
selector: 'mc-modal-full-custom-component', | ||
template: ` | ||
<mc-modal-title> | ||
Modal Title | ||
</mc-modal-title> | ||
<mc-modal-body> | ||
<h2>{{ title }}</h2> | ||
<h4>{{ subtitle }}</h4> | ||
<p> | ||
<span>Get Modal instance in component</span> | ||
<button mc-button color="primary" (click)="destroyModal()">destroy modal in the component</button> | ||
</p> | ||
</mc-modal-body> | ||
<div mc-modal-footer> | ||
<button mc-button color="primary" >Save</button> | ||
<button mc-button autofocus>Close</button> | ||
</div> | ||
` | ||
}) | ||
export class McModalCustomComponent { | ||
@Input() title: string; | ||
@Input() subtitle: string; | ||
|
||
constructor(private modal: McModalRef) { } | ||
|
||
destroyModal() { | ||
this.modal.destroy({ data: 'this the result data' }); | ||
} | ||
} |
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,28 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { McButtonModule } from '@ptsecurity/mosaic/button'; | ||
import { McIconModule } from '@ptsecurity/mosaic/icon'; | ||
import { McModalModule } from '@ptsecurity/mosaic/modal'; | ||
|
||
import { McModalCustomComponent, ModalOverviewExample } from './modal-overview/modal-overview-example'; | ||
|
||
|
||
const EXAMPLES = [ | ||
ModalOverviewExample, | ||
McModalCustomComponent | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
FormsModule, | ||
McButtonModule, | ||
McModalModule, | ||
McIconModule | ||
], | ||
declarations: EXAMPLES, | ||
exports: EXAMPLES, | ||
entryComponents: [ | ||
McModalCustomComponent | ||
] | ||
}) | ||
export class ModalExamplesModule {} |
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 @@ | ||
<!-- example(modal-overview) --> |