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

Feature Request: Pass boolean to the storyFn when being run by puppeteer #105

Closed
nickradford opened this issue Feb 15, 2019 · 1 comment · Fixed by #133
Closed

Feature Request: Pass boolean to the storyFn when being run by puppeteer #105

nickradford opened this issue Feb 15, 2019 · 1 comment · Fixed by #133

Comments

@nickradford
Copy link

Disclaimer: Love this project, combined with reg-suit, it's amazing.

It would be very nice if during the execution of storybook-chrome-screenshot, the withScreenshot decorator would pass a boolean to the story, which can be used to determine properties to pass to your components. An example would be if I were using the material UI tooltip in some of my UI, and I wanted it to be open in the screenshot pass, but not when I normally use storybook.

storiesOf('SomeComponent', module)
  .add('this one is showing tooltips open', withScreenshot()(props =>(
    <Tooltip open={props.isScreenshot} title="Can't do that now">
      <Button>Disabled</Button>
    </Tooltip>
  ))
@Quramy
Copy link
Member

Quramy commented Oct 21, 2019

I added the function isScreenshot to get whether the current process is in the screenshot browser:

import { isScreenshot } from 'storycap';

storiesOf('SomeComponent', module)
  .add('this one is showing tooltips open', withScreenshot()(props =>(
    <Tooltip open={isScreenshot()} title="Can't do that now">
      <Button>Disabled</Button>
    </Tooltip>
  ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants