PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 0.0.3
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v0.0.3
2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 0.0.2 0.0.3 All 96 releases
sureforms / src / srfm-controls / generateCSS.js
generateCSS.js
67 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function generateCSS(
2 selectorsObj,
3 id,
4 isResponsive = false, // eslint-disable-line no-unused-vars
5 responsiveType = '' // eslint-disable-line no-unused-vars
6 ) {
7 let gen_styling_css = '';
8
9 for ( const selector in selectorsObj ) {
10 const cssProps = selectorsObj[ selector ];
11 let css = '';
12
13 for ( const property in cssProps ) {
14 if (
15 typeof cssProps[ property ] === 'undefined' ||
16 cssProps[ property ] === null ||
17 cssProps[ property ]?.length === 0
18 ) {
19 continue;
20 }
21
22 const propertyValue = cssProps[ property ];
23
24 if ( 'font-family' === property && 'Default' === propertyValue ) {
25 continue;
26 }
27
28 if ( 'font-family' === property ) {
29 css += property + ': ' + "'" + propertyValue + "'" + ';';
30 } else {
31 css += property + ': ' + propertyValue + ';';
32 }
33 }
34
35 if ( css.length !== 0 ) {
36 if ( responsiveType === 'tablet' ) {
37 gen_styling_css +=
38 '@media only screen and (max-width: ' +
39 srfm_blocks_info.tablet_breakpoint +
40 'px) {';
41 gen_styling_css += id;
42 gen_styling_css += selector + '{';
43 gen_styling_css += css;
44 gen_styling_css += '}}';
45 } else if ( responsiveType === 'mobile' ) {
46 gen_styling_css +=
47 '@media only screen and (max-width: ' +
48 srfm_blocks_info.mobile_breakpoint +
49 'px) {';
50 gen_styling_css += id;
51 gen_styling_css += selector + '{';
52 gen_styling_css += css;
53 gen_styling_css += '}}';
54 } else {
55 gen_styling_css += id;
56 gen_styling_css += selector + '{';
57 gen_styling_css += css;
58 gen_styling_css += '}';
59 }
60 }
61 }
62
63 return gen_styling_css;
64 }
65
66 export default generateCSS;
67