-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Updated PromptComponent to support checkbox #8672
Updated PromptComponent to support checkbox #8672
Conversation
Signed-off-by: yash sharma <yashsharma2572@gmail.com>
|
ui/components/PromptComponent.js
Outdated
<Checkbox | ||
checked={isChecked} | ||
onChange={() => { | ||
this.handleCheckboxChange(); |
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 extra function isn't 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.
I created this function to make things clean, although we can update state directly here, also Is that a good practice as clean 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.
onChange={this.handleCheckboxChange}
Isn't simple?
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.
Yes it is thanks for that last time actually I was doing multiple things on that so I added callback function and forgot to remove, now I get what you are talking about, it make sense
})); | ||
}; | ||
|
||
getCheckboxState = () => { |
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.
What is the use case of this function?
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 method function is required to get state of checkbox through ref, although I'm open for suggestion if you have
Co-authored-by: Chetan Kumar <Chetansain86@gmail.com> Signed-off-by: Yash sharma <71271069+Yashsharma1911@users.noreply.github.com>
What the styling of the checkbox changed from how it looks in the screenshot? Smaller font might be nice. |
Signed-off-by: yash sharma <yashsharma2572@gmail.com>
…1/meshery into yash/AddedCheckbox
Signed-off-by: yash sharma <yashsharma2572@gmail.com>
I'm merging this PR |
Notes for Reviewers
This PR fixes #
This PR update PromptComponent to support checkbox with text
Do not show again
const response = await resetRef.current.show({ title: "Reset Canvas?", subtitle, options: ["RESET", "CANCEL"], + showCheckbox: true, });
And to access checkbox state, you can call
getCheckboxState
from refSigned commits