PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.2.0
GenerateBlocks v2.2.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 / css / mobile.js
generateblocks / src / blocks / button / css Last commit date
desktop.js 5 years ago main.js 2 years ago mobile.js 2 years ago tablet-only.js 5 years ago tablet.js 2 years ago
mobile.js
62 lines
1 /* eslint-disable quotes */
2 import buildCSS from '../../../utils/build-css';
3 import LayoutCSS from '../../../extend/inspector-control/controls/layout/components/LayoutCSS';
4 import SizingCSS from '../../../extend/inspector-control/controls/sizing/components/SizingCSS';
5 import FlexChildCSS from '../../../extend/inspector-control/controls/flex-child-panel/components/FlexChildCSS';
6 import SpacingCSS from '../../../extend/inspector-control/controls/spacing/components/SpacingCSS';
7 import TypographyCSS from '../../../extend/inspector-control/controls/typography/components/TypographyCSS';
8 import BorderCSS from '../../../extend/inspector-control/controls/borders/BorderCSS';
9
10 import {
11 Component,
12 } from '@wordpress/element';
13
14 import {
15 applyFilters,
16 } from '@wordpress/hooks';
17
18 export default class MobileCSS extends Component {
19 render() {
20 const attributes = applyFilters( 'generateblocks.editor.cssAttrs', this.props.attributes, this.props );
21
22 const {
23 uniqueId,
24 removeText,
25 hasButtonContainer,
26 iconStyles,
27 } = attributes;
28
29 const containerSelector = !! hasButtonContainer ? '.gb-button-wrapper ' : '';
30 let selector = '.gb-button-' + uniqueId;
31 selector = '.editor-styles-wrapper ' + containerSelector + selector;
32
33 let cssObj = [];
34
35 TypographyCSS( cssObj, selector, attributes.typography, 'Mobile' );
36 SpacingCSS( cssObj, selector, attributes.spacing, 'Mobile' );
37 BorderCSS( cssObj, selector, attributes.borders, 'Mobile' );
38 LayoutCSS( cssObj, selector, attributes, 'Mobile' );
39 SizingCSS( cssObj, selector, attributes, 'Mobile' );
40 FlexChildCSS( cssObj, selector, attributes, 'Mobile' );
41
42 cssObj[ selector + ' .gb-icon' ] = [ {
43 'padding-top': ! removeText ? iconStyles?.paddingTopMobile : null,
44 'padding-right': ! removeText ? iconStyles?.paddingRightMobile : null,
45 'padding-bottom': ! removeText ? iconStyles?.paddingBottomMobile : null,
46 'padding-left': ! removeText ? iconStyles?.paddingLeftMobile : null,
47 } ];
48
49 cssObj[ selector + ' .gb-icon svg' ] = [ {
50 width: iconStyles?.widthMobile,
51 height: iconStyles?.heightMobile,
52 } ];
53
54 cssObj = applyFilters( 'generateblocks.editor.mobileCSS', cssObj, this.props, 'button' );
55
56 return (
57 <style>{ buildCSS( cssObj ) }</style>
58 );
59 }
60 }
61 /* eslint-enable quotes */
62