Skip to content

Conversation

@kristoferbrown
Copy link
Contributor

Pull request checklist

  • Include a change request file using $ npm run change

Description of changes

Adds a ProgressIndicator variant to indicate indeterminate or unknown progress. If no value is passed for the percentComplete prop, the indeterminate variant will be shown instead of the normal percentage variant.

Low quality .gif preview:
recording 1

@betrue-final-final
Copy link
Member

LOVE this.

@lynamemi
Copy link
Collaborator

lynamemi commented Jan 9, 2018

ooo shiny!!

aria-valuetext={undefined}
className="ms-ProgressIndicator-progressBar"
role="progressbar"
style={
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add another test to ProgressIndicator.test.tsx so we have both determinate and indeterminate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lynamemi, good call. I've added a test so that there is one with a % complete and one without.

}

percentComplete = Math.min(100, Math.max(0, percentComplete! * 100));
this.props.percentComplete !== undefined ? percentComplete = Math.min(100, Math.max(0, percentComplete! * 100)) : percentComplete = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be written like the following.
percentComplete = (this.props.percentComplete) ? Math.min(100, Math.max(0, percentComplete! * 100)) : 0;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@battletoilet, The way you wrote this definitely makes more sense, but ultimately I had to change this line and a few other spots so that it would still show the % version if you give 0 for the % and then only show the indeterminate version if it's actually undefined. Let me know if this is still too messy.

background-color: WindowText;
}
}
[dir='rtl'] .progressBar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually have a mixin in _i18n.scss that we normally use for this scenario.

@include RTL { .progressBar { ... } }
Or something similar

describe('ProgressIndicator', () => {
it('renders ProgressIndicator correctly', () => {
const component = renderer.create(<ProgressIndicator percentComplete={ 0.75 } />);
let tree = component.toJSON();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it could be a const as well unless tree is mutated further in the process chain.

width: 0;

&.indeterminate {
position: absolute;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

position: absolute is defined twice, not needed in both line 54 and 59

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also recommend avoiding nesting. It creates very specific rules that are 2 levels deep, which creates problems later if it ever is overridden.

@dzearing dzearing merged commit 88fd649 into microsoft:master Jan 14, 2018
chrismohr pushed a commit to chrismohr/office-ui-fabric-react that referenced this pull request Apr 17, 2018
* Basic indeterminate progress implementation

* Fixing snapshot issues.

* Adding zero check, prop comments, and removing unused SASS.

* Adding RTL support.

* Rush change

* no message

* Fixing build

* Addressing PR comments and improving zero handling

* Fixing snapshot
@sivabhusarapu
Copy link

Is there any simple way to customize Indeterminate progress bar to make more width and less speed?

@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants