docs(config): add code snippets of how to access the mode per framework#4147
docs(config): add code snippets of how to access the mode per framework#4147joesphchang wants to merge 20 commits intoionic-team:mainfrom
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! |
There was a problem hiding this comment.
Could you please remove the unrelated changes to your-first-app from this PR? 🙂
There was a problem hiding this comment.
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
thetaPC
left a comment
There was a problem hiding this comment.
There's also some files that are not relevant to this PR. Please revert those.
|
|
||
| <PerPlatformOverridesExample /> | ||
|
|
||
| ## Accessing the Current Mode Programmatically |
There was a problem hiding this comment.
| ## 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.
| <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.
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.
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.
| <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.
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.
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.
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.
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.
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.
|
Closing in favor of #4172 |


Added ionic-mode to the appropriate section in Config
Initial issue: Issue #2580
Preview