| 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 |
gen_styling_css += id; |
| 37 |
gen_styling_css += selector + '{'; |
| 38 |
gen_styling_css += css; |
| 39 |
gen_styling_css += '}'; |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
return gen_styling_css; |
| 44 |
} |
| 45 |
|
| 46 |
export default generateCSS; |
| 47 |
|