Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(content): add playground for safe area usage#3102
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
97d42cf4a3f098dfeb5d17c6356a0d371409bdfc833e6030d3bf41d21efb16cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ```css | ||
| ion-content::part(scroll) { | ||
| padding-top: var(--ion-safe-area-top, 0); | ||
| padding-bottom: var(--ion-safe-area-bottom, 0); | ||
| padding-left: var(--ion-safe-area-left, 0); | ||
| padding-right: var(--ion-safe-area-right, 0); | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ```html | ||
| <ion-content> | ||
| <span>Here's a small text description for the content. Nothing more, nothing less.</span> | ||
| </ion-content> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ```css | ||
| :root { | ||
| /** | ||
| * Setting the variables for DEMO purposes only. | ||
| * Values will be set automatically when building an iOS or Android app. | ||
| */ | ||
| --ion-safe-area-top: 20px; | ||
| --ion-safe-area-bottom: 20px; | ||
| --ion-safe-area-left: 20px; | ||
| --ion-safe-area-right: 20px; | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||
| <!DOCTYPE html> | ||||||
| <html lang="en"> | ||||||
| <head> | ||||||
| <meta charset="UTF-8" /> | ||||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||||
| <title>Content</title> | ||||||
| <link rel="stylesheet" href="../../../../common.css" /> | ||||||
| <script src="../../../../common.js"></script> | ||||||
| <script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@7/dist/ionic/ionic.esm.js"></script> | ||||||
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@7/css/ionic.bundle.css" /> | ||||||
| <style> | ||||||
| ion-content { | ||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
for consistency | ||||||
| --ion-safe-area-top: 40px; | ||||||
| --ion-safe-area-bottom: 40px; | ||||||
| --ion-safe-area-left: 20px; | ||||||
| --ion-safe-area-right: 20px; | ||||||
| } | ||||||
| ion-content::part(scroll) { | ||||||
| padding-top: var(--ion-safe-area-top, 0); | ||||||
| padding-bottom: var(--ion-safe-area-bottom, 0); | ||||||
| padding-left: var(--ion-safe-area-left, 0); | ||||||
| padding-right: var(--ion-safe-area-right, 0); | ||||||
| } | ||||||
| </style> | ||||||
| </head> | ||||||
| <body> | ||||||
| <ion-app> | ||||||
| <ion-content> | ||||||
| <span>Here's a small text description for the content. Nothing more, nothing less.</span> | ||||||
| </ion-content> | ||||||
| </ion-app> | ||||||
| </body> | ||||||
| </html> | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import Playground from '@site/src/components/global/Playground'; | ||
| import javascript from './javascript.md'; | ||
| import react_main_tsx from './react/main_tsx.md'; | ||
| import react_main_css from './react/main_css.md'; | ||
| import vue from './vue.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_global_css from './angular/global_css.md'; | ||
| <Playground | ||
| version="7" | ||
| code={{ | ||
| javascript, | ||
| react: { | ||
| files: { | ||
| 'src/main.tsx': react_main_tsx, | ||
| 'src/main.css': react_main_css, | ||
| }, | ||
| }, | ||
| vue, | ||
| angular: { | ||
| files: { | ||
| 'src/app/example.component.html': angular_example_component_html, | ||
| 'src/app/example.component.css': angular_example_component_css, | ||
| 'src/global.css': angular_global_css, | ||
| }, | ||
| }, | ||
| }} | ||
| src="usage/v7/content/theming/safe-area/demo.html" | ||
| devicePreview | ||
Comment on lines
+33
to
+34
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where should I be looking for the two ion-contents? I'm not seeing them. ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nvm, I found it! I've learned something new about the Playground. Thank you! | ||
| includeIonContent={false} | ||
| /> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ```html | ||
| <ion-content> | ||
| <span>Here's a small text description for the content. Nothing more, nothing less.</span> | ||
| </ion-content> | ||
| <style> | ||
| :root { | ||
| /** | ||
| * Setting the variables for DEMO purposes only. | ||
| * Values will be set automatically when building an iOS or Android app. | ||
| */ | ||
| --ion-safe-area-top: 20px; | ||
| --ion-safe-area-bottom: 20px; | ||
| --ion-safe-area-left: 20px; | ||
| --ion-safe-area-right: 20px; | ||
| } | ||
| ion-content::part(scroll) { | ||
| padding-top: var(--ion-safe-area-top, 0); | ||
| padding-bottom: var(--ion-safe-area-bottom, 0); | ||
| padding-left: var(--ion-safe-area-left, 0); | ||
| padding-right: var(--ion-safe-area-right, 0); | ||
| } | ||
| </style> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| ```css | ||
| :root { | ||
| /** | ||
| * Setting the variables for DEMO purposes only. | ||
| * Values will be set automatically when building an iOS or Android app. | ||
| */ | ||
| --ion-safe-area-top: 20px; | ||
| --ion-safe-area-bottom: 20px; | ||
| --ion-safe-area-left: 20px; | ||
| --ion-safe-area-right: 20px; | ||
| } | ||
| ion-content::part(scroll) { | ||
| padding-top: var(--ion-safe-area-top, 0); | ||
| padding-bottom: var(--ion-safe-area-bottom, 0); | ||
| padding-left: var(--ion-safe-area-left, 0); | ||
| padding-right: var(--ion-safe-area-right, 0); | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ```tsx | ||
| import React from 'react'; | ||
| import { IonContent } from '@ionic/react'; | ||
| import './main.css'; | ||
| function Example() { | ||
| return ( | ||
| <IonContent> | ||
| <span>Here's a small text description for the content. Nothing more, nothing less.</span> | ||
| </IonContent> | ||
| ); | ||
| } | ||
| export default Example; | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| ```html | ||
| <template> | ||
| <ion-content> | ||
| <span>Here's a small text description for the content. Nothing more, nothing less.</span> | ||
| </ion-content> | ||
| </template> | ||
| <script lang="ts"> | ||
| import { IonContent } from '@ionic/vue'; | ||
| import { defineComponent } from 'vue'; | ||
| export default defineComponent({ | ||
| components: { | ||
| IonContent, | ||
| }, | ||
| }); | ||
| </script> | ||
| <style> | ||
| :root { | ||
| /** | ||
| * Setting the variables for DEMO purposes only. | ||
| * Values will be set automatically when building an iOS or Android app. | ||
| */ | ||
| --ion-safe-area-top: 20px; | ||
| --ion-safe-area-bottom: 20px; | ||
| --ion-safe-area-left: 20px; | ||
| --ion-safe-area-right: 20px; | ||
| } | ||
| </style> | ||
| <style scoped> | ||
| ion-content::part(scroll) { | ||
| padding-top: var(--ion-safe-area-top, 0); | ||
| padding-bottom: var(--ion-safe-area-bottom, 0); | ||
| padding-left: var(--ion-safe-area-left, 0); | ||
| padding-right: var(--ion-safe-area-right, 0); | ||
| } | ||
| </style> | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this above the Playground? Anything under might be ignored since people stop at the demo and play with it.