Skip to content
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

Merged
merged 5 commits into from
Sep 15, 2023

Conversation

Yashsharma1911
Copy link
Contributor

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 ref

const checkboxState = resetRef.current.getCheckboxState();

Screenshot 2023-09-05 at 6 23 16 PM


Signed commits

  • Yes, I signed my commits.

Signed-off-by: yash sharma <yashsharma2572@gmail.com>
@github-actions github-actions bot added the component/ui User Interface label Sep 6, 2023
@Yashsharma1911
Copy link
Contributor Author

Todo: A cross in modal to make it consistent

<Checkbox
checked={isChecked}
onChange={() => {
this.handleCheckboxChange();
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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

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?

Copy link
Contributor Author

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

ui/components/PromptComponent.js Outdated Show resolved Hide resolved
Co-authored-by: Chetan Kumar <Chetansain86@gmail.com>
Signed-off-by: Yash sharma <71271069+Yashsharma1911@users.noreply.github.com>
@leecalcote
Copy link
Member

leecalcote commented Sep 6, 2023

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>
Signed-off-by: yash sharma <yashsharma2572@gmail.com>
@Yashsharma1911
Copy link
Contributor Author

Screenshot 2023-09-11 at 4 36 49 PM

@Yashsharma1911
Copy link
Contributor Author

I'm merging this PR

@Yashsharma1911 Yashsharma1911 merged commit 6b66146 into meshery:master Sep 15, 2023
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ui User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants