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

Wrong union description with TypeScript #1621

Closed
atiupin opened this issue Jun 26, 2020 · 9 comments
Closed

Wrong union description with TypeScript #1621

atiupin opened this issue Jun 26, 2020 · 9 comments

Comments

@atiupin
Copy link

atiupin commented Jun 26, 2020

Current behavior
When using TypeScript unions, react-styleguidist isn't providing any description. Moreover, is shows annoying empty div.

Screenshot 2020-06-26 at 17 31 05

To reproduce
Use TypeScript and add description to any union field. Demo: https://codesandbox.io/s/goofy-forest-zmeiy

Expected behavior
Unwrapped union description or at least no empty div.

Version
11.0.8

@mitsuruog
Copy link
Contributor

You can hover your mouse over the field for a few seconds to see the actual value, but I can understand the fact that more people don't realize it.

スクリーンショット 2020-07-03 22 43 39

So... we can change this, but first, we need to decide what kind of UI we want.
Here's my idea. Does anyone have any other good ideas?

  1. Show the actual value instead

スクリーンショット 2020-07-03 22 45 46

  1. Show the actual value below the description

スクリーンショット 2020-07-03 22 47 45

FYI @sapegin what do you think?

@atiupin
Copy link
Author

atiupin commented Jul 3, 2020

Yeah, I know that I can hover on union, that's a cool feature. I'm actually bothered with ugly empty space between table rows. As far as I know, when parsing prop-types union there is actual description, like One of: red, blue. But not in this case.

Pic. 2 is fine I guess. Union description could be quite long, so putting it in type column may look sloppy.

@sapegin
Copy link
Member

sapegin commented Jul 3, 2020

I think unions can be very very long, and improving tooltips could be a better solution in general — showing a nice HTML tooltip where we can format code on multiple lines, instead of a title, which, I agree, isn't the best and easily discoverable UI pattern.

@sapegin
Copy link
Member

sapegin commented Jul 3, 2020

There are many places that could be improved with tooltips:

image

image

@mitsuruog
Copy link
Contributor

here is my design idea.
to solve the un-discoverable UI, I would like to put an icon next to the property.
what do you think?

スクリーンショット 2020-07-08 23 15 09

@sapegin
Copy link
Member

sapegin commented Jul 8, 2020

This looks good!

A couple of comments:

  1. I think we don't need an underline anymore, an icon is enough to show that this thing is interactive.
  2. The whole thing (text + icon) should be hoverable, otherwise, the hoverable area would be too small and too difficult to use for some folks.

@mitsuruog
Copy link
Contributor

sounds good!
if we were to implement this tooltip, do you have any preferred libraries? or would you prefer to implement it from scratch?

@sapegin
Copy link
Member

sapegin commented Jul 8, 2020

Nope, but I'd prefer a library if it won't bring too many dependencies (like another CSS in JS library ;-) and it must be accessible with a keyboard and a screen reader.

mitsuruog added a commit to mitsuruog/react-styleguidist that referenced this issue Jul 12, 2020
mitsuruog added a commit to mitsuruog/react-styleguidist that referenced this issue Jul 23, 2020
mitsuruog added a commit to mitsuruog/react-styleguidist that referenced this issue Aug 24, 2020
@styleguidist-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 11.0.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants