-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathvariations.js
45 lines (43 loc) · 1.26 KB
/
variations.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { group, row, stack } from '@wordpress/icons';
const variations = [
{
name: 'group',
title: __( 'Group' ),
description: __( 'Gather blocks in a layout container.' ),
attributes: { layout: { type: 'default' } },
scope: [ 'transform' ],
isActive: ( blockAttributes ) =>
! blockAttributes.layout ||
! blockAttributes.layout?.type ||
blockAttributes.layout?.type === 'default',
icon: group,
},
{
name: 'group-row',
title: __( 'Row' ),
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;