-
Notifications
You must be signed in to change notification settings - Fork 13.3k
feat(icon): add font icon support to ion-icon #31302
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: major-9.0
Are you sure you want to change the base?
Changes from all commits
490097f
8525d59
68a7d63
b3387c9
5e791e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { configs, test } from '@utils/test/playwright'; | ||
|
|
||
| configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | ||
| test.describe(title('icon: font'), () => { | ||
| test('should render font icon when passed', async ({ page }) => { | ||
| await page.setContent( | ||
| ` | ||
| <link | ||
| rel="stylesheet" | ||
| type="text/css" | ||
| href="https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.1/src/fill/style.css" | ||
| /> | ||
|
|
||
| <style> | ||
| ion-icon { | ||
| font-size: 32px; | ||
| } | ||
| </style> | ||
|
|
||
| <ion-icon> | ||
| <i class="ph-fill ph-house"></i> | ||
| </ion-icon> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| await page.evaluate(() => document.fonts.ready); | ||
|
|
||
| const icon = page.locator('ion-icon'); | ||
| await expect(icon).toHaveScreenshot(screenshot(`icon-font`)); | ||
| }); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,286 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" dir="ltr"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>Icon - Font</title> | ||
| <meta | ||
| name="viewport" | ||
| content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" | ||
| /> | ||
| <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" /> | ||
| <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" /> | ||
| <link | ||
| rel="stylesheet" | ||
| type="text/css" | ||
| href="https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.1/src/regular/style.css" | ||
| /> | ||
| <link | ||
| rel="stylesheet" | ||
| type="text/css" | ||
| href="https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.1/src/fill/style.css" | ||
| /> | ||
| <script src="../../../../../scripts/testing/scripts.js"></script> | ||
| <script nomodule src="../../../../../dist/ionic/ionic.js"></script> | ||
| <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Icon - Font</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
|
|
||
| <ion-content class="ion-padding-horizontal"> | ||
| <h2>Phosphor icons: regular</h2> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-house"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-heart"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-star"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-user"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-gear"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-airplane"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-trash"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-globe"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph ph-lock"></i> | ||
| </ion-icon> | ||
|
|
||
| <h2>Phosphor icons: fill</h2> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-house"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-heart"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-star"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-user"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-gear"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-airplane"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-globe"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true"> | ||
| <i class="ph-fill ph-lock"></i> | ||
| </ion-icon> | ||
|
|
||
| <h2>Phosphor icons: color</h2> | ||
| <ion-icon aria-hidden="true" color="primary"> | ||
| <i class="ph ph-house"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="secondary"> | ||
| <i class="ph ph-heart"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="tertiary"> | ||
| <i class="ph ph-star"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="success"> | ||
| <i class="ph ph-user"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="warning"> | ||
| <i class="ph ph-gear"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="danger"> | ||
| <i class="ph ph-airplane"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="light"> | ||
| <i class="ph ph-trash"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="medium"> | ||
| <i class="ph ph-globe"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="dark"> | ||
| <i class="ph ph-lock"></i> | ||
| </ion-icon> | ||
| <br /> | ||
| <ion-icon aria-hidden="true" color="primary"> | ||
| <i class="ph-fill ph-house"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="secondary"> | ||
| <i class="ph-fill ph-heart"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="tertiary"> | ||
| <i class="ph-fill ph-star"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="success"> | ||
| <i class="ph-fill ph-user"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="warning"> | ||
| <i class="ph-fill ph-gear"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="danger"> | ||
| <i class="ph-fill ph-airplane"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="light"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="medium"> | ||
| <i class="ph-fill ph-globe"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" color="dark"> | ||
| <i class="ph-fill ph-lock"></i> | ||
| </ion-icon> | ||
|
|
||
| <h2>Phosphor icons: custom sizing</h2> | ||
| <ion-icon aria-hidden="true" style="font-size: 16px"> | ||
| <i class="ph ph-house"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 20px"> | ||
| <i class="ph ph-heart"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 24px"> | ||
| <i class="ph ph-star"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 28px"> | ||
| <i class="ph ph-user"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 32px"> | ||
| <i class="ph ph-gear"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 36px"> | ||
| <i class="ph ph-airplane"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 40px"> | ||
| <i class="ph ph-trash"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 44px"> | ||
| <i class="ph ph-globe"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 48px"> | ||
| <i class="ph ph-lock"></i> | ||
| </ion-icon> | ||
| <br /> | ||
| <ion-icon aria-hidden="true" style="font-size: 16px"> | ||
| <i class="ph-fill ph-house"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 20px"> | ||
| <i class="ph-fill ph-heart"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 24px"> | ||
| <i class="ph-fill ph-star"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 28px"> | ||
| <i class="ph-fill ph-user"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 32px"> | ||
| <i class="ph-fill ph-gear"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 36px"> | ||
| <i class="ph-fill ph-airplane"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 40px"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 44px"> | ||
| <i class="ph-fill ph-globe"></i> | ||
| </ion-icon> | ||
| <ion-icon aria-hidden="true" style="font-size: 48px"> | ||
| <i class="ph-fill ph-lock"></i> | ||
| </ion-icon> | ||
|
|
||
| <h2>Buttons: Phosphor Icons</h2> | ||
| <ion-button size="small" aria-label="Trash"> | ||
| <ion-icon aria-hidden="true" slot="icon-only"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| </ion-button> | ||
|
|
||
| <ion-button size="medium" aria-label="Trash"> | ||
| <ion-icon aria-hidden="true" slot="icon-only"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| </ion-button> | ||
|
|
||
| <ion-button size="large" aria-label="Trash"> | ||
| <ion-icon aria-hidden="true" slot="icon-only"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| </ion-button> | ||
|
|
||
| <h2>Buttons: Ionicons</h2> | ||
| <ion-button size="small" aria-label="Trash"> | ||
| <ion-icon aria-hidden="true" slot="icon-only" icon="trash"></ion-icon> | ||
| </ion-button> | ||
|
|
||
| <ion-button size="medium" aria-label="Trash"> | ||
| <ion-icon aria-hidden="true" slot="icon-only" icon="trash"></ion-icon> | ||
| </ion-button> | ||
|
|
||
| <ion-button size="large" aria-label="Trash"> | ||
| <ion-icon aria-hidden="true" slot="icon-only" icon="trash"></ion-icon> | ||
| </ion-button> | ||
|
|
||
| <h2>Items: Phosphor Icons</h2> | ||
| <ion-item> | ||
| <ion-icon aria-hidden="true" slot="start"> | ||
| <i class="ph-fill ph-person"></i> | ||
| </ion-icon> | ||
| <ion-label>Phosphor Icons</ion-label> | ||
| <ion-icon aria-hidden="true" slot="end"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-icon color="secondary" aria-hidden="true" slot="start"> | ||
| <i class="ph-fill ph-person"></i> | ||
| </ion-icon> | ||
| <ion-label>Phosphor Icons</ion-label> | ||
| <ion-icon color="danger" aria-hidden="true" slot="end"> | ||
| <i class="ph-fill ph-trash"></i> | ||
| </ion-icon> | ||
| </ion-item> | ||
|
|
||
| <h2>Items: Ionicons</h2> | ||
| <ion-item> | ||
| <ion-icon icon="person" aria-hidden="true" slot="start"></ion-icon> | ||
| <ion-label>Ionicons</ion-label> | ||
| <ion-icon icon="trash" aria-hidden="true" slot="end"></ion-icon> | ||
| </ion-item> | ||
|
|
||
| <ion-item> | ||
| <ion-icon icon="person" color="secondary" aria-hidden="true" slot="start"></ion-icon> | ||
| <ion-label>Ionicons</ion-label> | ||
| <ion-icon icon="trash" color="danger" aria-hidden="true" slot="end"></ion-icon> | ||
| </ion-item> | ||
| </ion-content> | ||
| </ion-app> | ||
|
|
||
| <style> | ||
| h2 { | ||
| text-transform: uppercase; | ||
| font-size: 14px; | ||
| color: #444; | ||
| font-weight: bold; | ||
| margin-top: 24px; | ||
| } | ||
| </style> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,7 @@ | |
| } | ||
|
|
||
| .input-clear-icon ion-icon { | ||
| width: 18px; | ||
| height: 18px; | ||
| font-size: 18px; | ||
| } | ||
|
|
||
| // Input - Disabled | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,7 @@ | |
| } | ||
|
|
||
| .input-clear-icon ion-icon { | ||
| width: 22px; | ||
| height: 22px; | ||
| font-size: 22px; | ||
| } | ||
|
|
||
| // Input - Disabled | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,8 +29,7 @@ | |
| // Icon | ||
| .select-option-start > ion-icon, | ||
| .select-option-end > ion-icon { | ||
| width: 28px; | ||
| height: 28px; | ||
| font-size: 28px; | ||
|
Member
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. I think Adding |
||
| } | ||
|
|
||
| // Select Option: Action Sheet | ||
|
|
||
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.
Nit: could you add a note on why this is md/ltr only? We generally put a
/** */block above a restrictedconfigs()call, like select-modal does. Up to you!