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

Use inline styles for Sign in with Google Gutenberg block #10265

Merged
merged 3 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion blocks/sign-in-with-google/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export default function Edit() {

return (
<div { ...blockProps }>
<div className="googlesitekit-blocks-sign-in-with-google">
<div
className="googlesitekit-blocks-sign-in-with-google"
style={ { maxWidth: '180px', minWidth: '120px' } }
>
<SignInWithGoogleIcon />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions blocks/sign-in-with-google/block.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"apiVersion": 2,
Copy link
Collaborator

Choose a reason for hiding this comment

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

v2 was released in WP 5.6 with the addition of useBlockProps – I'm a little concerned that this may break things for folks on those older versions as this will be available to everyone. I'm not sure core has the concept of the API version at that time to prevent it from loading, but it actually errors when registered in JS right now due to a missing title.

image

Similarly, there is a notice raised on the backend due to the use of the block.json in the registration (I assume) as it's complaining about the lack of a prefix

Notice: WP_Block_Type_Registry::register was called incorrectly. Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type Please see [Debugging in WordPress](https://wordpress.org/support/article/debugging-in-wordpress/) for more information. (This message was added in version 5.0.0.)

I'm not sure if this is blocking or not (no pun intended), but we should probably gate the existence of the block to WP versions 5.6+ to avoid causing problems, so long as we technically support older versions.

After some more testing, I found I wasn't able to use the block until WP 5.8! These are old versions, and we're overdue to raise our minimum requirement here, but we should avoid loading the block on versions that will only cause notices and ultimately be non-functional.

"name": "google-site-kit/sign-in-with-google",
"version": "1.147.0",
"title": "Sign in with Google",
"category": "widgets",
"icon": "google",
"description": "Allow users to sign in to your site using their Google Account.",
"textdomain": "google-site-kit/sign-in-with-google"
"textdomain": "google-site-kit"
}
Loading