Skip to content

Commit 617dc96

Browse files
author
amandaesmith3
committed
modal/inline/basic
1 parent d8dcaf6 commit 617dc96

File tree

7 files changed

+12
-32
lines changed

7 files changed

+12
-32
lines changed

static/usage/v7/modal/inline/basic/angular/example_component_html.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
</ion-header>
77
<ion-content class="ion-padding">
88
<ion-button id="open-modal" expand="block">Open</ion-button>
9-
<p>{{ message }}</p>
109
<ion-modal trigger="open-modal" (willDismiss)="onWillDismiss($event)">
1110
<ng-template>
1211
<ion-header>
@@ -22,8 +21,7 @@
2221
</ion-header>
2322
<ion-content class="ion-padding">
2423
<ion-item>
25-
<ion-label position="stacked">Enter your name</ion-label>
26-
<ion-input type="text" placeholder="Your name" [(ngModel)]="name"></ion-input>
24+
<ion-input label="Enter your name" labelPlacement="stacked" type="text" placeholder="Your name" [(ngModel)]="name"></ion-input>
2725
</ion-item>
2826
</ion-content>
2927
</ng-template>

static/usage/v7/modal/inline/basic/angular/example_component_ts.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { OverlayEventDetail } from '@ionic/core/components';
1010
export class ExampleComponent {
1111
@ViewChild(IonModal) modal: IonModal;
1212

13-
message = 'This modal example uses triggers to automatically open a modal when the button is clicked.';
1413
name: string;
1514

1615
cancel() {
@@ -24,7 +23,7 @@ export class ExampleComponent {
2423
onWillDismiss(event: Event) {
2524
const ev = event as CustomEvent<OverlayEventDetail<string>>;
2625
if (ev.detail.role === 'confirm') {
27-
this.message = `Hello, ${ev.detail.data}!`;
26+
console.log(`Hello, ${ev.detail.data}!`);
2827
}
2928
}
3029
}

static/usage/v7/modal/inline/basic/demo.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
</ion-header>
2020
<ion-content class="ion-padding">
2121
<ion-button id="open-modal" expand="block">Open</ion-button>
22-
<p id="message">This modal example uses triggers to automatically open a modal when the button is clicked.</p>
2322
<ion-modal trigger="open-modal">
2423
<ion-header>
2524
<ion-toolbar>
@@ -34,8 +33,7 @@
3433
</ion-header>
3534
<ion-content class="ion-padding">
3635
<ion-item>
37-
<ion-label position="stacked">Enter your name</ion-label>
38-
<ion-input type="text" placeholder="Your name"></ion-input>
36+
<ion-input label="Enter your name" label-placement="stacked" type="text" placeholder="Your name"></ion-input>
3937
</ion-item>
4038
</ion-content>
4139
</ion-modal>
@@ -56,8 +54,7 @@
5654

5755
modal.addEventListener('willDismiss', (ev) => {
5856
if (ev.detail.role === 'confirm') {
59-
const message = document.querySelector('#message');
60-
message.textContent = `Hello ${ev.detail.data}!`;
57+
console.log(`Hello ${ev.detail.data}!`);
6158
}
6259
});
6360
</script>

static/usage/v7/modal/inline/basic/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ import angular_example_component_ts from './angular/example_component_ts.md';
2323
src="usage/v7/modal/inline/basic/demo.html"
2424
devicePreview
2525
includeIonContent={false}
26+
showConsole={true}
2627
/>

static/usage/v7/modal/inline/basic/javascript.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
</ion-header>
77
<ion-content class="ion-padding">
88
<ion-button id="open-modal" expand="block">Open</ion-button>
9-
<p id="message">This modal example uses triggers to automatically open a modal when the button is clicked.</p>
109
<ion-modal trigger="open-modal">
1110
<ion-header>
1211
<ion-toolbar>
@@ -21,8 +20,7 @@
2120
</ion-header>
2221
<ion-content class="ion-padding">
2322
<ion-item>
24-
<ion-label position="stacked">Enter your name</ion-label>
25-
<ion-input type="text" placeholder="Your name"></ion-input>
23+
<ion-input label="Enter your name" label-placement="stacked" type="text" placeholder="Your name"></ion-input>
2624
</ion-item>
2725
</ion-content>
2826
</ion-modal>
@@ -42,8 +40,7 @@
4240
4341
modal.addEventListener('willDismiss', (ev) => {
4442
if (ev.detail.role === 'confirm') {
45-
const message = document.querySelector('#message');
46-
message.textContent = `Hello ${ev.detail.data}!`;
43+
console.log(`Hello ${ev.detail.data}!`);
4744
}
4845
});
4946
</script>

static/usage/v7/modal/inline/basic/react.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```tsx
2-
import React, { useState, useRef } from 'react';
2+
import React, { useRef } from 'react';
33
import {
44
IonButtons,
55
IonButton,
@@ -10,7 +10,6 @@ import {
1010
IonTitle,
1111
IonPage,
1212
IonItem,
13-
IonLabel,
1413
IonInput,
1514
} from '@ionic/react';
1615
import { OverlayEventDetail } from '@ionic/core/components';
@@ -19,17 +18,13 @@ function Example() {
1918
const modal = useRef<HTMLIonModalElement>(null);
2019
const input = useRef<HTMLIonInputElement>(null);
2120

22-
const [message, setMessage] = useState(
23-
'This modal example uses triggers to automatically open a modal when the button is clicked.'
24-
);
25-
2621
function confirm() {
2722
modal.current?.dismiss(input.current?.value, 'confirm');
2823
}
2924

3025
function onWillDismiss(ev: CustomEvent<OverlayEventDetail>) {
3126
if (ev.detail.role === 'confirm') {
32-
setMessage(`Hello, ${ev.detail.data}!`);
27+
console.log(`Hello, ${ev.detail.data}!`);
3328
}
3429
}
3530

@@ -44,7 +39,6 @@ function Example() {
4439
<IonButton id="open-modal" expand="block">
4540
Open
4641
</IonButton>
47-
<p>{message}</p>
4842
<IonModal ref={modal} trigger="open-modal" onWillDismiss={(ev) => onWillDismiss(ev)}>
4943
<IonHeader>
5044
<IonToolbar>
@@ -61,8 +55,7 @@ function Example() {
6155
</IonHeader>
6256
<IonContent className="ion-padding">
6357
<IonItem>
64-
<IonLabel position="stacked">Enter your name</IonLabel>
65-
<IonInput ref={input} type="text" placeholder="Your name" />
58+
<IonInput label="Enter your name" labelPlacement="stacked" ref={input} type="text" placeholder="Your name" />
6659
</IonItem>
6760
</IonContent>
6861
</IonModal>

static/usage/v7/modal/inline/basic/vue.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
</ion-header>
88
<ion-content class="ion-padding">
99
<ion-button id="open-modal" expand="block">Open</ion-button>
10-
<p>{{ message }}</p>
1110
<ion-modal ref="modal" trigger="open-modal" @willDismiss="onWillDismiss">
1211
<ion-header>
1312
<ion-toolbar>
@@ -22,8 +21,7 @@
2221
</ion-header>
2322
<ion-content class="ion-padding">
2423
<ion-item>
25-
<ion-label position="stacked">Enter your name</ion-label>
26-
<ion-input ref="input" type="text" placeholder="Your name"></ion-input>
24+
<ion-input label="Enter your name" label-placement="stacked" ref="input" type="text" placeholder="Your name"></ion-input>
2725
</ion-item>
2826
</ion-content>
2927
</ion-modal>
@@ -41,13 +39,10 @@
4139
IonTitle,
4240
IonItem,
4341
IonInput,
44-
IonLabel,
4542
} from '@ionic/vue';
4643
import { OverlayEventDetail } from '@ionic/core/components';
4744
import { ref } from 'vue';
4845
49-
const message = ref('This modal example uses triggers to automatically open a modal when the button is clicked.');
50-
5146
const modal = ref();
5247
const input = ref();
5348
@@ -60,7 +55,7 @@
6055
6156
const onWillDismiss = (ev: CustomEvent<OverlayEventDetail>) => {
6257
if (ev.detail.role === 'confirm') {
63-
message.value = `Hello, ${ev.detail.data}!`;
58+
console.log(`Hello, ${ev.detail.data}!`);
6459
}
6560
};
6661
</script>

0 commit comments

Comments
 (0)