@wordpress/block-library
Version:
Block library for the WordPress editor.
48 lines (45 loc) • 1.41 kB
JavaScript
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { group, row, stack } from '@wordpress/icons';
const variations = [
{
name: 'group',
title: __( 'Group' ),
description: __( 'Gather blocks in a container.' ),
attributes: { layout: { type: 'constrained' } },
isDefault: true,
scope: [ 'inserter', 'transform' ],
isActive: ( blockAttributes ) =>
! blockAttributes.layout ||
! blockAttributes.layout?.type ||
blockAttributes.layout?.type === 'default' ||
blockAttributes.layout?.type === 'constrained',
icon: group,
},
{
name: 'group-row',
title: _x( 'Row', 'single horizontal line' ),
description: __( 'Arrange blocks horizontally.' ),
attributes: { layout: { type: 'flex', flexWrap: 'nowrap' } },
scope: [ 'inserter', 'transform' ],
isActive: ( blockAttributes ) =>
blockAttributes.layout?.type === 'flex' &&
( ! blockAttributes.layout?.orientation ||
blockAttributes.layout?.orientation === 'horizontal' ),
icon: row,
},
{
name: 'group-stack',
title: __( 'Stack' ),
description: __( 'Arrange blocks vertically.' ),
attributes: { layout: { type: 'flex', orientation: 'vertical' } },
scope: [ 'inserter', 'transform' ],
isActive: ( blockAttributes ) =>
blockAttributes.layout?.type === 'flex' &&
blockAttributes.layout?.orientation === 'vertical',
icon: stack,
},
];
export default variations;