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

Styleguide / MDX examples #84

Open
3 tasks
shilman opened this issue Oct 6, 2019 · 8 comments
Open
3 tasks

Styleguide / MDX examples #84

shilman opened this issue Oct 6, 2019 · 8 comments
Labels
documentation Changes only affect the documentation

Comments

@shilman
Copy link
Member

shilman commented Oct 6, 2019

Storybook 5.3 will include official MDX support and we should incorporate more of that into the design system. Specifically:

  • Introduction - add a kitchen sink example story?
  • Styleguide / design tokens
  • Convert one component from DocsPage to MDX as an example?

More ideas welcome.

@shilman shilman added the documentation Changes only affect the documentation label Oct 6, 2019
@leerob
Copy link
Collaborator

leerob commented Oct 7, 2019

I'm happy to pick this one up with some more details 👍

@domyen
Copy link
Member

domyen commented Oct 9, 2019

Great idea, I think there are low hanging fruits that we could use a hand on @leerob. 🙏

Color documentation
Replace color story with MDX docs-only page that features the ColorPalette DocBlock.
image

Typography documentation
Replace typography story with MDX docs-only page that features the Typeset DocBlock.
image

Table of Components page
Add a “Table of Components” MDX page that shows component status (inspired by Shopify). The 3 columns we'd have Component, Code, Documentation which indicates the component status. For instance:

Component Code Documentation
Avatar ✅Complete(link to component) ✍️In progress
AvatarList ✅Complete(link to component) Need assistance

Open to different ideas here and co-designing this feature with you. Perhaps it should also include versions?

Create Do's and Don's component
Showcasing how to use and not use components is a frequent part of UI documentation. It would be useful for us to show what not to do. For example, some components feature a11y gotchas that our client apps must consider. The do's and don'ts component should be able to take a code snippet, regular text, or an image. I'm also keen to co-design this feature if you're up for it!

@leerob
Copy link
Collaborator

leerob commented Oct 12, 2019

Starting to look into this now. A few questions:

  • The image linked above for the colors shows all the different opacity permutations. Those don't appear to used currently in the design system. Should those values be exported for consumers, or just on display in the story? If the former, I would include the hex values. If the latter, maybe the consumer would be using something lighten?
  • There are some discrepancies between that image and the current variables in the shared styles.js. For example - tertiary is turquoise there but grey in the design system. Which is the source of truth?

Here's the current status of my WIP:
Screen Shot 2019-10-11 at 8 56 14 PM

import { Meta, ColorPalette, ColorItem } from '@storybook/addon-docs/blocks';

import { color } from './shared/styles';

<Meta title="Design System|Colors" />

# Colors

<ColorPalette>
  <ColorItem title="theme.color.primary" subtitle="Coral" colors={[color.primary]} />
  <ColorItem title="theme.color.secondary" subtitle="Blue" colors={[color.secondary]} />
  <ColorItem title="theme.color.tertiary" subtitle="Grey" colors={[color.tertiary]} />
  <ColorItem title="theme.color.positive" subtitle="Green" colors={[color.positive]} />
  <ColorItem title="theme.color.warning" subtitle="Ochre" colors={[color.warning]} />
  <ColorItem title="theme.color.negative" subtitle="Red" colors={[color.negative]} />
  <ColorItem title="theme.color.orange" subtitle="Orange" colors={[color.orange]} />
  <ColorItem title="theme.color.gold" subtitle="Gold" colors={[color.gold]} />
  <ColorItem title="theme.color.seafoam" subtitle="Seafoam" colors={[color.seafoam]} />
  <ColorItem title="theme.color.purple" subtitle="Purple" colors={[color.purple]} />
  <ColorItem title="theme.color.ultraviolet" subtitle="Ultraviolet" colors={[color.ultraviolet]} />
  <ColorItem
    title="Monochrome"
    colors={[
      color.darkest,
      color.darker,
      color.dark,
      color.mediumdark,
      color.medium,
      color.mediumlight,
      color.light,
      color.lighter,
      color.lightest,
    ]}
  />
</ColorPalette>

@domyen
Copy link
Member

domyen commented Oct 16, 2019

Hey @leerob, this is awesome! There was a miscommunication error on my part. I sent over the image of the component to show what it looks like not to ask you to achieve the same result. So no worries about being accurate to the image.

We're not intending to ship the shades to design system consumers. The shades are there to show what's possible. Consumers can use polished to lighten the colors but it's not a requirement. In the design the opacity scale is 100%, 80%, 60%, 30%.

As far as names and values go, the code is the source of truth.

image

Same goes for the type scale:
image

@leerob
Copy link
Collaborator

leerob commented Oct 17, 2019

Gotcha! Thanks for the extra info. I'll get a PR up for the colors/typography.

For the components, we could definitely do an MDX page. However, it could get out of sync quickly.

import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="Design System|Components" />

# Table of Components

| Component  | Code                                                                        | Documentation   |
| ---------- | --------------------------------------------------------------------------- | --------------- |
| Avatar     | ✅Complete ([View Component](/?path=/docs/design-system-avatar--large))     | ✍️In progress   |
| AvatarList | ✅Complete ([View Component](/?path=/docs/design-system-avatarlist--short)) | Need assistance |

Screen Shot 2019-10-16 at 8 48 21 PM

A better solution might be:

  • Modifying CSF to include this information
  • Creating a ComponentStatus DocBlock that would parse the stories loaded

For example, the Button component. Maybe the CSF looks like this:

export default {
  title: 'Design System|Button',
  component: Button,
  codeStatus: COMPLETE,
  docsStatus: IN_PROGRESS
};

There could be an enum with statuses like COMPLETE, IN_PROGRESS, and NEEDS_ASSISTANCE to denote the different states.

The DocBlock could then parse all of the stories and dynamically build the markdown table.

With that being said... that's a lot more work than just putting together a quick MDX file. Should we go forward with that hand-rolled MDX file for now and maybe consider a custom DocBlock if more people would find it valuable?

@shilman
Copy link
Member Author

shilman commented Oct 17, 2019

@leerob I agree with a status doc block longer term, and that short-term the custom MDX is a nice demo of capabilities 👍

I'd like to formalize the notion of a doc block either later in 5.3 or in 5.4, so the status block would be a nice example to use in that conversation.

@domyen
Copy link
Member

domyen commented Oct 17, 2019

I think the easier, more manual option is awesome for now!

@bsgreenb
Copy link

It would be nice if you could supply names as well as hex codes to each color column. Otherwise to get labeling for each you need to create a new row.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes only affect the documentation
Projects
None yet
Development

No branches or pull requests

4 participants