Open maxime-rainville opened 1 year ago
@maxime-rainville Adding a note here that it would be great to not only make it injectable but also provide a good default and extensibility options. I suggest to use similar approach as the Summary
component of the Elemental module. This allows the display of a single image and a single line of text. This should be enough to easily identify the managed items.
This is the React component Summary
I also suggest to add some interfaces for easy integration with the component. We've done this for elemental but this is custom code as the elemental module doesn't provide this. This is a much cleaner and easier way to managed React properties compared to just passing it via updateBlockSchema()
as a array property.
Yeah I could imagine scenarios where you maybe want to add more esoteric actions that could be performed on an item in the AnyField. Or maybe there's a better way to communicate the information to the user.
Looking at the upload field, if the primary purpose of a specific AnyField is to manage an object tied to an image, displaying a thumbnail of the image would be a big plus.
At the same time, I'm not 100% sure if this is a "must have" or a really nice advanced feature we might want to consider. It might be that AnyField provides a generic implementation and if you want to have a custom layout, you have to subclass AnyField to create your own implementation.
We could make the AnyField customsible by allowing people to inject their own component in there.
e.g.: Let's say you use the AnyField and to manage Slides. It would be pretty cool if the AnyField could show the SlideThumbnail.