UX-and-I / storybook-design-token

Display design token documentation generated from your stylesheets and icon files. Preview design token changes in the browser. Add your design tokens to your Storybook Docs pages using the custom Doc Blocks.
https://dev.to/psqrrl/managing-design-tokens-using-storybook-5975
MIT License
641 stars 123 forks source link

Feature Request: Custom Presenters #7

Open Smolations opened 4 years ago

Smolations commented 4 years ago

First off, THANK YOU! I have been dreading setting up a custom story that manually displays brand colors via variables, so this add-on really hit home for me. πŸ‘

Now for the feature request, custom presenters. The default presenter for colors is pretty good, but it isn't responsive so I basically need my browser at full width on a 15" screen to see all the info. This could be solved by a custom color presenter (I'd prefer to avoid storybook ui style overrides).

Additionally, some of my components have their own variables that are made available to other components which makes it easier for the latter to compose the former. It would be great to have a "General" or custom presenter to display the variables, descriptions, and values at a component level.

Don't get me wrong; you have a pretty solid set of default presenters already, but having the option of using a custom presenter greatly increases the flexibility of this addon. πŸ˜‹

Sqrrl commented 4 years ago

Hey. The panel styling definitely needs some work. Iβ€˜ll try to come up with something more compact or responsive in the near future.

Regarding the custom presenters, you can skip the @presenter annotation to display tokens without an example column. A system to plug in custom presenter components is definitely on my todo list. I just canβ€˜t find the time right now.

Smolations commented 4 years ago

Oh ok, good to know! To clarify though, any files annotated with @tokens will still show up under the global panel and not in any component-specific panel, right?

Sqrrl commented 4 years ago

Right.

Sqrrl commented 4 years ago

I'm experimenting with a new card based panel design. Would like to hear your opinion. I think this would work better for small viewports.

https://5e566a8a2ae51f01ad105fd5--storybook-design-token.netlify.com/

Smolations commented 4 years ago

@Sqrrl That looks pretty good when the addons panel is on the side, but when it's underneath the canvas the colors and headers span full width, so scrolling is a bit difficult because it's like, black, color, black, color, black, color, etc. Maybe instead of allowing full width you can use a responsive grid setup? Looks like the container is already flexed so you just need to set a max-width on each color container. Just by setting max-width: 20% I see a noticeable improvement:

Screen Shot 2020-04-06 at 9 55 00 AM

Might be good to add a lil margin between each color card, but the tiles help see more colors at a glance and would work for both large/small screens for either addons bar orientation, imho. 😁

Also, something irks me about the black header bars, but I don't currently have a better idea for that. I think it's the fact that my eyes just want to see color rectangles for each color token but the black draws my eye away a bit as i scan...

Glad to see some good progress on this issue! πŸ‘

Sqrrl commented 4 years ago

Hey. Thanks for your feedback. The cards should already behave like you described. This is how they look to me:

Bildschirmfoto 2020-04-06 um 18 23 59

What browser are you using? Does it work if you resize the addon panel?

Smolations commented 4 years ago

Ahhh, weird, that's not how they appeared at first render, but seems like they are showing up like that now. You didn't push any changes within the last few mins, did you? :smirk:

Anywho, love that you give users the option between card/table view! Now if we could only solve that black header problem...

Also, a nice to have, would be a lil search bar on each token category that would simply filter the cards/table rows shown on some fuzzy matching algorithm. Even a tokenName.includes(searchStr) would be convenient enough as an mvp feature. πŸ˜‹

Also, any progress for making this addon ie11 compatible? Sorry for issue scope bleed, but compatibility and this issue are the last two pieces left to make my token documentation dreams come true! πŸ˜†

emzarts commented 2 years ago

Hello! I would love to hear if there are any updates on the ability to add custom presenters for tokens

acherkashin commented 1 year ago

@emzarts I'm going to continue working on it after a long pause. I need to adapt my changes for v3 and refactor it.

https://github.com/UX-and-I/storybook-design-token/pull/164