contentful / experience-builder

https://www.contentful.com/developers/docs/experiences/what-are-experiences/
MIT License
5 stars 1 forks source link

Support for multiple draggable component "slots" #550

Open samiresua opened 1 month ago

samiresua commented 1 month ago

Some custom components might have multiple composable parts that need to be rendered in different areas.

children is great for just one slot, but i wonder if supporting more than one child could be supported?

Could a new type be added into the variables for the component definition. Perhaps something like type: 'Component'?

I can also see being able to limit/validate what components are 'allowed' to be dropped into specific slots being super handy 👍

elylucas commented 1 month ago

Hi @samiresua, thanks for the feedback.

We are currently looking into a way to do this, and maybe we could get some feedback from you on what we are thinking so far?

We are thinking of having a DropZone (or similarly named) component (imported from the sdk) that you can add to your own components that will allow you to define where things can be dropped. This DropZone will serve as the container for items to be dropped into, and you would be able to add your own styling/classes to it. Would something like that work for your needs?

sami616 commented 1 month ago

This sounds great. Could it just render into a react fragment to avoid muddying the dom with another container? Are you planning any way to only allow certain components to be allowed into drop zones? For example. I might have an Accordion component that should only accept components that are AccordionItems.