Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make the AnyField rendering customisable #15

Open
maxime-rainville opened this issue Aug 10, 2023 · 2 comments
Open

Make the AnyField rendering customisable #15

maxime-rainville opened this issue Aug 10, 2023 · 2 comments

Comments

@maxime-rainville
Copy link
Owner

maxime-rainville commented Aug 10, 2023

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.

@maxime-rainville maxime-rainville changed the title Make the LinkField customisable Make the AnyField customisable Aug 10, 2023
@mfendeksilverstripe
Copy link
Collaborator

@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.

Screenshot 2023-12-13 at 8 55 05 AM

This is the React component Summary

Screenshot 2023-12-13 at 8 56 29 AM

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.

Screenshot 2023-12-13 at 8 56 53 AM

Screenshot 2023-12-13 at 8 57 02 AM

@maxime-rainville maxime-rainville changed the title Make the AnyField customisable Make the AnyField rendering customisable Jan 31, 2024
@maxime-rainville
Copy link
Owner Author

maxime-rainville commented Jan 31, 2024

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.

image

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.

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

No branches or pull requests

2 participants