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

[AMP Stories] Optional rounded corners for Text and Image block #2055

Merged
merged 5 commits into from
Apr 3, 2019

Conversation

miina
Copy link
Contributor

@miina miina commented Apr 3, 2019

See #2013.

@googlebot googlebot added the cla: yes Signed the Google CLA label Apr 3, 2019
@miina
Copy link
Contributor Author

miina commented Apr 3, 2019

@swissspidy registerBlockStyle seems to be generally for a block type, added the rounded corners Toggle by using the existing filters instead.

@miina miina requested a review from swissspidy April 3, 2019 15:23
@miina miina changed the title [AMP Stories] Option rounded corners for Text and Image block [AMP Stories] Optional rounded corners for Text and Image block Apr 3, 2019
@swissspidy
Copy link
Collaborator

@miina I'm not sure I follow, what exactly was the issue you were facing with that method?

@miina
Copy link
Contributor Author

miina commented Apr 3, 2019

@swissspidy registerBlockStyle seems to add a new style for all the blocks of a certain type, however, we'd only need the style for a specific single block where the user has chosen to use rounded corners. So it seems like registerBlockStyle is not suitable for this case. Unless I'm missing something :)

@swissspidy
Copy link
Collaborator

swissspidy commented Apr 3, 2019

registerBlockStyle seems to add a new style for all the blocks of a certain type

Not exactly 🤔. registerBlockStyle provides the user alternative styles for blocks. It works by adding a class name to the block’s wrapper.

Try inserting a button block in Gutenberg and click on its icon. You can then see the different styles:

Screenshot 2019-04-03 at 16 36 00

See https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/#block-style-variations

So if we use this:

registerBlockStyle( 'amp/amp-story-text', {
    name: 'rounded',
    label: __( 'Rounded', 'amp' )
} );

The user can choose between the default style and the Rounded style. With Rounded, an is-rounded class name is added to the block.

So if the user wants rounded corner, they can simply switch the block style.

@miina
Copy link
Contributor Author

miina commented Apr 3, 2019

Oh, looks like I completely misunderstood this one. Thanks, will rework.

@swissspidy swissspidy merged commit abbe976 into amp-stories-redux Apr 3, 2019
@swissspidy swissspidy deleted the amp-story/2013-rounded_corners branch April 3, 2019 17:04
@westonruter westonruter added this to the v1.2 milestone May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants