How to use the @wordpress/blocks.getCategories function in @wordpress/blocks

To help you get started, we’ve selected a few @wordpress/blocks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github woocommerce / woocommerce-gutenberg-products-block / assets / js / index.js View on Github external
/**
 * External dependencies
 */
import { getCategories, setCategories } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

/**
 * Internal dependencies
 */
import '../css/editor.scss';
import '../css/style.scss';
import { IconWoo } from './components/icons';

setCategories( [
	...getCategories().filter( ( { slug } ) => slug !== 'woocommerce' ),
	// Add a WooCommerce block category
	{
		slug: 'woocommerce',
		title: __( 'WooCommerce', 'woo-gutenberg-products-block' ),
		icon: ,
	},
] );
github Automattic / jetpack / extensions / shared / block-category.js View on Github external
/**
 * External dependencies
 */
import { getCategories, setCategories } from '@wordpress/blocks';

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

setCategories( [
	...getCategories().filter( ( { slug } ) => slug !== 'jetpack' ),
	// Add a Jetpack block category
	{
		slug: 'jetpack',
		title: 'Jetpack',
		icon: ,
	},
] );
github front / gutenberg-js / src / js / gutenberg-overrides / @wordpress / editor / build-module / components / inserter / menu.js View on Github external
const getCategoryIndex = item => {
      return findIndex(getCategories(), category => category.slug === item.category);
    };
    const itemsPerCategory = flow(
github WordPress / gutenberg / editor / components / inserter / menu.js View on Github external
renderCategories( visibleItemsByCategory ) {
		if ( isEmpty( visibleItemsByCategory ) ) {
			return (
				
			);
		}

		return getCategories().map(
			( category ) => this.renderCategory( category, visibleItemsByCategory[ category.slug ] )
		);
	}
github php4dev / heroku-wordpress / wp-content / plugins / woocommerce / packages / woocommerce-blocks / assets / js / index.js View on Github external
* External dependencies
 */
import { getCategories, setCategories } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import { woo, atom, Icon } from '@woocommerce/icons';

/**
 * Internal dependencies
 */
import '../css/editor.scss';
import '../css/style.scss';
import './filters/block-list-block';
import './filters/get-block-attributes';

setCategories( [
	...getCategories().filter(
		( { slug } ) =>
			slug !== 'woocommerce' && slug !== 'woocommerce-product-elements'
	),
	{
		slug: 'woocommerce',
		title: __( 'WooCommerce', 'woocommerce' ),
		icon: ,
	},
	{
		slug: 'woocommerce-product-elements',
		title: __(
			'WooCommerce Product Elements',
			'woocommerce'
		),
		icon: ,
	},
github ampproject / amp-wp / assets / src / stories-editor / components / inserter / menu.js View on Github external
const getCategoryIndex = ( item ) => {
			return findIndex( getCategories(), ( category ) => category.slug === item.category );
		};
		const itemsPerCategory = flow(
github php4dev / heroku-wordpress / wp-content / plugins / woo-gutenberg-products-block / assets / js / index.js View on Github external
* External dependencies
 */
import { getCategories, setCategories } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import { woo, atom, Icon } from '@woocommerce/icons';

/**
 * Internal dependencies
 */
import '../css/editor.scss';
import '../css/style.scss';
import './filters/block-list-block';
import './filters/get-block-attributes';

setCategories( [
	...getCategories().filter(
		( { slug } ) =>
			slug !== 'woocommerce' && slug !== 'woocommerce-product-elements'
	),
	{
		slug: 'woocommerce',
		title: __( 'WooCommerce', 'woo-gutenberg-products-block' ),
		icon: ,
	},
	{
		slug: 'woocommerce-product-elements',
		title: __(
			'WooCommerce Product Elements',
			'woo-gutenberg-products-block'
		),
		icon: ,
	},
github WordPress / gutenberg / packages / block-editor / src / components / inserter / menu.js View on Github external
onSelect={ onSelect }
							onHover={ this.onHover }
						/>

						{ !! suggestedItems.length &&
							
								
							
						}

						{ map( getCategories(), ( category ) => {
							const categoryItems = itemsPerCategory[ category.slug ];
							if ( ! categoryItems || ! categoryItems.length ) {
								return null;
							}
							return (
								
									
								
							);