Skip to content

Instantly share code, notes, and snippets.

@tonyspiro
Last active Jul 17, 2018
Embed
What would you like to do?
// section-list.js
import TeamSection from './sections/team'
import SignupSection from './sections/signup'
export default ({ sections }) => (
<div>
{
sections.map(section => {
if (section.metadata.team)
return <TeamSection section={section} />
if (section.metadata.cta)
return <SignupSection section={section} />
})
}
</div>
)
// signup.js
export default ({ section }) => (
<div>
<h3>{section.metadata.headline}</h3>
<div dangerouslySetInnerHTML={{ __html: section.metadata.content }}></div>
<div><img src={section.metadata.image.imgix_url} /></div>
<div><button>{section.metadata.cta}</button></div>
</div>
)
// team.js
export default ({ section }) => (
<div>
<h3>{section.metadata.headline}</h3>
{
section.metadata.team.map(person => {
return (
<div key={person._id}>
<div>{person.metadata.name}</div>
<div>{person.metadata.quote}</div>
<div><img src={person.metadata.image.imgix_url} /></div>
</div>
)
})
}
</div>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment