-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Tag Cloud Block: Add outline style #37092
Conversation
Size Change: +426 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
|
||
&.is-style-pill a { | ||
border: 1px solid var(--wp--preset--color--foreground); | ||
border-radius: 5px; |
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.
Does this need to be hard-coded?
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.
We could make it a block attribute, but it wouldn't do anything unless this style was used.
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.
It should only show up if the style is being used. We can also not set it to anything and let themes customize it for now.
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.
Using a custom variable in theme.json?
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.
No, the theme can just target it with CSS directly if they want to
border: 1px solid var(--wp--preset--color--foreground); | ||
border-radius: 5px; | ||
font-size: var(--wp--preset--font-size--normal); | ||
margin-bottom: 10px; |
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.
We might want to use some factor of block gap here.
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.
Can it be a percentage so that if font-size is changed it works? Same for padding.
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 don't think a percentage will work, but I updated it to use ch
units which does. See the update screenshots above...
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.
Sweet!
@@ -18,4 +18,18 @@ | |||
margin-left: 5px; | |||
text-decoration: none; | |||
} | |||
|
|||
&.is-style-pill a { |
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.
Should we remove the underline in this case?
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.
Yeah, I don't think an underline is necessary.
&:active, | ||
&:hover { | ||
background-color: var(--wp--preset--color--foreground); | ||
color: var(--wp--preset--color--background); |
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.
These variables don't exist by default, unfortunately.
I'm not sure that we can specify a nice reversed-out hover state without tackling WordPress/twentytwentytwo#99 first.
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 think we can avoid hover effects here
I like this — it's a more modern version of a tag cloud. I think the only issue with it is figuring out how it could be implemented in a way that's lightweight and flexible enough to work out of the box for many themes. The current approach feels a bit too hardcoded to me. |
b69a1d0
to
386c9e5
Compare
|
||
&.is-style-pill a { | ||
border: 1px solid currentColor; | ||
font-size: var(--wp--preset--font-size--normal) !important; // !important Needed to override the inline styles. |
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 normal font size has been depreciated, so we might want to switch to "Medium" here?
.... but if we don't specify a font size maybe we're better off? Then it should inherit the default size.
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 problem is if we don't specify a size then the font sizes are determined by how often the tag is used
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.
unset
will do that for you
It's looking right in the front end for me. 👍 In general, this seems solid to me. The code is generic enough that it inherits all it can from the theme its placed in. Nice work! The only remaining comment on my end is that I think we should reconsider the "pill" name since these aren't rounded anymore. Maybe we could use "Button" or "Outline" instead? Outline might be more reasonable, since folks would assume a "Button" would match the button block. |
Done! |
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.
This looks good, thanks @scruffian!
It would be good to have another review before we merge so this doesn't end up needing a revert. |
I have no objections here as long as designers are happy |
@@ -51,5 +51,14 @@ function register_block_core_tag_cloud() { | |||
'render_callback' => 'render_block_core_tag_cloud', | |||
) | |||
); | |||
|
|||
register_block_style( |
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.
Any particular reason why this style isn't included in the block.json
file? See: https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#block-styles.
array( | ||
'name' => 'outline', | ||
'label' => __( 'Outline', 'gutenberg' ), | ||
'style_handle' => 'outline', |
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 don't see a style registered with the handle outline
in this PR and the styles were added to the existing CSS file, so maybe we don't need that part.
Description
This adds an outline style to the Tag Cloud block. We don't yet have an agreed standard for color names, so it's possible that these presets won't be defined in the theme.
How has this been tested?
In TT2 and Skatepark
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
*.native.js
files for terms that need renaming or removal).