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