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

Export stories as components #2570

Closed
asudoh opened this issue Nov 6, 2018 · 22 comments
Closed

Export stories as components #2570

asudoh opened this issue Nov 6, 2018 · 22 comments
Labels
package: react carbon-components-react proposal: accepted This request has gone through triaging and we are accepting PR's against it. type: enhancement 💡

Comments

@asudoh
Copy link
Contributor

asudoh commented Nov 6, 2018

This issue is for tracking the effort of exporting Storybook story code as React components.

CC @jendowns

Summary/Justification

Some business units have created a design system based on Carbon. For such Carbon-based design systems, they have their own storybook but want to use some stories from Carbon.

Detailed design and usage example

This effort introduces modules like:

export default ({ ...props }) => (
  <div>
    <Button {...props} className="some-class">
      Button
    </Button>
    <Button {...props} href="#" className="some-class">
      Link
    </Button>
  </div>
);

Using that, Carbon-based design system can create a story like:

import ButtonStory from '/path/to/button-story';

storiesOf('Buttons', module)
  .add(
    'Default',
    () => (<ButtonStory data-foo="Foo" />));

Specific timeline issues / requests

N/A

@SimonFinney
Copy link
Contributor

@asudoh Thanks for putting this together - is there any chance of prioritizing this in the near future?

@stale
Copy link

stale bot commented May 1, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. Thanks for your contributions.

@asudoh
Copy link
Contributor Author

asudoh commented May 2, 2019

Keeping with maintainer's interest.

@carbon-bot carbon-bot transferred this issue from carbon-design-system/carbon-components-react May 9, 2019
@carbon-bot
Copy link
Contributor

Hi there! 👋 If you're wondering why this issue was moved, we're currently updating our repo structure so that every package is found in the same project.

This should not have any impact for you, but we wanted to give you a heads up in case you were wondering what is going on. If you have any questions, feel free to reach out to us on Slack or contact us at: [email protected]. Thanks!

@stale
Copy link

stale bot commented Jun 13, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

@stale stale bot added the status: inactive Will close if there's no further activity within a given time label Jun 13, 2019
@jendowns
Copy link
Contributor

jendowns commented Jun 13, 2019

Could we keep this open please? Would love to be able to import stories into our addons library 🤩

@stale stale bot removed the status: inactive Will close if there's no further activity within a given time label Jun 13, 2019
@tay1orjones
Copy link
Member

We'd also like to see this for use in our Watson IoT addons.

Instances where we are simply wanting to render the story as-is, I have found that we can import the story from node_modules and then re-export it from a story file in our project. There's some oddities with story source rendering and prop tables, but gives us a starting point.

Something we'd like to do in our storybook is divide "stock" carbon components (re-exported components without modifications) from "extended/custom" components via the hierarchySeparator. This currently isn't possible as there isn't a way to modify the story name.

@stale
Copy link

stale bot commented Jul 27, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

@stale stale bot added the status: inactive Will close if there's no further activity within a given time label Jul 27, 2019
@jendowns
Copy link
Contributor

Please keep this open 🙏

@stale stale bot removed the status: inactive Will close if there's no further activity within a given time label Jul 28, 2019
@tay1orjones
Copy link
Member

Storybook's new Component Story Format should provide a path to portable stories once v5.2 is stable.

@stale
Copy link

stale bot commented Aug 29, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

@stale stale bot added the status: inactive Will close if there's no further activity within a given time label Aug 29, 2019
@jendowns
Copy link
Contributor

Please keep this open 🙏

@stale stale bot removed the status: inactive Will close if there's no further activity within a given time label Aug 29, 2019
@tw15egan
Copy link
Collaborator

Keeping an eye on https://github.com/storybookjs/storybook/releases for a stable 5.2 👀

@tay1orjones
Copy link
Member

5.2 is out! 🎉

@stale
Copy link

stale bot commented Oct 16, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

@stale stale bot added the status: inactive Will close if there's no further activity within a given time label Oct 16, 2019
@tay1orjones
Copy link
Member

tay1orjones commented Oct 16, 2019

Please keep this open 🙏

Storybook was recently updated to 5.2 in #4192. Are there any required items beyond refactoring stories to CSF and exporting them?

@stale stale bot removed the status: inactive Will close if there's no further activity within a given time label Oct 16, 2019
@asudoh
Copy link
Contributor Author

asudoh commented Oct 17, 2019

Weighing in; I've been under an impression that CSF is designed for static stories. Most of our stories OTOH are parameterized via knobs.

@tay1orjones
Copy link
Member

Everything in the storiesOf API has a direct equivalent in CSF. It works with all the official addons, including knobs. Example from the react storybook

@stale
Copy link

stale bot commented Nov 22, 2019

We've marked this issue as stale because there hasn't been any activity for a couple of weeks. If there's no further activity on this issue in the next three days then we'll close it. You can keep the conversation going with just a short comment. Thanks for your contributions.

@stale stale bot added the status: inactive Will close if there's no further activity within a given time label Nov 22, 2019
@tay1orjones
Copy link
Member

I can help refactor some stories if there's an agreed upon direction. Storybook also has some codemods we could take advantage of to assist with the process.

@stale stale bot removed the status: inactive Will close if there's no further activity within a given time label Nov 24, 2019
@asudoh
Copy link
Contributor Author

asudoh commented Nov 24, 2019

Hi 👋 thank you for your willingness for contribution! The biggest thing is making story exports don't run knob code, so those reused stories can run without knobs. While I still don't find any official direction from Storybook team on this front, putting knob setup code in story parameters and evaluating such knobs in story parameters in a decorator would be one idea.

@abbeyhrt abbeyhrt added the proposal: open This request has gone through triaging. We're determining whether we take this on or not. label Jan 22, 2020
@dakahn dakahn added proposal: accepted This request has gone through triaging and we are accepting PR's against it. and removed proposal: open This request has gone through triaging. We're determining whether we take this on or not. labels Apr 10, 2020
@joshblack
Copy link
Contributor

Closed by #6663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: react carbon-components-react proposal: accepted This request has gone through triaging and we are accepting PR's against it. type: enhancement 💡
Projects
None yet
Development

No branches or pull requests

10 participants