2020-05-29 11:45:19 +02:00
|
|
|
export const buildStyle = styles => {
|
|
|
|
let str = ""
|
|
|
|
for (let s in styles) {
|
|
|
|
if (styles[s]) {
|
2020-05-30 19:48:20 +02:00
|
|
|
let key = convertCamel(s)
|
|
|
|
str += `${key}: ${styles[s]}; `
|
2020-05-29 11:45:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return str
|
|
|
|
}
|
|
|
|
|
|
|
|
export const convertCamel = str => {
|
|
|
|
return str.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)
|
|
|
|
}
|