Skip to content

Commit 23e54b9

Browse files
authored
Merge pull request #12683 from google/enhancement/12508-progress-snackbar-style-fixes
Align Progress snackbar styles with Figma per QA feedback
2 parents f2bff14 + 712ae0a commit 23e54b9

6 files changed

Lines changed: 35 additions & 4 deletions

assets/js/components/pdf-export/PDFReportProgressSnackbar.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe( 'PDFReportProgressSnackbar', () => {
7777
expect( progressbar ).toBeInTheDocument();
7878
expect(
7979
progressbar.querySelector( '.mdc-linear-progress__primary-bar' )
80-
).toHaveStyle( 'transform: scaleX(0.25)' );
80+
).toHaveStyle( { width: '25%', transform: 'none' } );
8181

8282
rerender(
8383
<PDFReportProgressSnackbar
@@ -88,7 +88,7 @@ describe( 'PDFReportProgressSnackbar', () => {
8888

8989
expect(
9090
progressbar.querySelector( '.mdc-linear-progress__primary-bar' )
91-
).toHaveStyle( 'transform: scaleX(0.75)' );
91+
).toHaveStyle( { width: '75%', transform: 'none' } );
9292
} );
9393

9494
it( 'calls onCancel when the Cancel button is clicked', () => {

assets/js/googlesitekit/components-gm2/ProgressBar.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,18 @@ export default function ProgressBar( {
7272
: Math.round( progressBarVerticalSpacing / 2 );
7373
}
7474

75-
const transform = progress ? `scaleX(${ progress })` : undefined;
75+
// Use width on the primary bar so the inner bar can be styled freely (e.g., border-radius).
76+
// Clamp keeps the percentage valid. CSS rejects negative widths.
77+
let primaryBarStyle;
78+
if ( ! indeterminate ) {
79+
const clamped = Math.max( 0, Math.min( 1, progress || 0 ) );
80+
primaryBarStyle = {
81+
transform: 'none',
82+
width: `${ clamped * 100 }%`,
83+
};
84+
} else if ( progress ) {
85+
primaryBarStyle = { transform: `scaleX(${ progress })` };
86+
}
7687

7788
return (
7889
<div
@@ -92,7 +103,7 @@ export default function ProgressBar( {
92103
<div className="mdc-linear-progress__buffer" />
93104
<div
94105
className="mdc-linear-progress__bar mdc-linear-progress__primary-bar"
95-
style={ { transform } }
106+
style={ primaryBarStyle }
96107
>
97108
<span className="mdc-linear-progress__bar-inner" />
98109
</div>

assets/sass/components/pdf-export/_googlesitekit-pdf-report-progress-snackbar.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
@media (min-width: $bp-tablet) {
2626
padding-top: 41px;
2727
}
28+
29+
.mdc-button--tertiary:not(:disabled) {
30+
color: $c-surfaces-inverse-on-surface;
31+
}
32+
33+
.googlesitekit-notice__content p {
34+
font-size: $fs-body-md;
35+
letter-spacing: $ls-s;
36+
line-height: $lh-body-md;
37+
}
2838
}
2939

3040
.googlesitekit-pdf-report-progress-snackbar__progress {
@@ -39,5 +49,9 @@
3949
@media (min-width: $bp-tablet) {
4050
top: 16.5px;
4151
}
52+
53+
.mdc-linear-progress__bar-inner {
54+
border-radius: $br-lg;
55+
}
4256
}
4357
}

assets/sass/vendor/_mdc-linear-progress.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@
1717
.mdc-linear-progress--compress {
1818
margin: 0;
1919
}
20+
21+
// Animate width on the primary bar so determinate progress fills smoothly.
22+
// Uses MDC's sharp curve (matches the 250ms transform/opacity transitions MDC already applies to .mdc-linear-progress).
23+
.mdc-linear-progress:not(.mdc-linear-progress--indeterminate) .mdc-linear-progress__primary-bar {
24+
transition: width 250ms cubic-bezier(0.4, 0, 0.6, 1);
25+
}
2026
}
1.75 KB
Loading
1.78 KB
Loading

0 commit comments

Comments
 (0)