Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow to create multi level (nested) components #24

Open
joaozitopolo opened this issue Feb 28, 2024 · 1 comment
Open

Allow to create multi level (nested) components #24

joaozitopolo opened this issue Feb 28, 2024 · 1 comment

Comments

@joaozitopolo
Copy link
Contributor

Today it is only possible to create one level component.
Should be possible to create nested combinations with the same initial parameters?

Ex:

const Box = w.div("color-red", { ...config1 }).nest.div("border-2", { ...config2})

and then when use, any parameters will be reflected to all nested components:

and variant should reach config1 and config2.

@joaozitopolo
Copy link
Contributor Author

joaozitopolo commented Oct 3, 2024

After a review, I noticed the return of w.div() is the component, and it can't return a chain for nested components.
Other way to implement it should be using a parameter (ex: "inner") that should be any component. Then, the children content will be sent to the inner component:

const Box = w.div("color-red", { inner: w.div("border-2") })

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant