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

UI: Add viewMode parameter to control story nav UI #9090

Merged
merged 7 commits into from
Jan 28, 2020

Conversation

atanasster
Copy link
Member

Issue: #8630

What I did

  • Handling of viewMode parameter in the sidebar links
  • Added parameters to the MDX stories (until now MDX were not receiving parameters in the story store)

How to test

The subcomponents.story (Addons/Docs/ButtonGroup) will default its anchor to the docs tab

@vercel
Copy link

vercel bot commented Dec 7, 2019

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/24efd6pvp
🌍 Preview: https://monorepo-git-fork-atanasster-viewmode-parameter.storybook.now.sh

@stale
Copy link

stale bot commented Jan 10, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jan 10, 2020
@stale stale bot removed inactive labels Jan 28, 2020
@shilman shilman changed the title viewMode parameter UI: Add viewMode parameter for controlling a story link's view mode Jan 28, 2020
@shilman shilman changed the title UI: Add viewMode parameter for controlling a story link's view mode UI: Add viewMode parameter to control story link's view mode Jan 28, 2020
@shilman shilman changed the title UI: Add viewMode parameter to control story link's view mode UI: Add viewMode parameter to control story nav UI Jan 28, 2020
@shilman
Copy link
Member

shilman commented Jan 28, 2020

@atanasster thanks for figuring this out--will make a bunch of users happy. i cleaned up the code slightly and added tests/documentation.

@atanasster
Copy link
Member Author

Thanks, one down.... :)

@shilman shilman merged commit 21a4592 into storybookjs:next Jan 28, 2020
@shilman shilman deleted the viewmode-parameter branch January 28, 2020 06:18
@LarsDenBakker
Copy link
Contributor

This is great! Thanks!

@wagerfield
Copy link

wagerfield commented Mar 3, 2020

This is not working for me. I've tried:

  1. Setting viewMode in the preview/manager via addParameters
// .storybook/preview.js
import { addParameters } from "@storybook/react"

addParameters({ viewMode: "docs" })
  1. In a story file's CSF meta export:
// src/componenets/component.stories.js

export default {
  title: "Components/Component",
  parameters: {
    viewMode: "docs"
  }
}
  1. On a story's meta/config object:
// src/componenets/component.stories.js

const ComponentStory = () => <Component />

ComponentStory.story = {
  parameters: {
    viewMode: "docs"
  }
}

...none of these variations are working for me?

I'm using the latest version (5.3.14) of Storybook and the official addons inc. docs.

@shilman
Copy link
Member

shilman commented Mar 4, 2020

@wagerfield this is a 6.0 feature

@wagerfield
Copy link

Thanks @shilman, I've upgraded to @next and it's working like a charm :D

@marchaos
Copy link

marchaos commented Apr 13, 2020

I can't get this to work on the latest alpha (31). Checking here https://next--storybookjs.netlify.com/official-storybook/?path=/story/addons-docs-buttongroup--basic and it does not seem to work either. Can you confirm this?

EDIT: looks already to be captured here - #9723

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.

5 participants