-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Update: Use gradient classes in cover block #18590
Update: Use gradient classes in cover block #18590
Conversation
@@ -34,6 +36,8 @@ export default function save( { attributes } ) { | |||
minHeight, | |||
} = attributes; | |||
const overlayColorClass = getColorClassName( 'background-color', overlayColor ); | |||
const gradientClass = __experimentalGetGradientClass( gradient ); |
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.
__experimentalGetGradientClass and getColorClassName
Some naming inconsistencies here :) Also when do you think we should make the "gradients" stable?
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.
__experimentalGetGradientClass and getColorClassName
Some naming inconsistencies here :)
Hopefully, it is experimental so we can correct the inconsistency.
Also when do you think we should make the "gradients" stable?
I think first we should merge the custom gradient picker, and stabilize its UI.
It seems we may end up with tabs to separate solid colors and gradients as @mtias suggested #17603 (comment).
When we go for that design a gradient hook may not make sense and it may be better to add gradient support in the colors hook (essentially move the hook we have now into useColors) so we can return the tabbed UI there and remove the need for blocks to add it.
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.
agreed about the hooks, but for the theme support, I think we can probably remove the experimental flag from there unless you think the format is subject to change?
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.
LGTM 👍
Description
This PR makes cover block use gradient classes. It was not possible to do it from the start because the block needed to be refactored into a functional component.
cc: @youknowriad
How has this been tested?
I added a cover block with a simple gradient background.
I added a cover block with an image and gradient overlay.
I added a video block with an image and gradient overlay.
I published the post with the three blocks and verified it looked as expected. On the code editor, the editor used classes and not inline styles to specify the gradient.