-
Notifications
You must be signed in to change notification settings - Fork 4
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
Use the new Framework API? #8
Comments
Thank you, @jonniebigodes, for your attention to my humble plugin! I'm sorry for the delay with the update. I haven't been able to upgrade all my projects yet, because some parts of the ecosystem aren't ready yet (Stencil). But so far, I'm ready to adapt this addon. Your documentation about the change of the
It appears, that you don't execute I'm trying a workaround "smuggling" data to |
The idea how to implement the custom sorting with Storybook 7:
// the shared sort implementation
import sortStories from 'storybook-multilevel-sort'
// the sort configuration
const storyOrder = { ... }
// make both identifiers above usable from storySort
globalThis['storybook-multilevel-sort'] = { sortStories, storyOrder }
export const parameters = {
options: {
storySort: (story1, story2) => {
const { sortStories, storyOrder } = globalThis['storybook-multilevel-sort']
return sortStories(storyOrder, story1, story2)
}
}
} It feels rather ugly, doesn't it? :-) I made the final interface a little nicer, which is described in the migration instructions. It can be tested with the package Alternatively, I could pass the configuration to export default {
addons: [
{
name: 'storybook-multilevel-sort',
options: {
storyOrder: { ... }
}
}
]
} If storySort(story1, story2, context) What do you think, @jonniebigodes? |
I wasn't able to write an addon encapsulating the custom sort. Consuming the sort configuration and exposing the const storyOrder = { ... }
export default {
addons: [
{ name: 'storybook-multilevel-sort', options: { storyOrder } }
]
} However, I couldn't figure out how to supply the export default {
parameters: {
options: {
storySort: (story1, story2) =>
globalThis['storybook-multilevel-sort:storySort'](story1, story2)
}
}
} If I can't figure it out, I'll abandon the idea of an addon interface (#11) and merge the pure functional interface to be called in |
I merged the #10 and released 2.0.0 to allow upgrading to Storybook 7 now. The interface remains functional as it was in versions 1.x. The new limitation of Storybook 7 needs modifying both I'd still like to simplify the interface by converting this package to a Storybook addon. I've kept the half-way conversion in #11 to be able to explore the possibilities in the future. |
Hi, @prantlf can you plz share some update on this one? |
Yes, I can, @jrencz. My previous comment was probably not clear. So:
I'm not happy with the Storybook 7 API, which makes writing addons like this more difficult than the Storybook 6 API, and users of this addon need to edit two configuration files instead of one. But it doesn't mean that the currently available solution doesn't work. |
Hey @prantlf !
I'm one of the Storybook maintainers. I focus primarily on documentation and community outreach. I'm opening up this issue and letting you know that the Storybook API for building addons is currently being updated to factor in the changes introduced by the upcoming 7.0 release. If you're interested in making the required changes to help the community from benefiting from using your addon, we've prepared an abridged guide for the required changes here, and if you have any questions or issues, please reach out to us in the #prerelease channel in our Discord Server.
Hope you have a great day!
Stay safe
The text was updated successfully, but these errors were encountered: