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