Skip to content

Commit 8cb0acf

Browse files
Fixed code styling.
1 parent 5227473 commit 8cb0acf

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/modal/alert-modal.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,16 @@ import { ModalService } from "./modal.service";
3737
* <ibm-modal-placeholder></ibm-modal-placeholder>`
3838
* })
3939
* export class ModalDemo {
40-
*
4140
* openModal() {
4241
* this.modalService.show({
43-
* modalType: "default" | "danger",
42+
* modalType: "default",
4443
* headerLabel: "optional header text",
4544
* title: "Modal title",
4645
* text: "Modal text",
4746
* buttons: [{
4847
* text: "Button text",
49-
* type: "primary" | "secondary" | "tertiary" | "ghost" | "danger" | "danger--primary" = "primary",
50-
* click: clickFunction,
48+
* type: "primary",
49+
* click: clickFunction
5150
* }]
5251
* });
5352
* }
@@ -82,7 +81,6 @@ import { ModalService } from "./modal.service";
8281
`
8382
})
8483
export class AlertModalComponent implements AfterViewInit {
85-
8684
modalType = "default";
8785
headerLabel: string;
8886
title: string;
@@ -138,6 +136,7 @@ export class AlertModalComponent implements AfterViewInit {
138136
}
139137

140138
closeModal() {
139+
// let call the @Modal.destroy() explicitly or otherwise the modal won't close
141140
this["destroy"]();
142141
}
143142
}

src/modal/modal.stories.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,13 @@ storiesOf("Modal", module)
128128
.addDecorator(withKnobs)
129129
.add("Transactional", () => ({
130130
template: `
131-
<app-alert-modal-story [modalType]="modalType" [headerLabel]="headerLabel" [title]="title" [text]="text"
132-
[buttons]="buttons"></app-alert-modal-story>
131+
<app-alert-modal-story
132+
[modalType]="modalType"
133+
[headerLabel]="headerLabel"
134+
[title]="title"
135+
[text]="text"
136+
[buttons]="buttons">
137+
</app-alert-modal-story>
133138
<ibm-modal-placeholder></ibm-modal-placeholder>
134139
`,
135140
props: {
@@ -165,16 +170,20 @@ storiesOf("Modal", module)
165170
.addDecorator(withKnobs)
166171
.add("Passive", () => ({
167172
template: `
168-
<app-alert-modal-story [modalType]="modalType" [headerLabel]="headerLabel" [title]="title" [text]="text"
169-
></app-alert-modal-story>
173+
<app-alert-modal-story
174+
[modalType]="modalType"
175+
[headerLabel]="headerLabel"
176+
[title]="title"
177+
[text]="text">
178+
</app-alert-modal-story>
170179
<ibm-modal-placeholder></ibm-modal-placeholder>
171180
`,
172181
props: {
173182
modalType: select("modalType", ["default", "danger"], "default"),
174183
headerLabel: text("headerLabel", "optional header label"),
175184
title: text("title", "Passive modal title"),
176185
text: text("text", "Passive modal notifications should only appear if there is an action " +
177-
"the user needs to address immediately. Passive modal notifications are persistent on screen")
186+
"the user needs to address immediately. Passive modal notifications are persistent on screen")
178187
}
179188
}))
180189
;

src/modal/overlay.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class OverlayComponent {
3434
* @type {"default" | "danger"}
3535
* @memberof ModalComponent
3636
*/
37-
@Input() modalType = "default";
37+
@Input() modalType: "default" | "danger" = "default";
3838
/**
3939
* To emit the event where the user selects the overlay behind the `Modal`.
4040
* @memberof OverlayComponent

0 commit comments

Comments
 (0)