catalog icon indicating copy to clipboard operation
catalog copied to clipboard

Specimen plugins

Open jstcki opened this issue 6 years ago • 3 comments

It's currently possible to add your own specimens but I'm not super-happy with the current implementation and therefore the API that is exposed. I'm opening this issue as for tracking progress on this feature.

This is on top of our priority list because people keep asking for new Specimens or even make pull requests to add them. Rather than adding more Specimens to Catalog core, I'd like to build the Specimen API in a way that is flexible enough for the various use cases and document how to do it. This way, we don't bloat Catalog with more functionality that only a part of its users need and can enable a Specimen ecosystem that is built by the community.

jstcki avatar May 19 '18 13:05 jstcki

Let me know if there's anything I can do to help on this. I'm looking into making a specimen right now but if I can use my time making it easier to make one, I'd rather do that.

mattfelten avatar Jun 26 '18 20:06 mattfelten

@herrstucki I couldn't find anything about adding custom specimens in the docs :/ Did I just miss it or is there another issue that describes how to do that?

Update

I just clicked through the issues referenced above and found the following:

There is currently no official documentation on how to register custom specimen.

However there is a way to specify custom specimens:

It's already possible to add custom Specimens. It's just not documented yet 😅

The simplest form of it is this:

<Catalog specimens={{storybook: StoryBookSpecimen}} />

The YAML/JSON config from the Specimen inside the Markdown maps directly to a Specimen's props.

There's a Specimen higher-order component to provide layout and theme info to custom Specimens. You may not need to use that to prototype something.

See https://github.com/interactivethings/catalog/issues/342#issuecomment-350840275 and https://github.com/interactivethings/catalog-docs/issues/7

jneuendorf avatar Sep 25 '18 12:09 jneuendorf

@herrstucki Any progress on this?

I recently added a custom Specimen for React propTypes that I think would be a good candidate for this.

Bmgaynor avatar Dec 26 '18 21:12 Bmgaynor