carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.74k stars 1.79k forks source link

Ensure playground stories have working controls #10751

Closed tay1orjones closed 1 year ago

tay1orjones commented 2 years ago

Every component in the storybook sidebar should have a Playground story, those stories should have operable controls.

High level checklist for each component:

FAQ:

Checklist

joshblack commented 2 years ago

Process

export default {
  // ...
  parameters: {
    // ...
    controls: {
      hideNoControlsWarning: true,
    },
  },
  argTypes: {
    children: {
      table: {
        disable: true,
      },
    },
  },
};

How-to's

Questions

Observations

Approaches

joshblack commented 2 years ago

Goals

Options

Questions

What's done in the industry?

Preferences


Options

TannerS commented 1 year ago

Just an fyi @tay1orjones and @tw15egan I am handling

Ensure there is a playground story
Add argtypes to playground story

For TextInput in this pr => https://github.com/carbon-design-system/carbon/pull/12139

I also plan to open a pr to help out with more of these soon

tw15egan commented 1 year ago

Thanks @TannerS!

TannerS commented 1 year ago

I had a question for the team. here is a screenshot with numbers relating to my quesitons

image

1) When i see something like this (a task and a subtask of that task with two type of story files)

 components/Pagination/Pagination-story.js
    components/Pagination/next/Pagination.stories.js

does that mean too do both files? they both need playgrounds?

2) A lot of these components have a Default set up that basically has all the args and argtypes set up, i find myself basically duplicating these for a "playground". I am curious if this is ok or are the defauts suppose to be replaced. One example is pagination. once i understand intent i can improve my ongoing PR

3) do I need to only do storys in the next folder?

4) Some components like the Form and others, have no props for a playground, like this one has onlye classname and children. Technically for a playground class and children dont make much sense since u cant see anything or pass in a control with jsx but they are on the list. How should these be handled?

thanks in advance

cc: @tay1orjones @tw15egan @abbeyhrt

aledavila commented 1 year ago

@TannerS

  1. We are removing -story.js and replacing it with whats in the next folder. All files in next must move into the root component folder and the next folder deleted.
  2. Default is the main story that shows all of the component props with no controls. Controls only go in playground stories.
  3. see 1
  4. If there are no props that a user can play around with like form then you can omit the playground and do not enable controls.