-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(menu): add playgrounds for menu sides and multiple menus (#3049)
- Loading branch information
1 parent
8e35d5f
commit d57ab7e
Showing
15 changed files
with
593 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
43 changes: 43 additions & 0 deletions
43
static/usage/v7/menu/multiple/angular/example_component_html.md
This file contains 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,43 @@ | ||
```html | ||
<ion-menu menuId="first-menu" contentId="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>First Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the first menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<ion-menu menuId="second-menu" contentId="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Second Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the second menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<ion-menu side="end" contentId="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>End Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the end menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<div class="ion-page" id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding"> | ||
<p>Tap a button below to open a specific menu.</p> | ||
|
||
<ion-button expand="block" (click)="openFirstMenu()">Open First Menu</ion-button> | ||
<ion-button expand="block" (click)="openSecondMenu()">Open Second Menu</ion-button> | ||
<ion-button expand="block" (click)="openEndMenu()">Open End Menu</ion-button> | ||
</ion-content> | ||
</div> | ||
``` |
29 changes: 29 additions & 0 deletions
29
static/usage/v7/menu/multiple/angular/example_component_ts.md
This file contains 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,29 @@ | ||
```ts | ||
import { Component } from '@angular/core'; | ||
import { MenuController } from '@ionic/angular'; | ||
|
||
@Component({ | ||
selector: 'app-example', | ||
templateUrl: 'example.component.html', | ||
}) | ||
export class ExampleComponent { | ||
constructor(private menuCtrl: MenuController) {} | ||
|
||
openFirstMenu() { | ||
// Open the menu by menu-id | ||
this.menuCtrl.enable(true, 'first-menu'); | ||
this.menuCtrl.open('first-menu'); | ||
} | ||
|
||
openSecondMenu() { | ||
// Open the menu by menu-id | ||
this.menuCtrl.enable(true, 'second-menu'); | ||
this.menuCtrl.open('second-menu'); | ||
} | ||
|
||
openEndMenu() { | ||
// Open the menu by side | ||
this.menuCtrl.open('end'); | ||
} | ||
} | ||
``` |
This file contains 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,82 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Menu</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" /> | ||
|
||
<script type="module"> | ||
import { menuController } from 'https://cdn.jsdelivr.net/npm/@ionic/core@7/dist/ionic/index.esm.js'; | ||
window.menuController = menuController; | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-menu menu-id="first-menu" content-id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>First Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the first menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<ion-menu menu-id="second-menu" content-id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Second Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the second menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<ion-menu side="end" content-id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>End Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the end menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<div class="ion-page" id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding"> | ||
<p>Tap a button below to open a specific menu.</p> | ||
|
||
<ion-button expand="block" onclick="openFirstMenu()">Open First Menu</ion-button> | ||
<ion-button expand="block" onclick="openSecondMenu()">Open Second Menu</ion-button> | ||
<ion-button expand="block" onclick="openEndMenu()">Open End Menu</ion-button> | ||
</ion-content> | ||
</div> | ||
</ion-app> | ||
|
||
<script> | ||
async function openFirstMenu() { | ||
// Open the menu by menu-id | ||
await menuController.enable(true, 'first-menu'); | ||
await menuController.open('first-menu'); | ||
} | ||
|
||
async function openSecondMenu() { | ||
// Open the menu by menu-id | ||
await menuController.enable(true, 'second-menu'); | ||
await menuController.open('second-menu'); | ||
} | ||
|
||
async function openEndMenu() { | ||
// Open the menu by side | ||
await menuController.open('end'); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains 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,27 @@ | ||
import Playground from '@site/src/components/global/Playground'; | ||
|
||
import javascript from './javascript.md'; | ||
|
||
import react from './react.md'; | ||
|
||
import vue from './vue.md'; | ||
|
||
import angular_example_component_html from './angular/example_component_html.md'; | ||
import angular_example_component_ts from './angular/example_component_ts.md'; | ||
|
||
<Playground | ||
version="7" | ||
code={{ | ||
javascript, | ||
react, | ||
vue, | ||
angular: { | ||
files: { | ||
'src/app/example.component.html': angular_example_component_html, | ||
'src/app/example.component.ts': angular_example_component_ts, | ||
}, | ||
}, | ||
}} | ||
src="usage/v7/menu/multiple/demo.html" | ||
devicePreview | ||
/> |
This file contains 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,62 @@ | ||
```html | ||
<ion-menu menu-id="first-menu" content-id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>First Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the first menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<ion-menu menu-id="second-menu" content-id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Second Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the second menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<ion-menu side="end" content-id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>End Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding">This is the end menu content.</ion-content> | ||
</ion-menu> | ||
|
||
<div class="ion-page" id="main-content"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Menu</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding"> | ||
<p>Tap a button below to open a specific menu.</p> | ||
|
||
<ion-button expand="block" onclick="openFirstMenu()">Open First Menu</ion-button> | ||
<ion-button expand="block" onclick="openSecondMenu()">Open Second Menu</ion-button> | ||
<ion-button expand="block" onclick="openEndMenu()">Open End Menu</ion-button> | ||
</ion-content> | ||
</div> | ||
|
||
<script> | ||
async function openFirstMenu() { | ||
// Open the menu by menu-id | ||
await menuController.enable(true, 'first-menu'); | ||
await menuController.open('first-menu'); | ||
} | ||
async function openSecondMenu() { | ||
// Open the menu by menu-id | ||
await menuController.enable(true, 'second-menu'); | ||
await menuController.open('second-menu'); | ||
} | ||
async function openEndMenu() { | ||
// Open the menu by side | ||
await menuController.open('end'); | ||
} | ||
</script> | ||
``` |
Oops, something went wrong.
d57ab7e
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.
Successfully deployed to the following URLs:
ionic-docs – ./
ionic-docs-ionic1.vercel.app
ionic-docs-git-main-ionic1.vercel.app
ionic-docs-gqykycf8t.vercel.app