-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react/vue): properly switch ionicon based on the mode when ios/md…
- Loading branch information
1 parent
af79673
commit 1eb9a08
Showing
16 changed files
with
383 additions
and
14 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
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,47 @@ | ||
# React Test App | ||
|
||
## Getting Started | ||
|
||
### Setup | ||
|
||
Make sure you are using the latest versions of node and npm. If you do not have these, [download the installer](https://nodejs.org/) for the LTS version of Node.js. This is the best way to also [install npm](https://blog.npmjs.org/post/85484771375/how-to-install-npm#_=_). | ||
|
||
### Building Dependencies | ||
|
||
Navigate to the `core`, `packages/react` and `packages/react-router` directories and build each of them: | ||
|
||
```bash | ||
npm i | ||
npm run build | ||
``` | ||
|
||
Then, install dependencies from this directory for this test app: | ||
|
||
``` | ||
npm i | ||
``` | ||
|
||
### Syncing Changes | ||
|
||
When making changes to the React package, run the following from this directory to sync the changes: | ||
|
||
```bash | ||
npm run sync | ||
``` | ||
|
||
### Previewing App | ||
|
||
To preview this app locally, run the following from this directory: | ||
|
||
```bash | ||
npm start | ||
``` | ||
|
||
### Running Tests | ||
|
||
To run the e2e tests, run the following from this directory: | ||
|
||
``` | ||
npm run build | ||
npm run e2e | ||
``` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React, { useState } from 'react'; | ||
import { IonBackButton, IonButton, IonButtons, IonContent, IonHeader, IonIcon, IonItem, IonLabel, IonList, IonTitle, IonToolbar } from '@ionic/react'; | ||
import { heart, heartCircleOutline, logoApple, logoTwitter, personCircleOutline, star, starOutline, trash } from 'ionicons/icons'; | ||
|
||
interface IconsProps {} | ||
|
||
const Icons: React.FC<IconsProps> = () => { | ||
const [dynamic, setDynamic] = useState(star); | ||
const iosCustomSvg = "../assets/logo-apple.svg"; | ||
const mdCustomSvg = "../assets/logo-android.svg"; | ||
|
||
const toggle = () => { | ||
setDynamic(dynamic => dynamic === star ? starOutline : star); | ||
} | ||
|
||
return ( | ||
<> | ||
<IonHeader translucent={true}> | ||
<IonToolbar> | ||
<IonButtons> | ||
<IonBackButton></IonBackButton> | ||
</IonButtons> | ||
<IonTitle>Icons</IonTitle> | ||
</IonToolbar> | ||
</IonHeader> | ||
|
||
<IonContent fullscreen={true}> | ||
<IonHeader collapse="condense"> | ||
<IonToolbar> | ||
<IonTitle size="large">Icons</IonTitle> | ||
</IonToolbar> | ||
</IonHeader> | ||
|
||
<IonList> | ||
<IonItem> | ||
<IonIcon slot="start" icon={heart}></IonIcon> | ||
<IonLabel>Static Icons</IonLabel> | ||
<IonIcon slot="end" icon={personCircleOutline} color="dark"></IonIcon> | ||
<IonIcon slot="end" icon={trash} color="danger"></IonIcon> | ||
</IonItem> | ||
<IonItem> | ||
<IonIcon icon={logoApple} slot="start"></IonIcon> | ||
<IonLabel>Logo Icons</IonLabel> | ||
<IonIcon icon={logoTwitter} slot="end"></IonIcon> | ||
</IonItem> | ||
<IonItem> | ||
<IonIcon slot="start" icon={dynamic} color="warning"></IonIcon> | ||
<IonLabel>Dynamic Icon</IonLabel> | ||
<IonButton slot="end" fill="outline" onClick={() => toggle()}> | ||
Toggle Icon | ||
</IonButton> | ||
</IonItem> | ||
<IonItem> | ||
<IonIcon slot="start" ios={heartCircleOutline} md={personCircleOutline}></IonIcon> | ||
<IonLabel> | ||
<p>ios: heart circle</p> | ||
<p>md: person circle</p> | ||
</IonLabel> | ||
</IonItem> | ||
<IonItem> | ||
<IonIcon slot="start" ios={starOutline} md={star}></IonIcon> | ||
<IonLabel> | ||
<p>ios: star outline</p> | ||
<p>md: star</p> | ||
</IonLabel> | ||
</IonItem> | ||
<IonItem> | ||
<IonIcon slot="start" mode="ios" ios={starOutline} md={star}></IonIcon> | ||
<IonLabel> | ||
<h3>mode: ios</h3> | ||
<p>ios: star outline</p> | ||
<p>md: star</p> | ||
</IonLabel> | ||
</IonItem> | ||
<IonItem> | ||
<IonIcon slot="start" mode="md" ios={starOutline} md={star}></IonIcon> | ||
<IonLabel> | ||
<h3>mode: md</h3> | ||
<p>ios: star outline</p> | ||
<p>md: star</p> | ||
</IonLabel> | ||
</IonItem> | ||
<IonItem> | ||
<IonIcon id="customSvg" slot="start" ios={iosCustomSvg} md={mdCustomSvg}></IonIcon> | ||
<IonLabel> | ||
<p>Custom SVG</p> | ||
</IonLabel> | ||
</IonItem> | ||
</IonList> | ||
</IonContent> | ||
</> | ||
); | ||
}; | ||
|
||
export default Icons; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
describe('Icons', () => { | ||
it('should use ios svg', () => { | ||
cy.visit('/icons?ionic:mode=ios'); | ||
|
||
cy.get('#customSvg').shadow().find('svg').should('have.class', 'ios'); | ||
cy.get('#customSvg').shadow().find('svg').should('have.class', 'apple'); | ||
}); | ||
|
||
it('should use md svg', () => { | ||
cy.visit('/icons?ionic:mode=md'); | ||
|
||
cy.get('#customSvg').shadow().find('svg').should('have.class', 'md'); | ||
cy.get('#customSvg').shadow().find('svg').should('have.class', 'android'); | ||
}); | ||
|
||
it('should use fallback md svg', () => { | ||
cy.visit('/icons'); | ||
|
||
cy.get('#customSvg').shadow().find('svg').should('have.class', 'md'); | ||
cy.get('#customSvg').shadow().find('svg').should('have.class', 'android'); | ||
}); | ||
}) |
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.