Fixes #881 - Add LoadingState component - #886
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.
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.
the <p> can be removed
| loadingText: PropTypes.string, | ||
| children: PropTypes.node, | ||
| timeout: PropTypes.number | ||
| }; |
There was a problem hiding this comment.
the propTypes need comments to add descriptions in storybook.
There was a problem hiding this comment.
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.
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.
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.
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.
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.
Would be nice to add a knob to set the size
| jest.runAllTimers(); | ||
| component.update(); | ||
| expect(toJson(component.render())).toMatchSnapshot(); | ||
| }); |
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.
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.
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
What: Adds new LoadingState component
Additional issues: none