-
Notifications
You must be signed in to change notification settings - Fork 377
Fixes #881 - Add LoadingState component #886
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
Conversation
69338d6 to
08cd1a3
Compare
Pull Request Test Coverage Report for Build 3318
💛 - Coveralls |
08cd1a3 to
7fbfe12
Compare
|
PatternFly-React preview: https://886-pr-patternfly-react-patternfly.surge.sh |
|
Thanks for the PR @xprazak2. I'd like to see this in patternfly first then added here to avoid the extra sass in this repo. Would you mind creating a PR there first? Or I can do that relatively quickly and I have some cycles. Just trying to keep the css in this repo to a minimum for patternfly patterns. |
|
Took the liberty of putting up the PR in patternfly: patternfly/patternfly#1152 |
7fbfe12 to
50bd5d2
Compare
|
I removed the stylesheets and opened PR for patternfly repo. And then closed it again when I noticed @jeff-phillips-18 beat me to it 😄 |
50bd5d2 to
fc65848
Compare
jeff-phillips-18
left a comment
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.
Need to bump the version of patternfly to 3.56
| const spinner = ( | ||
| <div className="pf-loading-state"> | ||
| <Spinner loading={loading} size="lg" /> | ||
| <p>{loadingText}</p> |
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.
the <p> can be removed
| loadingText: PropTypes.string, | ||
| children: PropTypes.node, | ||
| timeout: PropTypes.number | ||
| }; |
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.
the propTypes need comments to add descriptions in storybook.
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.
This should take a size for the entire loading state (rather than spinnerSize) and add loading-state-pf-[lg, sm, xs] to the outer div and set the spinner size appropriately
| const { loading, loadingText, children } = this.props; | ||
| const spinner = ( | ||
| <div className="pf-loading-state"> | ||
| <Spinner loading={loading} size="lg" /> |
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.
we should allow a prop to set the size and add the appropriate class to the pf-loading-state as well as set the size on the Spinner.
| } | ||
|
|
||
| componentDidMount() { | ||
| setTimeout(() => { |
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.
Need to set this into a property and clear it if the component unmounts before the function is fired.
4c2cc56 to
8caffcd
Compare
|
I bumped the patternfly version, updated the props and do a cleanup in When running storybook locally, the new styles were not applied to the component. patternfly/patternfly#1154 should take care of that. |
f7190dc to
3526a8c
Compare
| "css-element-queries": "^1.0.1", | ||
| "patternfly": "^3.52.4", | ||
| "patternfly": "^3.57.1", | ||
| "react-bootstrap": "^0.32.1", |
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.
You also need to update packages/patternfly-3/patternfly-react-extensions/package.json to use the same version
| loadingText: PropTypes.string, | ||
| children: PropTypes.node, | ||
| timeout: PropTypes.number | ||
| }; |
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.
This should take a size for the entire loading state (rather than spinnerSize) and add loading-state-pf-[lg, sm, xs] to the outer div and set the spinner size appropriately
| story | ||
| }); | ||
| }) | ||
| ); |
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.
Would be nice to add a knob to set the size
| jest.runAllTimers(); | ||
| component.update(); | ||
| expect(toJson(component.render())).toMatchSnapshot(); | ||
| }); |
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.
Add tests for sizes.
0d194d7 to
d8599df
Compare
|
The |
| /** delay in showing the children */ | ||
| timeout: PropTypes.number, | ||
| /** size of the spinner */ | ||
| size: PropTypes.oneOf(['lg', 'sm', 'xs']), |
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.
Need to add 'md' here as well (though it doesn't really add styling except to give the default).
| const { loading, loadingText, children, size, additionalClasses } = this.props; | ||
|
|
||
| const spinner = ( | ||
| <div className={`loading-state-pf loading-state-pf-${size} ${additionalClasses}`}> |
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.
Better to use classnames
30c1170 to
7e5c0bb
Compare
|
I added md and use classnames. |
7e5c0bb to
c85cf07
Compare
|
Fixing the linter offence. |
|
@xprazak2 Looks like you need to do a snapshot update. |
c85cf07 to
7ff63b5
Compare
|
I rebased and updated the snapshots. |
7ff63b5 to
a498176
Compare
mfrances17
left a comment
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.
LGTM
What: Adds new LoadingState component
Additional issues: none