-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
feat(badge): add medium size for ionic theme #29528
Merged
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d8648e7
feat(badge): add small/default size for ionic theme
thetaPC 12659fb
test(badge): add small size
thetaPC 41f4210
docs(badge): update comment
thetaPC bf26572
refactor(badge): add missing styles
thetaPC ab027b8
feat(badge): add medium size
thetaPC ec161bf
test(badge): add medium snapshots
thetaPC 2d77790
test(badge): remove only
thetaPC 7553d17
refactor(badge): use tokens
thetaPC 4094947
Merge branch 'ROU-10725' of github.com:ionic-team/ionic-framework int…
thetaPC 0125466
refactor(badge): use the globals import
thetaPC 2888bae
Merge branch 'ROU-10725' of github.com:ionic-team/ionic-framework int…
thetaPC 460b6c1
refactor(badge): use globals variable
thetaPC 0a7bb81
refactor(badge): use proper var structure
thetaPC 34a7b9f
Merge branch 'ROU-10725' of github.com:ionic-team/ionic-framework int…
thetaPC 1f782c0
refactor(badge): add prop value
thetaPC 80f55db
Merge branch 'next' of github.com:ionic-team/ionic-framework into ROU…
thetaPC 647b217
refactor(badge): use new tokens
thetaPC 01d6afe
Merge branch 'ROU-10725' of github.com:ionic-team/ionic-framework int…
thetaPC ecd6359
refactor(badge): use new tokens
thetaPC ea74585
Merge branch 'next' of github.com:ionic-team/ionic-framework into ROU…
thetaPC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,38 @@ | ||
@use "../../themes/ionic/ionic.globals.scss" as globals; | ||
@import "./badge"; | ||
|
||
// Ionic Badge | ||
// -------------------------------------------------- | ||
|
||
:host { | ||
--padding-start: #{globals.$ionic-space-100}; | ||
--padding-end: #{globals.$ionic-space-100}; | ||
--padding-top: #{globals.$ionic-space-0}; | ||
--padding-bottom: #{globals.$ionic-space-0}; | ||
|
||
display: inline-flex; | ||
|
||
align-items: center; | ||
justify-content: center; | ||
|
||
font-size: globals.$ionic-font-size-400; | ||
font-weight: globals.$ionic-font-weight-medium; | ||
|
||
line-height: globals.$ionic-line-height-600; | ||
} | ||
|
||
// Badge Sizes | ||
// -------------------------------------------------- | ||
:host(.badge-small) { | ||
min-width: globals.$ionic-scale-800; | ||
height: globals.$ionic-scale-800; | ||
} | ||
|
||
:host(.badge-medium) { | ||
min-width: globals.$ionic-scale-1000; | ||
height: globals.$ionic-scale-1000; | ||
|
||
font-size: globals.$ionic-font-size-450; | ||
|
||
line-height: globals.$ionic-line-height-700; | ||
} |
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,35 @@ | ||
import { expect } from '@playwright/test'; | ||
import { configs, test } from '@utils/test/playwright'; | ||
|
||
/** | ||
* This behavior does not vary across directions. | ||
*/ | ||
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => { | ||
test.describe(title('badge: size'), () => { | ||
test('should render small badges', async ({ page }) => { | ||
await page.setContent( | ||
` | ||
<ion-badge size="small">00</ion-badge> | ||
`, | ||
config | ||
); | ||
|
||
const badge = page.locator('ion-badge'); | ||
|
||
await expect(badge).toHaveScreenshot(screenshot(`badge-size-small`)); | ||
}); | ||
|
||
test('should render medium badges', async ({ page }) => { | ||
await page.setContent( | ||
` | ||
<ion-badge size="medium">00</ion-badge> | ||
`, | ||
config | ||
); | ||
|
||
const badge = page.locator('ion-badge'); | ||
|
||
await expect(badge).toHaveScreenshot(screenshot(`badge-size-medium`)); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+501 Bytes
...e.e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+924 Bytes
....e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+473 Bytes
...e.e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+459 Bytes
...ge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+536 Bytes
...e.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+440 Bytes
...ge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Safari-linux.png
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>Badge - Size</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" /> | ||
<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>Button - Size</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content class="ion-padding" id="content" no-bounce> | ||
<ion-list> | ||
<ion-item> | ||
<ion-label>Default Badge</ion-label> | ||
<ion-badge slot="end">00</ion-badge> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Small Badge</ion-label> | ||
<ion-badge slot="end" size="small">00</ion-badge> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label>Medium Badge</ion-label> | ||
<ion-badge slot="end" size="medium">00</ion-badge> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
</ion-app> | ||
</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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not a blocker but we should consider adding screenshots for the designs in Figma where there is a badge containing "1" and another containing "99+" to show how the badge looks as a circle and then wider.
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'll do that in a separate PR.