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

feat: allow MultipleEntryReferenceEditor to render children prop #1662

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nerdess
Copy link
Contributor

@nerdess nerdess commented May 23, 2024

The commit message is a bit misleading. This is about offering the ability to extend the body of an MultipleReferenceEditor entry with custom React elements.

Check storyboard > Multiple Entry > Custom Children.

The content "Some custom children..." has been added using the new optional renderCustomChildren prop.

Bildschirmfoto 2024-05-23 um 14 54 52
<MultipleEntryReferenceEditor
    renderCustomChildren={() => {
      return <>Some custom children. Anything can be rendered here!</>;
    }}
    viewType="link"
    sdk={sdk}
    isInitiallyDisabled={isInitiallyDisabled}
    parameters={{
      instance: instanceParams || {
        showCreateEntityAction: true,
        showLinkEntityAction: true,
      },
  }}
/>

I was missing this feature when developing a custom Contentul app. Might be useful for others.

@nerdess nerdess requested a review from a team as a code owner May 23, 2024 13:00
@colomolo
Copy link
Contributor

Hi @nerdess. MultipleEntryReferenceEditor component have renderCustomCard prop that has similar functionality. I believe you can achive the same result with it.

Please refer to the Storybook:
https://contentful-field-editors.netlify.app/?path=/story/editors-multiple-entry--custom-card

@nerdess
Copy link
Contributor Author

nerdess commented Jun 13, 2024

@colomolo Yeah I am aware of renderCustomCard and I started with it but faced limitations. It's been half a year since I did that amendment, if I remember correctly it was like this: with just popping in the children I did have the correct header out-of-the-box and also the drag/drop functionality of the list. I did not have to rebuild all that.

Copy link

Marking pull request as stale since there was no activity for 30 days

@github-actions github-actions bot added the stale Used to mark when there was no activity for a set period of time label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Used to mark when there was no activity for a set period of time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants