PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.0
GenerateBlocks v1.0
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 / blocks / grid / css / desktop.js
generateblocks / src / blocks / grid / css Last commit date
desktop.js 6 years ago
desktop.js
43 lines
1 import buildCSS from '../../../utils/build-css';
2 import valueWithUnit from '../../../utils/value-with-unit';
3
4 const { Component } = wp.element;
5 const { applyFilters } = wp.hooks;
6
7 export default class DesktopCSS extends Component {
8 render() {
9 const {
10 attributes,
11 } = this.props;
12
13 const {
14 uniqueId,
15 horizontalGap,
16 verticalGap,
17 verticalAlignment,
18 horizontalAlignment,
19 } = attributes;
20
21 let cssObj = [];
22
23 cssObj[ '.gb-grid-wrapper-' + uniqueId + ' > .block-editor-inner-blocks > .block-editor-block-list__layout' ] = [ {
24 'align-items': verticalAlignment,
25 'justify-content': horizontalAlignment,
26 'margin-left': '-' + ( horizontalGap / 2 ) + 'px',
27 'margin-right': '-' + ( horizontalGap / 2 ) + 'px',
28 } ];
29
30 cssObj[ '.gb-grid-wrapper-' + uniqueId + ' > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block' ] = [ {
31 'padding-left': ( horizontalGap / 2 ) + 'px',
32 'padding-right': ( horizontalGap / 2 ) + 'px',
33 'margin-bottom': valueWithUnit( verticalGap, 'px' ),
34 } ];
35
36 cssObj = applyFilters( 'generateblocks.editor.desktopCSS', cssObj, 'grid', this.props );
37
38 return (
39 <style>{ buildCSS( cssObj ) }</style>
40 );
41 }
42 }
43