-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Storybook: Try to integrate the playground into Storybook #18191
Conversation
2650d14
to
426dfd1
Compare
@gziolo Thank you for getting this started 😍 . |
Feel free to push as many commits as necessary to make it shine :) |
@gziolo It works! 😍 |
ec71b63
to
1c440e1
Compare
This should be ready for review. I updated docs in 1c440e1 to replace occurrences of the playground with Storybook. See: I also decided to keep the old output folder and npm script aliases for the playground as it integrates with Netlify. @epiqueras, what is necessary to adjust it on Netlify side? We can do it at the very end or in a follow-up PR. Whatever you prefer. |
8876623
to
7fae32c
Compare
Link to Netlify: |
It's possible to see the source with 37aee14: |
@gziolo We can add a netlify.toml so that this can be changed with code instead of having to ping me to log in to the dashboard. |
It would be great 👍 It isn't a blocker for this PR but definitely nice to have as a quick follow-up. |
37aee14
to
2a40755
Compare
@ItsJonQ - do you think it’s fine to move forward with this proposal? Did I miss anything? |
@gziolo Yes! I think this is fantastic ! Thank you so much for doing this 🙏 |
@youknowriad do you have any concerns? I plan to merge it on Monday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this, I think we can probably get rid of the "Gutenberg Playground" header and consolidate all components under the "Components" section (Modal, FontSizePicker)
enforce: 'pre', | ||
}, | ||
{ | ||
test: /\.scss$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory we could avoid this by loading the produced CSS like we do for the components. I feel we should consolidate on one way of loading styles in Storybook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ItsJonQ - I guess this is a good follow-up to decide how we tackle CSS in Storybook.
}; | ||
|
||
export const _default = () => { | ||
registerCoreBlocks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's probably better to wrap in useEffect( , [])
to only run on mount?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fun part is that this exported function can't take hooks as it isn't a component but some special method that wraps stories. Anyway, we probably move it to App
and define as an effect there, I will give it a spin 👍
2a40755
to
74148c6
Compare
Thanks @gziolo |
Unrelated to this PR, but any chance anyone would know what dependencies I need for the Gutenberg editor in a different context? I'm trying to display it on a custom admin page, rendering the sameish thing as this story: <SlotFillProvider>
<DropZoneProvider>
<BlockEditorProvider>
<WritingFlow>
<ObserveTyping>
<BlockList />
</ObserveTyping>
</WritingFlow>
</BlockEditorProvider>
</DropZoneProvider>
</SlotFillProvider> The editor works, but the Image block does not allow to upload media (even if I run |
Same issue here with a FSE theme! Opening the site editor briefly shows the template parts, but then those template parts are replaced by blocks with error and this is logged:
Edit: This happens when the theme uses as block template or block part with HTML that has no block-specific comments. Then a TinyMCE block is used for this HTML, which currently fails to load in this specific case. |
Description
Part of #17973.
This PR explores how likely it is that the playground could work inside Storybook.
So far, I'm positive, I have found two issues but I guess they are both solvable. I need to play a bit more with the version that is controlled by Parcel as I see that some core blocks explode after they get inserter, e.g. Heading. This is more concerning.- all issues discovered are resolved now and the one about broken blocks isn't related to this PR.Updated docs:
https://github.com/WordPress/gutenberg/blob/1c440e1805f354ecc5d7d8e2deaf977013473755/docs/contributors/getting-started.md#storybook
How has this been tested?
npm run storybook:dev
npm run storybook:build
Screenshots
Known issues
All of them are resolved now 🎉
Many blocks explode just after they get inserted, it needs to be further investigatedsee Storybook: Try to integrate the playground into Storybook #18191 (comment), this isn't related to Storybook at allparcel
needs to be removed as it becomes obsolete with all these effortsChecklist: