Skip to content

Commit

Permalink
fix(progressbar): improve progressbar animation (#306)
Browse files Browse the repository at this point in the history
* fix(progressbar): improve progressbar animation

* fix(progressbar): minor fixes on progress bar
  • Loading branch information
rishichawda authored Jan 2, 2019
1 parent 68ee49a commit c4d9397
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/progressbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ProgressBar extends React.Component {
}

componentDidUpdate(props) {
this.progress.style.width = `${props.progress}%`;
this.progress.style.transform = `scaleX(${((props.progress || 0.01) / 100)})`;
}

render() {
Expand Down Expand Up @@ -52,7 +52,7 @@ ProgressBar.propTypes = {
ProgressBar.defaultProps = {
theme: defaultTheme,
type: 'primary',
progress: 0,
progress: 0.01,
showProgressText: false,
};

Expand Down
2 changes: 1 addition & 1 deletion lib/progressbar/tests/accessibility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('ProgressBar accessibility tests', () => {
});

it('Should accept a progress prop to update progress effectively.', () => {
expectedValueBefore = 0;
expectedValueBefore = 0.01;
let progress = 0;
actualValue = () => wrappedComponent
.find(ProgressBar)
Expand Down
8 changes: 7 additions & 1 deletion lib/progressbar/theme.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@

:local(.progress) {
height: 100%;
width: 0%;
width: 100%;
will-change: transform;
transform: scaleX(0);
position: absolute;
left: 0;
transform-origin: left;
transition: transform 0.07s linear;
}

:local(.primary) {
Expand Down

0 comments on commit c4d9397

Please sign in to comment.