Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

fix: make error box dismissable #44

Merged
merged 9 commits into from
May 14, 2020
Merged

fix: make error box dismissable #44

merged 9 commits into from
May 14, 2020

Conversation

vipin8169
Copy link
Contributor

No description provided.

Copy link
Member

@coderbyheart coderbyheart left a comment

Choose a reason for hiding this comment

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

This does not make the error box dismissable, instead it hides the error after 5 seconds.

This is a distinctly different solution, and has usability issues. If the user does not pay attention, or is on another screen while the error happens, they might not even see the error message.

This makes it also very hard for users to share error messages (because they will immediately disappear).

I have updated the issue description to reflect that user interaction should be needed to dismiss the error box.

@vipin8169
Copy link
Contributor Author

How would you like to get it dismissed? do you want a cross button to dismiss it? what user action should make it disappear?

@coderbyheart
Copy link
Member

A X icon is a typical UI element which allows to dismiss error messages, so yes, that could be a solution.

Copy link
Member

@coderbyheart coderbyheart left a comment

Choose a reason for hiding this comment

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

image

The positioning of the X button does not handle error message which are longer.

@vipin8169
Copy link
Contributor Author

I am not sure what you mean. I request you to please elaborate and provide more information, and also a way to reproduce the problem.

@vipin8169
Copy link
Contributor Author

Should I rather place the x button at the bottom right corner of this red message box?

@coderbyheart
Copy link
Member

I am not sure what you mean. I request you to please elaborate and provide more information, and also a way to reproduce the problem.

Add some text to the error message to make it longer, then you will see what is shown in the screenshot above.

Should I rather place the x button at the bottom right corner of this red message box?

No, like in the development warning, the button should be in the top right corner.

image

@coderbyheart coderbyheart added the enhancement New feature or request label May 7, 2020
@vipin8169
Copy link
Contributor Author

Can you please take a look at the new changes and merge this pr if everything is as expected.

@coderbyheart
Copy link
Member

Yes, I first want to set up a way to preview PRs (#46), otherwise I always have to check them out locally.

@vipin8169
Copy link
Contributor Author

ok. Let me know if you would want to me to look at anything else in the meantime.

Copy link
Member

@coderbyheart coderbyheart left a comment

Choose a reason for hiding this comment

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

image

The close buttons in the red and the yellow box do not align.

@vipin8169
Copy link
Contributor Author

Updated the code to align the two.

Copy link
Member

@coderbyheart coderbyheart left a comment

Choose a reason for hiding this comment

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

image

Now the text does not align with the one in the yellow box.

@vipin8169
Copy link
Contributor Author

fixed

@coderbyheart
Copy link
Member

I think you forgot to push, the last commit is 83926e1 which is from 22 hours ago.

@vipin8169
Copy link
Contributor Author

Sorry, my bad. pushed it now

Copy link
Member

@coderbyheart coderbyheart left a comment

Choose a reason for hiding this comment

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

image

Not that the vertical space between the button and the top of the box is different to the yellow box.

image

Please pay attention to these differences.

You could solve this by create an DismissableBox component which has the same styles for positioning text and close buttons and re-use this in both cases.

@vipin8169
Copy link
Contributor Author

fixed

use same vertical spacing for both yellow nd red boxes
Copy link
Member

@coderbyheart coderbyheart left a comment

Choose a reason for hiding this comment

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

image

@vipin8169
Copy link
Contributor Author

fixed.

Copy link
Member

@coderbyheart coderbyheart left a comment

Choose a reason for hiding this comment

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

Ok, it now looks the same. I think this can be further improved in another PR and re-use the Notice component.

export const Error = ({ type, message }: ErrorInfo) => {
const [visible, setVisible] = useState(true)
if (!visible) return null
else
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
else

This is not neccessary. The return in the previous line will end the function execution.

@vipin8169
Copy link
Contributor Author

Can we merge this one?

@coderbyheart
Copy link
Member

Yes, it's approved!

@vipin8169
Copy link
Contributor Author

but it has not been merged yet :/

@coderbyheart
Copy link
Member

Can't you do that?

@vipin8169
Copy link
Contributor Author

I am not authorized to merge this pull request.

@coderbyheart coderbyheart merged commit eff3799 into saga May 14, 2020
@coderbyheart coderbyheart deleted the vipchat branch May 14, 2020 07:59
@github-actions
Copy link

🎉 This PR is included in version 1.21.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants