-
Notifications
You must be signed in to change notification settings - Fork 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: Add required styles for @automattic/components
#98289
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
Some components require CSS styles from `@wordpress/components`, which you will need to load in order for them to appear correctly. Within WordPress, add the `wp-components` stylesheet as a dependency of your plugin's stylesheet. See [wp_enqueue_style documentation](https://developer.wordpress.org/reference/functions/wp_enqueue_style/#parameters) for how to specify dependencies. | ||
|
||
In non-WordPress projects, import the `build-style/style.css` file directly, located at `node_modules/@wordpress/components/build-style/style.css`. |
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.
Thank you for adding this explanation, very much needed IMO
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.
A nice step towards correctly working on these components in isolation! 🚀
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.
Related to #76007 #75167
Proposed Changes
Add required stylesheets for the isolated
@automattic/components
Storybook.Why are these changes being made?
@automattic/components
needs to be usable in other A8C applications, not just in thiswp-calypso
repo. That means we need to ensure that component styles are sufficiently encapsulated for a non-Calypso consumer.The current root-level Storybook loads a lot of stylesheets, including styles for the Calypso client and others that are not documented as required in the
@automattic/components
README. This makes it impossible to verify that@automattic/components
is shipping with sufficient styles/instructions to render reliably in other environments.Testing Instructions
yarn workspace @automattic/components run storybook
and see that some components (e.g.Button
orSearchableDropdown
) and see that they are rendering closer to how they are intended.Note that some styles are still missing — we'll need to start identifying them and filling the gaps. We'll need to figure out how to design our Storybook tooling so we can test that they render reliably in different environments.
Pre-merge Checklist