Any easy way to set tag styles?
caracal7 opened this issue · 1 comments
caracal7 commented
It is very easy to toggle classes depends on properties and this is looks beautiful, but how to easy set tag styles like 'top', 'left', 'background' & etc?
`
const Panel = ({content, align = 'left'}) => div.panel({ className : align }, content);R( H( Panel, { align: 'left', content: 'My Content', myPanelBackground: 'red' }), document.body);
`
wavesoft commented
Hello @caracal7 . This is a long overdue answer, but to answer your question:
You can use the style
property as usual. It is handled in a special manner and it's properties are automatically merged with the style
element property. Ex:
const Panel = ({content, align = 'left'}) => div.panel({ style: { textAlign: align } }, content);
R( H( Panel, { content: 'My Content', align: 'right' }), document.body);