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(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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
e0a64755b13f71c41c63446ac47fa884689c856a9b48bbb8eFile 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,6 @@ | ||
| ```css | ||
| ion-fab { | ||
| margin-top: var(--ion-safe-area-top, 0); | ||
| margin-bottom: var(--ion-safe-area-bottom, 0); | ||
| } | ||
| ``` |
| 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> | ||
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. The icons in the angular and javascript examples don't load in stackblitz because of #2892 | ||
| </ion-fab-button> | ||
| </ion-fab> | ||
| ``` | ||
| 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; | ||
| } | ||
| ``` |
| 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> |
| 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} | ||
| /> |
| 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> | ||
| ``` |
| 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); | ||
| } | ||
| ``` |
| 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; | ||
| ``` |
| 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> | ||
| ``` |
Uh oh!
There was an error while loading. Please reload this page.