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

Blocks: Add Ribbon to indicate Paid blocks in block picker #13490

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions extensions/shared/register-jetpack-block.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { addFilter } from '@wordpress/hooks';
import { registerBlockType } from '@wordpress/blocks';
import { Ribbon } from '@automattic/components';

/**
* Internal dependencies
Expand Down Expand Up @@ -49,6 +51,14 @@ export default function registerJetpackBlock( name, settings, childBlocks = [] )
title: betaExtensions.includes( name ) ? `${ settings.title } (beta)` : settings.title,
edit: requiredPlan ? wrapPaidBlock( { requiredPlan } )( settings.edit ) : settings.edit,
example: requiredPlan ? undefined : settings.example,
icon: requiredPlan ? (
<>
ockham marked this conversation as resolved.
Show resolved Hide resolved
<Ribbon>{ __( 'Paid' ) }</Ribbon>
Copy link
Member

@simison simison Feb 10, 2020

Choose a reason for hiding this comment

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

We should probably give something little more for screen reader users than "paid", like "block name (requires paid plan)"

{ settings.icon }
</>
) : (
settings.icon
),
} );

if ( requiredPlan ) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"dependencies": {
"@automattic/calypso-build": "5.0.1",
"@automattic/calypso-color-schemes": "1.0.0",
"@automattic/components": "1.0.0-alpha.0",
"@automattic/custom-colors-loader": "automattic/custom-colors-loader",
"@automattic/format-currency": "1.0.0-alpha.0",
"@babel/core": "7.4.0",
Expand Down
15 changes: 13 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@
resolved "https://registry.yarnpkg.com/@automattic/calypso-color-schemes/-/calypso-color-schemes-1.0.0.tgz#17a14e3257bd90b40e960d624cca4353d4d20c34"
integrity sha512-W7r4pgcBauLx65oTLbHKV84ScnfEKmW7T/sXkPfByHhuIE7+OpubmiiBsizWatk1I/puUTmj+SDqEOJMOyRdzA==

"@automattic/components@1.0.0-alpha.0":
version "1.0.0-alpha.0"
resolved "https://registry.yarnpkg.com/@automattic/components/-/components-1.0.0-alpha.0.tgz#49147015bb4031a3d0df4ddf553805f6f1e95273"
integrity sha512-dJp5N//s40lO7fdpv+6PeXvfZO1b8fJZwyCB7Aw6Ej08RKHnLDxgP6WzvTkLEBX9kasq/uh6oHnNf/t1NUyw8g==
dependencies:
classnames "2.2.6"
enzyme "^3.10.0"
gridicons "^3.3.1"
prop-types "^15.7.2"
react "^16.8.3"

"@automattic/custom-colors-loader@automattic/custom-colors-loader":
version "1.0.0"
resolved "https://codeload.github.com/automattic/custom-colors-loader/tar.gz/e102d3ae049662e77ba9ba9e9f9cf0627313b38c"
Expand Down Expand Up @@ -5038,7 +5049,7 @@ enzyme-to-json@3.4.3, enzyme-to-json@^3.3.0:
dependencies:
lodash "^4.17.15"

enzyme@3.10.0:
enzyme@3.10.0, enzyme@^3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.10.0.tgz#7218e347c4a7746e133f8e964aada4a3523452f6"
integrity sha512-p2yy9Y7t/PFbPoTvrWde7JIYB2ZyGC+NgTNbVEGvZ5/EyoYSr9aG/2rSbVvyNvMHEhw9/dmGUJHWtfQIEiX9pg==
Expand Down Expand Up @@ -6471,7 +6482,7 @@ grid-index@^1.1.0:
resolved "https://registry.yarnpkg.com/grid-index/-/grid-index-1.1.0.tgz#97f8221edec1026c8377b86446a7c71e79522ea7"
integrity sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==

gridicons@3.3.1:
gridicons@3.3.1, gridicons@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/gridicons/-/gridicons-3.3.1.tgz#12c098fac5f6b59aecd42082ed5ef5edc391dfd4"
integrity sha512-eQsmujjLptLtyhGuu31US3mXkcptYHkgEE/s277HWv+j6c3Z2gYyjoHcBKwSFbQwxbfhToRd5uzYimR2ExWJdQ==
Expand Down