Style element helper should convert class objects to a string.
This commit is contained in:
parent
c6b6be9d4c
commit
acc0cfb29e
@ -24,8 +24,19 @@ export function el(sig, ...attrsOrChildren) {
|
||||
delete attrs.css;
|
||||
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 acc;
|
||||
}, [])
|
||||
.join(' ');
|
||||
}
|
||||
}
|
||||
return defineElement(sig, attrs, ...children);
|
||||
return defineElement(sig, attrs, children);
|
||||
}
|
||||
|
||||
export function styled(styles, tagName = 'div') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user