SDK: refactor todo-extension styles #26777
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To better understand what kind of flexibility blocks might need with their CSS, I looked into todo block.
Some problems, questions and possible solutions:
Importing two color definition files
Imports Calypso color variables for
$green-text-min
and Gutenberg color variables for the rest.💥 It's unclear just by looking at the file where each variable came from
💥 Variable names have collisions
💡Unify into one source of truth; there should be only one colour definition file.
💡Prefix colour variables.
$calypso__white
or$gutenberg__white
. Since the latter one comes from NPM module, suppose it's the Calypso ones that we would prefixBlock needs CSS selectors from the editor
The block has CSS like this:
💥 The block wrapper cannot always be the highest CSS selector
💥 While full Gutenberg editor might have
.editor-block-list__block.is-typing
classes, can we ensure we have these available in Calypso?💡 Stay flexible — don't wrap/prefix everything in the build. CSS prefixing needs to be manual; possibly enforced by a linter so that it's possible to turn it off when needed.
💡 Some of these cases in this extension can probably be baked out by adding CSS resets and improving the specificity of CSS selectors, but not all.
P2 specific styling
The block has some styling that's meant only for P2s.
💥 P2 specific styling ships to all environments (wp-admin, Calypso etc)
💥 Nothing about
body:not( .wp-admin ) .gutenberg
really says it's P2 specific. That could very well be Calypso, too.💡 Preferably get rid of any needs for environment specific styling and use themes for things that need to be themed (e.g. Jetpack branding)
💡 Conditionally include styles depending on the target environment. Not ideal.
Testing
Build the block:
Load the files in the Gutenberg and confirm that the block works.