PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 1.8.3
GenerateBlocks v1.8.3
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 / extend / inspector-control / controls / sizing / components / SizingCSS.js
generateblocks / src / extend / inspector-control / controls / sizing / components Last commit date
Height.js 2 years ago MaxHeight.js 2 years ago MaxWidth.js 2 years ago MinHeight.js 2 years ago MinWidth.js 2 years ago SizingCSS.js 3 years ago Width.js 2 years ago
SizingCSS.js
38 lines
1 import addToCSS from '../../../../../utils/add-to-css';
2 import sizingValue from '../../../../../utils/sizingValue';
3
4 export default function SizingCSS( css, selector, attributes, device = '' ) {
5 const {
6 sizing,
7 } = attributes;
8
9 const styles = {
10 width: sizingValue( 'width' + device, sizing ),
11 height: sizingValue( 'height' + device, sizing ),
12 'min-width': sizingValue( 'minWidth' + device, sizing ),
13 'min-height': sizingValue( 'minHeight' + device, sizing ),
14 'max-width': sizingValue( 'maxWidth' + device, sizing ),
15 'max-height': sizingValue( 'maxHeight' + device, sizing ),
16 };
17
18 if ( attributes.useInnerContainer ) {
19 delete styles[ 'max-width' ];
20 } else if ( attributes.useGlobalMaxWidth && ! device ) {
21 styles[ 'max-width' ] = generateBlocksInfo.globalContainerWidth;
22 }
23
24 if ( attributes.isGrid ) {
25 delete styles.width;
26 delete styles[ 'min-width' ];
27 delete styles[ 'max-width' ];
28 }
29
30 if ( ! styles[ 'max-width' ] ) {
31 styles[ 'max-width' ] = 'unset';
32 }
33
34 return (
35 addToCSS( css, selector, styles )
36 );
37 }
38