Saturday, September 16, 2023
HomeCSScss - Making use of React's inline JSX designs with Graceful (with...

css – Making use of React’s inline JSX designs with Graceful (with a regulation)


I’m making use of Svelte, however I seem like I’m not all set to relocate far from React’s inline JSX designs yet – I such as:

  • Packing my designs right there on the aspect that’s utilizing them.
  • Creating remarks within my designs
  • Combining various design things
  • Offering worths as a number, without needing to add px

I can accomplish this thus:

<< manuscript>>.
feature design (node, vars) {
Object.entries( vars). forEach(([ p, v ]) => > {node.style[p] = (typeof v === 'number'? '$ {v} px': v)} ).
}
<.

<< div>>.
<< div usage: design= {{
display screen: 'flex',.
backgroundColor: 'red',.
size: Math.random() * 400,.
elevation: 200,.
boundary: '1px strong black',.
}} >>.
<< div usage: design= {{
size: 100,.
elevation: 100,.
backgroundColor: 'blue'.
}}/>>.
<.
<.

Exist any type of drawbacks to this technique, or can you recommend a means of styling with Graceful that additionally fulfills my demands? Many thanks!

RELATED ARTICLES

Most Popular

Recent Comments