-
Notifications
You must be signed in to change notification settings - Fork 77
fix: CORUI-6120: Add required and default props #322
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
|
there are a number of props that moved to required here - it would be good to kick out a new release to get updated docs to go along with this PR. |
src/Forms/Forms.js
Outdated
| children: PropTypes.node, | ||
| className: PropTypes.string, | ||
| type: PropTypes.oneOf(['', 'error', 'warning', 'help']) | ||
| type: PropTypes.oneOf(['error', 'warning', 'help']) |
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.
@mobot11 : looks like this was missed in the earlier const PR
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 either fix this or create a follow-up issue.
jbadan
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 🚢
|
really nice cleanup here, @cjskillingstad! |
src/Forms/Forms.js
Outdated
| children: PropTypes.node, | ||
| className: PropTypes.string, | ||
| type: PropTypes.oneOf(['', 'error', 'warning', 'help']) | ||
| type: PropTypes.oneOf(['error', 'warning', 'help']) |
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 either fix this or create a follow-up issue.
| // check to make sure itemsPerPage != 0 | ||
| this.numberOfPages = Math.ceil( | ||
| itemsTotal / (itemsPerPage ? itemsPerPage : 10) | ||
| itemsTotal / (itemsPerPage || 10) |
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.
With a default value, we could remove the || 10.
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.
I thought about this, but if the consumer passes in a 0 then this will break
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.
Fair enough. If it would break with certain values, then we should consider adding a custom prop type validator that would prevent that. But, that would be a follow-up enhancement if we wanted to do that.
|
@mobot11 @greg-a-smith Using const's for the last couple places we missed in the propTypes in e09cb71 |
greg-a-smith
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.
Looks good. 🚢 Lots of work, but worth it in the long run!
* ActionBar * Alert * Button * Calendar * DatePicker * Dropdown * FormRadio * InputGroup * LocalizationEditor * Menu * Modal * MultiInput * Pagination * SearchInput * Shellbar * SideNavigation * Table * Tabs * Tile * Tile * Time * TimePicker * Toggle * Remove false default props * Make description optional * Add default prop for funcs * Default prop consts * Remove static proptypes * Remove last false default prop
Description
'', funcs as() => {}, numbers asnull, objects as{}, etc. as it seemed somewhat unnecessary. I did do the bools as false because I think it will make the documentation more readable. Let me know if you think I should do those other cases.fixes #244