Improve performance of styleable util

This commit is contained in:
Andrew Kingston 2024-08-12 19:27:33 +01:00
parent d6f33b2191
commit 96882e7eca
No known key found for this signature in database
1 changed files with 4 additions and 4 deletions

View File

@ -5,11 +5,11 @@ import { builderStore } from "stores"
*/
export const buildStyleString = (styleObject, customStyles) => {
let str = ""
Object.entries(styleObject || {}).forEach(([style, value]) => {
if (style && value != null) {
str += `${style}: ${value}; `
for (let key of Object.keys(styleObject || {})) {
if (styleObject[key] != null) {
str += `${key}:${styleObject[key]};`
}
})
}
return str + (customStyles || "")
}