PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.5.3
GenerateBlocks v1.5.3
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / components / color-group / index.js
generateblocks / src / components / color-group Last commit date
editor.scss 4 years ago index.js 4 years ago
index.js
64 lines
1 /**
2 * External dependencies
3 */
4 import { applyFilters } from '@wordpress/hooks';
5
6 /**
7 * Internal dependencies
8 */
9 import ColorPicker from '../color-picker';
10 import './editor.scss';
11
12 export default function ColorGroup( props ) {
13 const {
14 setAttributes,
15 attributes,
16 colors,
17 } = props;
18
19 const colorItems = applyFilters(
20 'generateblocks.editor.colorGroupItems',
21 colors,
22 props
23 );
24
25 return (
26 <div className="gblocks-color-group">
27 {
28 colorItems.map( ( colorItem, index ) => {
29 return (
30 <div key={ index } className="gblocks-color-group__row">
31 { !! colorItem.label &&
32 <span className="gblocks-color-group__row-label">{ colorItem.label }</span>
33 }
34
35 { colorItem.items.map( ( color, colorIndex ) => {
36 return (
37 <ColorPicker
38 key={ colorIndex }
39 label={ color?.label }
40 tooltip={ color?.tooltip }
41 value={ attributes[ color.attribute ] }
42 alpha={ color.alpha || false }
43 valueOpacity={ attributes[ color.attribute + 'Opacity' ] }
44 onChange={ ( nextBackgroundColor ) =>
45 setAttributes( {
46 [ color.attribute ]: nextBackgroundColor,
47 } )
48 }
49 onOpacityChange={ ( value ) =>
50 setAttributes( {
51 [ color.attribute + 'Opacity' ]: value,
52 } )
53 }
54 />
55 );
56 } ) }
57 </div>
58 );
59 } )
60 }
61 </div>
62 );
63 }
64