Skip to content

Instantly share code, notes, and snippets.

@tonyspiro
Last active July 17, 2018 21:38
Show Gist options
  • Save tonyspiro/fa68ae9484899ce0ae7e8228528fdda5 to your computer and use it in GitHub Desktop.
Save tonyspiro/fa68ae9484899ce0ae7e8228528fdda5 to your computer and use it in GitHub Desktop.
// 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