index.js
43 lines
| 1 | /** |
| 2 | * External dependencies |
| 3 | */ |
| 4 | import { applyFilters } from '@wordpress/hooks'; |
| 5 | |
| 6 | /** |
| 7 | * Internal dependencies |
| 8 | */ |
| 9 | import DimensionsControl from '../dimensions'; |
| 10 | |
| 11 | export default function DimensionsGroup( props ) { |
| 12 | const { |
| 13 | dimensions, |
| 14 | deviceType, |
| 15 | } = props; |
| 16 | |
| 17 | const dimensionItems = applyFilters( |
| 18 | 'generateblocks.editor.dimensionGroupItems', |
| 19 | dimensions, |
| 20 | props |
| 21 | ); |
| 22 | |
| 23 | return ( |
| 24 | <> |
| 25 | { |
| 26 | dimensionItems.map( ( item, index ) => { |
| 27 | return ( |
| 28 | <DimensionsControl |
| 29 | { ...props } |
| 30 | key={ index } |
| 31 | device={ deviceType } |
| 32 | type={ item.type } |
| 33 | label={ item.label } |
| 34 | units={ item.units } |
| 35 | computedStyles={ item.computedStyles } |
| 36 | /> |
| 37 | ); |
| 38 | } ) |
| 39 | } |
| 40 | </> |
| 41 | ); |
| 42 | } |
| 43 |