PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.0.0
GenerateBlocks v2.0.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 / button-container / css / mobile.js
generateblocks / src / blocks / button-container / css Last commit date
desktop.js 4 years ago main.js 2 years ago mobile.js 2 years ago tablet-only.js 4 years ago tablet.js 2 years ago
mobile.js
67 lines
1 import buildCSS from '../../../utils/build-css';
2 import flexboxAlignment from '../../../utils/flexbox-alignment';
3 import SpacingCSS from '../../../extend/inspector-control/controls/spacing/components/SpacingCSS';
4
5 import {
6 Component,
7 } from '@wordpress/element';
8
9 import {
10 applyFilters,
11 } from '@wordpress/hooks';
12
13 export default class MobileCSS extends Component {
14 render() {
15 const attributes = applyFilters( 'generateblocks.editor.cssAttrs', this.props.attributes, this.props );
16
17 const {
18 uniqueId,
19 alignmentMobile,
20 stackMobile,
21 fillHorizontalSpaceMobile,
22 } = attributes;
23
24 let cssObj = [];
25
26 cssObj[ '.editor-styles-wrapper .gb-button-wrapper-' + uniqueId ] = [ {
27 'display': fillHorizontalSpaceMobile ? 'block' : false, // eslint-disable-line quote-props
28 'justify-content': flexboxAlignment( alignmentMobile ),
29 'flex-direction': stackMobile ? 'column' : false,
30 'align-items': stackMobile ? flexboxAlignment( alignmentMobile ) : false,
31 } ];
32
33 SpacingCSS( cssObj, '.editor-styles-wrapper .gb-button-wrapper-' + uniqueId, attributes.spacing, 'Mobile' );
34
35 cssObj[ '.gb-button-wrapper-' + uniqueId + ' > .block-editor-inner-blocks > .block-editor-block-list__layout' ] = [ {
36 'flex-direction': stackMobile ? 'column' : false,
37 'align-items': stackMobile ? flexboxAlignment( alignmentMobile ) : false,
38 'justify-content': flexboxAlignment( alignmentMobile ),
39 } ];
40
41 if ( fillHorizontalSpaceMobile ) {
42 cssObj[ '.gb-button-wrapper-' + uniqueId + ' > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block' ] = [ {
43 'flex': '1', // eslint-disable-line quote-props
44 } ];
45
46 cssObj[ '.gb-button-wrapper-' + uniqueId + ' > .components-button' ] = [ {
47 'background': '#fff', // eslint-disable-line quote-props
48 'border': '1px solid #ddd', // eslint-disable-line quote-props
49 'margin-top': '10px',
50 } ];
51 }
52
53 if ( stackMobile && fillHorizontalSpaceMobile ) {
54 cssObj[ '.gb-button-wrapper-' + uniqueId + ' > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block' ] = [ {
55 'width': '100% !important', // eslint-disable-line quote-props
56 'box-sizing': 'border-box',
57 } ];
58 }
59
60 cssObj = applyFilters( 'generateblocks.editor.mobileCSS', cssObj, this.props, 'button-container' );
61
62 return (
63 <style>{ buildCSS( cssObj ) }</style>
64 );
65 }
66 }
67