Skip to content

Conversation

@xprazak2
Copy link
Contributor

@xprazak2 xprazak2 commented Nov 6, 2018

What: Adds new LoadingState component

Additional issues: none

@coveralls
Copy link

coveralls commented Nov 6, 2018

Pull Request Test Coverage Report for Build 3318

  • 11 of 12 (91.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 81.35%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/patternfly-3/patternfly-react/src/components/LoadingState/LoadingState.js 11 12 91.67%
Totals Coverage Status
Change from base Build 3317: 0.03%
Covered Lines: 3887
Relevant Lines: 4503

💛 - Coveralls

@patternfly-build
Copy link
Collaborator

PatternFly-React preview: https://886-pr-patternfly-react-patternfly.surge.sh

@jeff-phillips-18
Copy link
Member

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.

@jeff-phillips-18
Copy link
Member

jeff-phillips-18 commented Nov 7, 2018

Took the liberty of putting up the PR in patternfly: patternfly/patternfly#1152

@xprazak2
Copy link
Contributor Author

xprazak2 commented Nov 8, 2018

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 😄

Copy link
Member

@jeff-phillips-18 jeff-phillips-18 left a 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>
Copy link
Member

@jeff-phillips-18 jeff-phillips-18 Nov 8, 2018

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
};
Copy link
Member

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.

Copy link
Member

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" />
Copy link
Member

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(() => {
Copy link
Contributor

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.

@xprazak2 xprazak2 force-pushed the loading-state branch 3 times, most recently from 4c2cc56 to 8caffcd Compare November 12, 2018 13:10
@xprazak2
Copy link
Contributor Author

I bumped the patternfly version, updated the props and do a cleanup in componentWillUnmount.

When running storybook locally, the new styles were not applied to the component. patternfly/patternfly#1154 should take care of that.

@xprazak2 xprazak2 force-pushed the loading-state branch 2 times, most recently from f7190dc to 3526a8c Compare November 13, 2018 10:09
"css-element-queries": "^1.0.1",
"patternfly": "^3.52.4",
"patternfly": "^3.57.1",
"react-bootstrap": "^0.32.1",
Copy link
Member

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
};
Copy link
Member

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
});
})
);
Copy link
Member

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();
});
Copy link
Member

Choose a reason for hiding this comment

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

Add tests for sizes.

@xprazak2 xprazak2 force-pushed the loading-state branch 2 times, most recently from 0d194d7 to d8599df Compare November 15, 2018 08:17
@xprazak2
Copy link
Contributor Author

The size prop is now applied to the whole component, not just spinner and there is a test for that. I added knob for sizes and bumped the patternfly version for both patternfly-react-extensions and react-console so that 3.52.z version is purged from yarn.lock on yarn upgrade and the styles from 3.57.1 are applied in storybook.

/** delay in showing the children */
timeout: PropTypes.number,
/** size of the spinner */
size: PropTypes.oneOf(['lg', 'sm', 'xs']),
Copy link
Member

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}`}>
Copy link
Member

Choose a reason for hiding this comment

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

Better to use classnames

@xprazak2 xprazak2 force-pushed the loading-state branch 2 times, most recently from 30c1170 to 7e5c0bb Compare November 16, 2018 10:07
@xprazak2
Copy link
Contributor Author

I added md and use classnames.

@xprazak2
Copy link
Contributor Author

Fixing the linter offence.

@jeff-phillips-18
Copy link
Member

@xprazak2 Looks like you need to do a snapshot update.

@xprazak2
Copy link
Contributor Author

I rebased and updated the snapshots.

@dlabaj dlabaj merged commit d48d45f into patternfly:master Nov 27, 2018
Copy link
Contributor

@mfrances17 mfrances17 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants