attributes.js
52 lines
| 1 | |
| 2 | export default function getLayoutAttributes( defaults ) { |
| 3 | const options = [ |
| 4 | 'display', |
| 5 | 'flexDirection', |
| 6 | 'flexWrap', |
| 7 | 'alignItems', |
| 8 | 'justifyContent', |
| 9 | 'columnGap', |
| 10 | 'rowGap', |
| 11 | 'position', |
| 12 | 'overflowX', |
| 13 | 'overflowY', |
| 14 | ]; |
| 15 | |
| 16 | const attributes = {}; |
| 17 | |
| 18 | options.forEach( ( option ) => { |
| 19 | attributes[ option ] = { |
| 20 | type: 'string', |
| 21 | default: defaults[ option ], |
| 22 | }; |
| 23 | |
| 24 | attributes[ option + 'Tablet' ] = { |
| 25 | type: 'string', |
| 26 | default: defaults[ option + 'Tablet' ], |
| 27 | }; |
| 28 | |
| 29 | attributes[ option + 'Mobile' ] = { |
| 30 | type: 'string', |
| 31 | default: defaults[ option + 'Mobile' ], |
| 32 | }; |
| 33 | } ); |
| 34 | |
| 35 | attributes.zindex = { |
| 36 | type: 'number', |
| 37 | default: defaults.zindex, |
| 38 | }; |
| 39 | |
| 40 | attributes.zindexTablet = { |
| 41 | type: 'number', |
| 42 | default: defaults.zindexTablet, |
| 43 | }; |
| 44 | |
| 45 | attributes.zindexMobile = { |
| 46 | type: 'number', |
| 47 | default: defaults.zindexMobile, |
| 48 | }; |
| 49 | |
| 50 | return attributes; |
| 51 | } |
| 52 |