Chronstruct / primitives

MIT License
2 stars 0 forks source link

enable indirect configuration #96

Open kylpo opened 2 years ago

kylpo commented 2 years ago

Currently, it is not possible for a component to accept props that are passed in to a primitive in the render of that component. I.e. it is not possible to indirectly configure/override a primitive and still have it compiled away as css (it'd all be dynamic styles, which is not an acceptable limitation).

Figure out a way to do something like:

const MyComponent = (props) => (
  <box {...props.primitiveOverrides} />
)

or

const MyComponent = (props) => (
  <box width={props.width} />
)

const IndirectComponent = () => (
  <MyComponent width={42} />
)

// Or
const IndirectComponent = () => (
  <MyComponent {...box({width: 42})} />
)

// Or
const IndirectComponent = () => (
  <box_ width={42}>
    <MyComponent />
  </box_>
)