-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
docs(content): add playground for safe area usage #3102
Changes from 5 commits
97d42cf
4a3f098
dfeb5d1
7c6356a
0d37140
9bdfc83
3e6030d
3bf41d2
1efb16c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,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); | ||
} | ||
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 we should keep this CSS in the example component's CSS file. Developers often have an app where one page has a content with no header but the rest do, so I don't think we want this globally applied. 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. Then i suppose we should also have two 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'll separate them on Vue. It keeps it consistent IMO. |
||
``` |
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 { | ||||||
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,34 @@ | ||
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_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/global.css': angular_global_css, | ||
}, | ||
}, | ||
}} | ||
src="usage/v7/content/theming/safe-area/demo.html" | ||
devicePreview | ||
Comment on lines
+33
to
+34
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 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. 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,38 @@ | ||
```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; | ||
} | ||
|
||
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.