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

Storybook: Make sure that subcomponents are properly documented #53541

Open
1 of 18 tasks
mirka opened this issue Aug 10, 2023 · 6 comments
Open
1 of 18 tasks

Storybook: Make sure that subcomponents are properly documented #53541

mirka opened this issue Aug 10, 2023 · 6 comments
Labels
[Package] Components /packages/components Storybook Storybook and its stories for components [Type] Developer Documentation Documentation for developers

Comments

@mirka
Copy link
Member

mirka commented Aug 10, 2023

Storybook 7 (#53520) does not support the display of subcomponents in the props tables, so they had to be removed.

We should go through the affected components and make sure that they are appropriately documented in some way or another. Simple subcomponents may be sufficiently documented just as a story of the parent component (e.g. DropdownContentWrapper). More complex subcomponents may warrant their own story pages. Maybe there are other ways as well.

Affected subcomponents

  • AlignmentMatrixControl.Icon
  • CardHeader, CardBody, CardDivider, CardMedia, CardFooter
  • CircularOptionPicker.Option, CircularOptionPicker.ButtonAction, CircularOptionPicker.DropdownLinkAction
  • DropdownMenuItem, DropdownSubMenu, DropdownSubMenuTrigger, DropdownMenuSeparator, DropdownMenuCheckboxItem, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem
  • DropdownContentWrapper
  • FlexBlock, FlexItem
  • InputControlPrefixWrapper, InputControlSuffixWrapper
  • Item (in ItemGroup)
  • NavigationBackButton, NavigationGroup, NavigationItem, NavigationMenu
  • NavigatorScreen, NavigatorButton, NavigatorBackButton
  • NoticeList
  • PanelRow, PanelBody
  • Radio
  • Fill, SlotFillProvider
  • ToggleGroupControlOption, ToggleGroupControlOptionIcon
  • ToolbarButton, ToolbarGroup, ToolbarItem, ToolbarDropdownMenu
  • ToolsPanelItem
  • TreeGridRow, TreeGridCell
@mirka mirka added [Type] Developer Documentation Documentation for developers [Package] Components /packages/components Storybook Storybook and its stories for components labels Aug 10, 2023
@bangank36
Copy link
Contributor

If the subcomponents are included as the parent's story, then it won't make sense if someone visits its story page, eg:AlignmentMatrix.Icon has the main component controls only

More complex subcomponents may warrant their own story pages

I think this suggestion make sense, and the sidebar layout can be like

Another approach is customize the docs.page prop to create a custom docs page with argsTable and bring back the subcomponents
@psui preview.tsx / HoverCard stories

@mirka
Copy link
Member Author

mirka commented Aug 16, 2023

More complex subcomponents may warrant their own story pages

I think this suggestion make sense, and the sidebar layout can be like

Yes, I think this is the way to go.

Another approach is customize the docs.page prop to create a custom docs page with argsTable and bring back the subcomponents @psui preview.tsx / HoverCard stories

I wasn't aware of this thing, thanks. I tried it out in #53751 but realized it would remove the Controls from the Docs pages. I'm a bit hesitant to go through with this now, because I feel like it would be worse for the overall developer experience 😅

@bangank36
Copy link
Contributor

bangank36 commented Aug 16, 2023

but realized it would remove the Controls from the Docs pages

FYI, you will need the prop story for ArgsTable to show controls for the main story, you can explicitly set its value as

<ArgsTable story="^" />

or import PRIMARY_STORY from addon-docs

{
     PRIMARY_STORY
 } from '@storybook/addon-docs';
<ArgsTable story={PRIMARY_STORY} />

Found similar usage in equinor/design-system, they used a PropsTable in mdx stories. Example Navigation-tabs stories

Recording
chrome-capture-2023-7-17

@mirka
Copy link
Member Author

mirka commented Aug 18, 2023

@bangank36 It worked 😱 #53751

@bangank36
Copy link
Contributor

It worked

💯
Personally, I think it is hard to find the full list of support props for this component 😓
PS: I think you meant ArgsTable not ArgsTypes? #53751 (comment)

@mirka
Copy link
Member Author

mirka commented Aug 18, 2023

PS: I think you meant ArgsTable not ArgsTypes? #53751 (comment)

You're right, I was just reading the v6 to v7 migration docs and got them mixed up 🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components Storybook Storybook and its stories for components [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

No branches or pull requests

2 participants