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

Detect which view is the active view (i.e. view === "canvas") #8474

Closed
jonathanloske opened this issue Oct 18, 2019 · 3 comments
Closed

Detect which view is the active view (i.e. view === "canvas") #8474

jonathanloske opened this issue Oct 18, 2019 · 3 comments

Comments

@jonathanloske
Copy link

Is your feature request related to a problem? Please describe.
I'm trying to set up a part of a story that should only show up when in Docs view because it does not make sense in other views.

Describe the solution you'd like
Inside my .stories file, I would like to be able to determine whether the current view is the docs view. Optimally, I would like something like this:

storiesOf("MyComponent", module)
	.add("test", (context) => {
		if (context.view === "canvas") {
			// something awesome
		}
	});

Describe alternatives you've considered
In my case, I have the option of foregoing the Canvas view altogether and just write an MDX file

Are you able to assist bring the feature to reality?
if I get some setup help, I'll gladly help :)

Additional context
// none

@shilman
Copy link
Member

shilman commented Sep 24, 2020

@yannbf can this be closed with a link to the documentation?

@yannbf
Copy link
Member

yannbf commented Sep 24, 2020

Hey @shilman not yet because the functionality and documentation is here as part of an open PR, but as soon as it's merged then yes 💃

@shilman
Copy link
Member

shilman commented Sep 24, 2020

Fixed in #12566 and released in 6.1.0-alpha.15. Closing!

@shilman shilman closed this as completed Sep 24, 2020
@shilman shilman added this to the 6.1 maintenance milestone Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants