Created
April 19, 2017 12:51
-
-
Save cwhittl/c2a0a92705a301e54f4a9aa3eba54bba to your computer and use it in GitHub Desktop.
Simple React Component To Implement The Foundation Accordion Component missing from Foundation React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
class Accordion extends React.Component { | |
render() { | |
return ( | |
<ul className="accordion" data-accordion>{this.props.children}</ul> | |
); | |
} | |
} | |
export default Accordion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Accordion from './Accordion'; | |
import AccordionNavigation from './AccordionNavigation'; | |
class AccordionExample extends React.Component { | |
render() { | |
myArray = [1,2,3,4]; | |
myArray.map(function (element) { | |
return ( | |
<AccordionNavigation open={()=>element==1} title={element} key={element}> | |
{element} | |
</AccordionNavigation>); | |
}); | |
return ( | |
<div> | |
<Accordion> | |
{items} | |
</Accordion> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment