Style element helper should convert class objects to a string.
This commit is contained in:
parent
063e3a3a3f
commit
6a198e21bd
@ -24,8 +24,19 @@ export function el(sig, ...attrsOrChildren) {
|
|||||||
delete attrs.css;
|
delete attrs.css;
|
||||||
delete attrs.styles;
|
delete attrs.styles;
|
||||||
}
|
}
|
||||||
|
if (isObject(attrs.class)) {
|
||||||
|
const oldClassObj = attrs.class;
|
||||||
|
attrs.class = Object.entries(oldClassObj)
|
||||||
|
.reduce((acc, [key, value]) => {
|
||||||
|
if (value) {
|
||||||
|
acc.push(key);
|
||||||
}
|
}
|
||||||
return defineElement(sig, attrs, ...children);
|
return acc;
|
||||||
|
}, [])
|
||||||
|
.join(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defineElement(sig, attrs, children);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function styled(styles, tagName = 'div') {
|
export function styled(styles, tagName = 'div') {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user