-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat: onClick is no longer required on navbar and steplink #441
Conversation
@@ -8,7 +8,7 @@ const propTypes = { | |||
...Constants.propTypes, | |||
id: PropTypes.string.isRequired, | |||
href: PropTypes.string, | |||
onClick: PropTypes.func.isRequired, | |||
onClick: PropTypes.func, |
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.
May be you should check if(onClick != null)
onClick(e) {
e.preventDefault();
const { id, href, number, title, onClick } = this.props;
onClick({
href,
number,
id,
title,
});
}
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.
Where do you find this code code ?
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.
onto this file => packages/Form/steps/src/StepLink.js
the idea is to secure the remove of is required for all the use case.
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'm not sure that correspond to my problem. Indeed, each time I use a Step component without an onClick props, I have an error in the console. If I add a onClick condition without removing the isRequired from the PropTypes declaration, the error will still be in the console.
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.
@samuel-gomez-axa , what do you think about this ?
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.
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.
can you add an example in the story , please ?
with no onClick props : https://github.com/AxaGuilDEv/react-toolkit/tree/master/storybook/storybook/src/packages/Form/steps/src
@@ -7,7 +7,7 @@ import { setPosition } from './NavBar.helpers'; | |||
const propTypes = { | |||
...Constants.propTypes, | |||
isVisible: PropTypes.bool.isRequired, | |||
onClick: PropTypes.func.isRequired, | |||
onClick: PropTypes.func, |
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.
no problem here for just set props not required :)
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.
can you add an example in the story , please ?
with no onClick props : https://github.com/AxaGuilDEv/react-toolkit/tree/master/storybook/storybook/src/packages/Layout/header/src/NavBar
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
Co-authored-by: Johnathan MEUNIER <jonathan.meunier@axa.fr>
Related issue
Description of the issue
onClick prop was required on some component. If you know other useless required prop, add them on this PR.
Person(s) for reviewing proposed changes