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

feat(addon-docs): named colors with ColorPalette #9453

Merged
merged 2 commits into from
Jan 20, 2020
Merged

feat(addon-docs): named colors with ColorPalette #9453

merged 2 commits into from
Jan 20, 2020

Conversation

frassinier
Copy link
Contributor

@frassinier frassinier commented Jan 14, 2020

Issue:
Cannot display design token names using ColorPalette docs component

What I did

Be able to pass an object for colors in addition to a simple array.
image

How to test

NamedColors story has been added.

@vercel
Copy link

vercel bot commented Jan 14, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/m6trrhpun
✅ Preview: https://monorepo-git-fork-frassinier-feat-addon-docscolorpalette.storybook.now.sh

@frassinier
Copy link
Contributor Author

👋 @shilman,
I'm wondering why did you add the 6.0.0 label since there are no breaking changes?
Because it's a feature request?

@shilman
Copy link
Member

shilman commented Jan 15, 2020

Yeah. It's not a bugfix, and 6.0 is the next feature release (end of march, with alphas starting later this week)

@frassinier
Copy link
Contributor Author

frassinier commented Jan 15, 2020 via email

}
return (
<SwatchSpecimen>
<SwatchColors>{Object.values(colors).map(color => renderSwatch(color))}</SwatchColors>
Copy link

Choose a reason for hiding this comment

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

Any concerns regarding order of the design tokens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review @RuneKR but I don't get it?
I simply iterate over the object as it is.
I mean if design tokens need to be reordered then, it must be done in the story, I guess.

Copy link

Choose a reason for hiding this comment

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

Looks like you got the gist of it. I understand that the order is arbitrary in this solution. I was wondering if the solution could/should be extended to allow the developer to specify the order of the colours. This could be achieved by using this data structure:

[{name: 'name of colour', value: 'hex or whatever']

This capability can also be added without making it a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, it's an excellent question!
I still use design tokens starting by $ (because of sass variable conventions) so it does not concern me directly.
It would be great to have the point of view of someone else because I consider that it's not totally necessary. :)

Copy link
Member

Choose a reason for hiding this comment

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

I feel like that could be enhancement made in a following PR, if desired.

Choose a reason for hiding this comment

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

@frassinier
Copy link
Contributor Author

Do we need another review, to be able to merge? 🤗

@frassinier frassinier requested a review from shilman January 17, 2020 10:32
@ndelangen ndelangen merged commit 9fe650b into storybookjs:next Jan 20, 2020
@shilman
Copy link
Member

shilman commented Jan 21, 2020

cc @domyen

@frassinier frassinier deleted the feat/addon-docs/colorpalette branch January 21, 2020 08:39
@domyen
Copy link
Member

domyen commented Jan 23, 2020

I didn't really get a chance to check this out in time (sorry everyone).

Some changes requests
The color names should be the same size as the hex colors. Add a 2px margin between the lines.
image

And this story's layout should not have changed because there are no color names included.

@frassinier
Copy link
Contributor Author

I'm sorry guys, I used to delete the branch once it's merged, I did not realize that demo disappears 😬
Dom, the story has changed because I removed an extra div.
Do you need a revert?

@ndelangen
Copy link
Member

No revert needed, but a follow up PR with @domyen's review comments applied would be great 🙇

@ndelangen
Copy link
Member

I invited you to the github org @frassinier, you should be able to directly commit on this repo now, no need for a fork.

@frassinier
Copy link
Contributor Author

Thanks, i'm out the office right now, I will do it on next Monday.

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

Successfully merging this pull request may close these issues.

8 participants