-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(fab): add playground for safe area workaround #3105
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
7 commits
Select commit
Hold shift + click to select a range
e0a6475
docs(fab): add playground for safe area workaround
mapsandapps 5b13f71
Try to fix links
mapsandapps c41c634
Add safe area sizes for stackblitzes
mapsandapps 46ac47f
Use both component & global css files
mapsandapps a884689
Use both scoped and global style tags
mapsandapps c856a9b
Add bottom
mapsandapps 48bbb8e
Address PR feedback
mapsandapps 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
6 changes: 6 additions & 0 deletions
6
static/usage/v7/fab/safe-area/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,6 @@ | ||
```css | ||
ion-fab { | ||
margin-top: var(--ion-safe-area-top, 0); | ||
margin-bottom: var(--ion-safe-area-bottom, 0); | ||
} | ||
``` |
7 changes: 7 additions & 0 deletions
7
static/usage/v7/fab/safe-area/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,7 @@ | ||
```html | ||
<ion-fab slot="fixed" vertical="top" horizontal="center"> | ||
<ion-fab-button> | ||
<ion-icon name="add"></ion-icon> | ||
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. The icons in the angular and javascript examples don't load in stackblitz because of #2892 |
||
</ion-fab-button> | ||
</ion-fab> | ||
``` |
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,10 @@ | ||
```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; | ||
} | ||
``` |
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,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Fab</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-fab { | ||
margin-top: var(--ion-safe-area-top, 0); | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-fab slot="fixed" vertical="top" horizontal="center"> | ||
<ion-fab-button> | ||
<ion-icon name="add"></ion-icon> | ||
</ion-fab-button> | ||
</ion-fab> | ||
</ion-app> | ||
</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 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/fab/safe-area/demo.html" | ||
devicePreview={true} | ||
/> |
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 @@ | ||
```html | ||
<ion-fab slot="fixed" vertical="top" horizontal="center"> | ||
<ion-fab-button> | ||
<ion-icon name="add"></ion-icon> | ||
</ion-fab-button> | ||
</ion-fab> | ||
|
||
<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-fab { | ||
margin-top: var(--ion-safe-area-top, 0); | ||
margin-bottom: var(--ion-safe-area-bottom, 0); | ||
} | ||
</style> | ||
``` |
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,15 @@ | ||
```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-fab { | ||
margin-top: var(--ion-safe-area-top, 0); | ||
margin-bottom: var(--ion-safe-area-bottom, 0); | ||
} | ||
``` |
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,18 @@ | ||
```tsx | ||
import React from 'react'; | ||
import { IonFab, IonFabButton, IonIcon } from '@ionic/react'; | ||
import { add } from 'ionicons/icons'; | ||
|
||
import './main.css'; | ||
|
||
function Example() { | ||
return ( | ||
<IonFab slot="fixed" vertical="top" horizontal="center"> | ||
<IonFabButton> | ||
<IonIcon icon={add}></IonIcon> | ||
</IonFabButton> | ||
</IonFab> | ||
); | ||
} | ||
export default Example; | ||
``` |
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,44 @@ | ||
```html | ||
<template> | ||
<ion-fab slot="fixed" vertical="top" horizontal="center"> | ||
<ion-fab-button> | ||
<ion-icon :icon="add"></ion-icon> | ||
</ion-fab-button> | ||
</ion-fab> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { IonFab, IonFabButton, IonIcon } from '@ionic/vue'; | ||
import { defineComponent } from 'vue'; | ||
import { add } from 'ionicons/icons'; | ||
|
||
export default defineComponent({ | ||
components: { | ||
IonFab, | ||
IonFabButton, | ||
IonIcon, | ||
}, | ||
setup() { | ||
return { add }; | ||
}, | ||
}); | ||
</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; | ||
} | ||
</style> | ||
|
||
<style scoped> | ||
ion-fab { | ||
margin-top: var(--ion-safe-area-top, 0); | ||
margin-bottom: var(--ion-safe-area-bottom, 0); | ||
} | ||
</style> | ||
``` |
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.