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