@wordpress/block-library
Version:
Block library for the WordPress editor.
59 lines (56 loc) • 2.54 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 => {
var _blockAttributes$layo, _blockAttributes$layo2, _blockAttributes$layo3;
return !blockAttributes.layout || !((_blockAttributes$layo = blockAttributes.layout) !== null && _blockAttributes$layo !== void 0 && _blockAttributes$layo.type) || ((_blockAttributes$layo2 = blockAttributes.layout) === null || _blockAttributes$layo2 === void 0 ? void 0 : _blockAttributes$layo2.type) === 'default' || ((_blockAttributes$layo3 = blockAttributes.layout) === null || _blockAttributes$layo3 === void 0 ? void 0 : _blockAttributes$layo3.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 => {
var _blockAttributes$layo4, _blockAttributes$layo5, _blockAttributes$layo6;
return ((_blockAttributes$layo4 = blockAttributes.layout) === null || _blockAttributes$layo4 === void 0 ? void 0 : _blockAttributes$layo4.type) === 'flex' && (!((_blockAttributes$layo5 = blockAttributes.layout) !== null && _blockAttributes$layo5 !== void 0 && _blockAttributes$layo5.orientation) || ((_blockAttributes$layo6 = blockAttributes.layout) === null || _blockAttributes$layo6 === void 0 ? void 0 : _blockAttributes$layo6.orientation) === 'horizontal');
},
icon: row
}, {
name: 'group-stack',
title: __('Stack'),
description: __('Arrange blocks vertically.'),
attributes: {
layout: {
type: 'flex',
orientation: 'vertical'
}
},
scope: ['inserter', 'transform'],
isActive: blockAttributes => {
var _blockAttributes$layo7, _blockAttributes$layo8;
return ((_blockAttributes$layo7 = blockAttributes.layout) === null || _blockAttributes$layo7 === void 0 ? void 0 : _blockAttributes$layo7.type) === 'flex' && ((_blockAttributes$layo8 = blockAttributes.layout) === null || _blockAttributes$layo8 === void 0 ? void 0 : _blockAttributes$layo8.orientation) === 'vertical';
},
icon: stack
}];
export default variations;
//# sourceMappingURL=variations.js.map