Skip to content

Commit

Permalink
Add Jetpack blocks collection
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj committed Jan 24, 2020
1 parent baeb9e4 commit 3fd43e9
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions extensions/shared/block-category.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
/**
* External dependencies
*/
import { getCategories, setCategories } from '@wordpress/blocks';
import { getCategories, setCategories, registerBlockCollection } from '@wordpress/blocks';

/**
* Internal dependencies
*/
import JetpackLogo from '../shared/jetpack-logo';

setCategories( [
...getCategories().filter( ( { slug } ) => slug !== 'jetpack' ),
// Add a Jetpack block category
{
slug: 'jetpack',
if ( typeof registerBlockCollection === 'function' ) {
registerBlockCollection( 'jetpack', {
title: 'Jetpack',
icon: <JetpackLogo />,
},
] );
} );
} else {
// This can be removed once G 7.3 is shipped in the Core version that is JP's minimum.
setCategories( [
...getCategories().filter( ( { slug } ) => slug !== 'jetpack' ),
// Add a Jetpack block category
{
slug: 'jetpack',
title: 'Jetpack',
icon: <JetpackLogo />,
},
] );
}

0 comments on commit 3fd43e9

Please sign in to comment.