Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* 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: ,
},
] );
/**
* 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: ,
},
] );
const getCategoryIndex = item => {
return findIndex(getCategories(), category => category.slug === item.category);
};
const itemsPerCategory = flow(
renderCategories( visibleItemsByCategory ) {
if ( isEmpty( visibleItemsByCategory ) ) {
return (
);
}
return getCategories().map(
( category ) => this.renderCategory( category, visibleItemsByCategory[ category.slug ] )
);
}
* 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: ,
},
const getCategoryIndex = ( item ) => {
return findIndex( getCategories(), ( category ) => category.slug === item.category );
};
const itemsPerCategory = flow(
* 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: ,
},
onSelect={ onSelect }
onHover={ this.onHover }
/>
{ !! suggestedItems.length &&
}
{ map( getCategories(), ( category ) => {
const categoryItems = itemsPerCategory[ category.slug ];
if ( ! categoryItems || ! categoryItems.length ) {
return null;
}
return (
);