Skip to content

Commit c9c76fe

Browse files
Renamed component props.
1 parent a39e94c commit c9c76fe

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

src/modal/alert-modal.component.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {
22
Component,
33
Injector,
4-
OnInit,
5-
ElementRef,
6-
AfterViewInit
4+
ElementRef
75
} from "@angular/core";
86
import {
97
trigger,
@@ -13,7 +11,6 @@ import {
1311
animate
1412
} from "@angular/animations";
1513
import Modal from "./modal.decorator";
16-
import { ModalService } from "./modal.service";
1714

1815
/**
1916
* Component to create standard modals for presenting content or asking for user's input.
@@ -40,8 +37,8 @@ import { ModalService } from "./modal.service";
4037
* openModal() {
4138
* this.modalService.show({
4239
* modalType: "default",
43-
* headerLabel: "optional header text",
44-
* title: "Modal title",
40+
* modalLabel: "optional header text",
41+
* modalTitle: "Modal modalTitle",
4542
* text: "Modal text",
4643
* buttons: [{
4744
* text: "Button text",
@@ -62,11 +59,11 @@ import { ModalService } from "./modal.service";
6259
template: `
6360
<ibm-modal [modalType]="modalType">
6461
<ibm-modal-header (closeSelect)="closeModal()">
65-
<p class="bx--modal-header__label bx--type-delta">{{headerLabel}}</p>
66-
<p class="bx--modal-header__heading bx--type-beta">{{title}}</p>
62+
<p class="bx--modal-header__label bx--type-delta">{{modalLabel}}</p>
63+
<p class="bx--modal-header__heading bx--type-beta">{{modalTitle}}</p>
6764
</ibm-modal-header>
6865
<div class="bx--modal-content">
69-
<p>{{text}}</p>
66+
<p>{{modalContent}}</p>
7067
</div>
7168
<ibm-modal-footer *ngIf="buttons.length > 0">
7269
<ng-container *ngFor="let button of buttons; let i = index">
@@ -84,9 +81,9 @@ import { ModalService } from "./modal.service";
8481
})
8582
export class AlertModalComponent {
8683
modalType = "default";
87-
headerLabel: string;
88-
title: string;
89-
text: string;
84+
modalLabel: string;
85+
modalTitle: string;
86+
modalContent: string;
9087
buttons = [];
9188

9289
/**
@@ -99,9 +96,9 @@ export class AlertModalComponent {
9996
private elementRef: ElementRef
10097
) {
10198
this.modalType = this.injector.get("modalType");
102-
this.headerLabel = this.injector.get("headerLabel");
103-
this.title = this.injector.get("title");
104-
this.text = this.injector.get("text");
99+
this.modalLabel = this.injector.get("modalLabel");
100+
this.modalTitle = this.injector.get("modalTitle");
101+
this.modalContent = this.injector.get("modalContent");
105102

106103
this.buttons = this.injector.get("buttons") || [];
107104
for (let i = 0; i < this.buttons.length; i++) {

src/modal/modal.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ export class ModalService {
8282
* @returns {ComponentRef<any>}
8383
* @memberof ModalService
8484
*/
85-
show(data: {modalType?: string, headerLabel?: string, title: string, text: string, buttons?: null}) {
85+
show(data: {modalType?: string, modalLabel?: string, modalTitle: string, modalContent: string, buttons?: null}) {
8686
return this.create({
8787
component: AlertModalComponent,
8888
inputs: {
8989
modalType: data.modalType,
90-
headerLabel: data.headerLabel,
91-
title: data.title,
92-
text: data.text,
90+
modalLabel: data.modalLabel,
91+
modalTitle: data.modalTitle,
92+
modalContent: data.modalContent,
9393
buttons: data.buttons || []
9494
}
9595
});

src/modal/modal.stories.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ class ModalStory {
6464
})
6565
class AlertModalStory {
6666
@Input() modalType: string;
67-
@Input() headerLabel: string;
68-
@Input() title: string;
69-
@Input() text: string;
67+
@Input() modalLabel: string;
68+
@Input() modalTitle: string;
69+
@Input() modalContent: string;
7070
@Input() buttons: any;
7171

7272
constructor(private modalService: ModalService) { }
7373

7474
openModal() {
7575
this.modalService.show({
7676
modalType: this.modalType,
77-
headerLabel: this.headerLabel,
78-
title: this.title,
79-
text: this.text,
77+
modalLabel: this.modalLabel,
78+
modalTitle: this.modalTitle,
79+
modalContent: this.modalContent,
8080
buttons: this.buttons
8181
});
8282
}
@@ -129,18 +129,18 @@ storiesOf("Modal", module)
129129
template: `
130130
<app-alert-modal-story
131131
[modalType]="modalType"
132-
[headerLabel]="headerLabel"
133-
[title]="title"
134-
[text]="text"
132+
[modalLabel]="modalLabel"
133+
[modalTitle]="modalTitle"
134+
[modalContent]="modalContent"
135135
[buttons]="buttons">
136136
</app-alert-modal-story>
137137
<ibm-modal-placeholder></ibm-modal-placeholder>
138138
`,
139139
props: {
140140
modalType: select("modalType", ["default", "danger"], "default"),
141-
headerLabel: text("headerLabel", "optional header label"),
142-
title: text("title", "Delete service from application"),
143-
text: text("text", `Are you sure you want to remove the Speech to Text service from the node-test app?`),
141+
modalLabel: text("modalLabel", "optional label"),
142+
modalTitle: text("modalTitle", "Delete service from application"),
143+
modalContent: text("modalContent", `Are you sure you want to remove the Speech to Text service from the node-test app?`),
144144
buttons: [{
145145
text: "Cancel",
146146
type: "secondary"
@@ -171,17 +171,17 @@ storiesOf("Modal", module)
171171
template: `
172172
<app-alert-modal-story
173173
[modalType]="modalType"
174-
[headerLabel]="headerLabel"
175-
[title]="title"
176-
[text]="text">
174+
[modalLabel]="modalLabel"
175+
[modalTitle]="modalTitle"
176+
[modalContent]="modalContent">
177177
</app-alert-modal-story>
178178
<ibm-modal-placeholder></ibm-modal-placeholder>
179179
`,
180180
props: {
181181
modalType: select("modalType", ["default", "danger"], "default"),
182-
headerLabel: text("headerLabel", "optional header label"),
183-
title: text("title", "Passive modal title"),
184-
text: text("text", "Passive modal notifications should only appear if there is an action " +
182+
modalLabel: text("modalLabel", "optional label"),
183+
modalTitle: text("modalTitle", "Passive modal title"),
184+
modalContent: text("modalContent", "Passive modal notifications should only appear if there is an action " +
185185
"the user needs to address immediately. Passive modal notifications are persistent on screen")
186186
}
187187
}))

0 commit comments

Comments
 (0)