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

[Feature-Request] give Accordion a flexible dataArray #2116

Closed
ImBeCiliC opened this issue Jul 9, 2018 · 3 comments
Closed

[Feature-Request] give Accordion a flexible dataArray #2116

ImBeCiliC opened this issue Jul 9, 2018 · 3 comments

Comments

@ImBeCiliC
Copy link

Possibility to give custom render method of Accordion a different dataArray.
In the current code the renderHeader prop receives item.title and renderContent prop receives item.content.
It would be more flexible to add the whole array of data to a custom render. This way it would be possible to use data which was fetched via an api call and display that in the custom accordion.

The line to change is in Accordion.js line 102, 103
from: {this.props.renderHeader ? ( this.props.renderHeader(this.props.item.title, this.props.expanded)
to: {this.props.renderHeader ? ( this.props.renderHeader(this.props.item, this.props.expanded)

and line 119, 120
from: {this.props.renderContent ? ( this.props.renderContent(this.props.item.content)
to: {this.props.renderContent ? ( this.props.renderContent(this.props.item)

is there a reason why it is limited to the keys title and content?

@SupriyaKalghatgi
Copy link
Contributor

Added with 2.7.2

@fouratj
Copy link

fouratj commented Aug 29, 2018

This should ideally be reflected in the documentation for the custom header and content, as it shows the old behaviour of receiving simply the Title and Content variables.

@SupriyaKalghatgi
Copy link
Contributor

Docs are on the way

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

No branches or pull requests

3 participants