-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(config): add code snippets of how to access the mode per framework #4147
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
base: main
Are you sure you want to change the base?
Conversation
@joesphchang is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you for this! I spoke with the team, and we think it would be clearer if getting the mode were its own section, separate from the get method. This helps make it more obvious that the get method isn't available in all frameworks. For example, Angular would remain the same: ![]() And a new section would be added, either before or after the Angular one: ![]() Additionally, we should make sure that all framework examples are consistent. This would be a good use case for adding a playground if we want to apply styles based on the mode. You can see an example of a playground in a guide page here: https://ionicframework.com/docs/utilities/gestures#basic-gestures And the source code for that example is here: https://github.com/ionic-team/ionic-docs/tree/main/static/usage/v8/gestures/basic Lastly, we need to make sure this documentation is also added to the v7 directories:
Let me know if you have any questions! |
docs/angular/your-first-app.md
Outdated
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.
Could you please remove the unrelated changes to your-first-app
from this PR? 🙂
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.
I believe I removed it and pushed back up the changes!
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…onic-team#4153) Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
…team#4152) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
5b39351
to
7b3b3b9
Compare
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.
There's also some files that are not relevant to this PR. Please revert those.
@@ -51,6 +51,14 @@ import PerPlatformOverridesExample from '@site/docs/developing/config/per-platfo | |||
|
|||
<PerPlatformOverridesExample /> | |||
|
|||
## Accessing the Current Mode Programmatically |
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.
## Accessing the Current Mode Programmatically | |
## Accessing the Mode |
Let's aim for short titles.
<ion-app> | ||
<ion-content> | ||
<div class="container"> | ||
<ion-button (click)="showMode()">Show Current Mode</ion-button> |
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.
<ion-button (click)="showMode()">Show Current Mode</ion-button> | |
<ion-button (click)="showMode()">Show Mode</ion-button> |
<ion-content> | ||
<div class="container"> | ||
<ion-button (click)="showMode()">Show Current Mode</ion-button> | ||
<div class="mode-value">{{ modeValue }}</div> |
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.
Update this to be consistent with the text from the demo. This one is missing Current mode:
. All the frameworks need to match the demo for consistency.
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.
The Stackblitz environment does not work. This can be seen by selecting "Angular" under the tabs and then the StackBlitz logo. The environment needs to be fixed.
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Ionic Config Mode Example</title> |
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.
<title>Ionic Config Mode Example</title> | |
<title>Ionic Config Mode</title> |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@8/css/ionic.bundle.css" /> | ||
<style> | ||
.container { | ||
/* display: block; */ |
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.
Remove any unused code.
/* display: block; */ |
@@ -0,0 +1,15 @@ | |||
```html | |||
<button id="showModeBtn">Show Current Mode</button> |
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.
This should be using an ion-button
since that's what the demo is using.
return ( | ||
<> | ||
<IonButton onClick={showMode}>Show Current Mode</IonButton> | ||
<div className="mode-value">{modeValue && `Current mode: ${modeValue}`}</div> |
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.
This should have the same styling as the demo. Same reason, for consistency.
```html | ||
<template> | ||
<ion-button @click="showMode">Show Current Mode</ion-button> | ||
<div class="mode-value" v-if="modeValue">Current mode: {{ modeValue }}</div> |
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.
This should have the same styling as the demo. Same reason, for consistency.
<ion-app> | ||
<ion-content> | ||
<div class="container"> | ||
<ion-button id="showModeBtn">Show Current Mode</ion-button> |
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.
Let's change the button to be more visual based. For example, let's set the color and fill based on the mode and the button text should be the mode.
<IonButton color={mode === 'ios' ? 'secondary' : 'tertiary'} fill={mode === 'ios' ? 'outline' : 'solid'}>
{mode}
</IonButton>
The example is in React, just update the code to be appropriate per framework.
Added ionic-mode to the appropriate section in Config
Initial issue: Issue #2580
Preview