Skip to content
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

Merged
merged 1 commit into from
Nov 19, 2019

Conversation

jorgefilipecosta
Copy link
Member

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.

@jorgefilipecosta jorgefilipecosta added [Type] Enhancement A suggestion for improvement. [Block] Cover Affects the Cover Block - used to display content laid over a background image labels Nov 18, 2019
@@ -34,6 +36,8 @@ export default function save( { attributes } ) {
minHeight,
} = attributes;
const overlayColorClass = getColorClassName( 'background-color', overlayColor );
const gradientClass = __experimentalGetGradientClass( gradient );
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jorgefilipecosta jorgefilipecosta merged commit 99dd0ee into master Nov 19, 2019
@jorgefilipecosta jorgefilipecosta deleted the update/use-gradient-classes-in-cover-block branch November 19, 2019 12:32
@youknowriad youknowriad added this to the Gutenberg 7.0 milestone Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants