lightning-js / ui-components

Lightning UI Components for Solid & Blits
https://lightning-js.github.io/ui-components/
Apache License 2.0
11 stars 4 forks source link

feat(utils): add HOC to create toned components #125

Closed anthony9187 closed 4 months ago

anthony9187 commented 4 months ago

Description

First pass at making tones more static. I'm not sure if this actually achieves what we'd discussed @chiefcll, however I can't pass the styles through props since the sub-node toneStyles need to be explicitly mapped to the right node.

This PR adds a Higher Order Component(sorta? we're not exactly wrapping the component so it might be a different pattern) to add the styles of a given tone to a component. Instead of using the inline prop like we currently are, createComponentWithTone parses out the tone styles of a given component and passes them to the component with a special prop. the component uses the styles from this prop(if present) to add tones to the given component.

This draft is meant to be a collaborative effort - I'm not sure if this is the right path forward, or if we even gain anything of real substance from this approach

anthony9187 commented 4 months ago

closing, inline tones seem to add minimal overhead at this time