-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(progress-bar): add styling for the ionic theme #30185
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
Changes from 2 commits
e5b00af
79d5e31
2d5aa94
09bfdc0
632456b
32dc863
1707011
24c17fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| @use "../../themes/ionic/ionic.globals.scss" as globals; | ||
| @import "./progress-bar"; | ||
|
|
||
| // iOS Progress bar | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // -------------------------------------------------- | ||
|
|
||
| :host { | ||
| height: globals.$ion-scale-100; | ||
| } | ||
|
|
||
| :host(.progress-bar-solid) { | ||
| /** | ||
| * On the ionic theme the unfilled portion of the progress | ||
| * bar is always a consistent background color. We | ||
| * only apply this style when the progress bar is | ||
| * solid (with a buffer value of 1). This maintains | ||
| * the custom Ionic appearance for a buffered progress bar. | ||
| */ | ||
| --background: #{globals.$ion-primitives-neutral-100}; | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // Progress Bar Shapes | ||
| // ------------------------------------------------------------------------------- | ||
|
|
||
| :host(.progress-bar-shape-round) { | ||
| @include globals.border-radius(globals.$ion-border-radius-full); | ||
| } | ||
|
|
||
| :host(.progress-bar-shape-rectangular) { | ||
| @include globals.border-radius(globals.$ion-border-radius-0); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" dir="ltr"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>Progress Bar - Shape</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> | ||
|
|
||
| <style> | ||
| ion-content::part(scroll) { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| } | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ion-content ion-progress-bar { | ||
| margin: 10px 0; | ||
| width: 70%; | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </style> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Progress Bar - Shape</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
|
|
||
| <ion-content class="outer-content"> | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <ion-label> Default </ion-label> | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <ion-progress-bar value="0.50"></ion-progress-bar> | ||
|
|
||
| <ion-label> Round </ion-label> | ||
| <ion-progress-bar value="0.50" shape="round"></ion-progress-bar> | ||
|
|
||
| <ion-label> Default </ion-label> | ||
| <ion-progress-bar value="0.50" shape="rectangular"></ion-progress-bar> | ||
| </ion-content> | ||
| </ion-app> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { configs, test } from '@utils/test/playwright'; | ||
|
|
||
| configs({ modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => { | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| test.describe(title('progress-bar: shape'), () => { | ||
| test('should render a round progress bar', async ({ page }) => { | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| await page.setContent( | ||
| ` | ||
| <style> | ||
| :root { | ||
| background: #ccc7c7; | ||
thetaPC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| .container { | ||
| padding: 10px; | ||
| } | ||
| </style> | ||
| <div class="container"> | ||
| <ion-progress-bar value="0.50" shape="round"></ion-progress-bar> | ||
| </div> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| const tabBar = page.locator('.container'); | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| await expect(tabBar).toHaveScreenshot(screenshot(`progress-bar-shape-round`)); | ||
| }); | ||
|
|
||
| test('should render a rectangular progress bar', async ({ page }) => { | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| await page.setContent( | ||
| ` | ||
| <style> | ||
| :root { | ||
| background: #ccc7c7; | ||
| } | ||
| .container { | ||
| padding: 10px; | ||
| } | ||
| </style> | ||
| <div class="container"> | ||
| <ion-progress-bar value="0.50" shape="rectangular"></ion-progress-bar> | ||
| </div> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| const tabBar = page.locator('.container'); | ||
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| await expect(tabBar).toHaveScreenshot(screenshot(`progress-bar-shape-rectangular`)); | ||
| }); | ||
| }); | ||
| }); | ||
|
Contributor
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. Delete the shape snapshots and re-generate them. Playwright isn't able to detect the background change to buffer. That's why we need to force a re-generation. Background shouldn't be white, but neutral 100.
Contributor
Author
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 have regenerated the screenshots but no changes were made in the regeneration. I think the bar background looks white in comparison with |
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
thetaPC marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.