Last active
October 10, 2017 13:59
-
-
Save tonyspiro/cc5b1d57cec0734ce3df37b1432cad38 to your computer and use it in GitHub Desktop.
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 Cosmic from 'cosmicjs' | |
const config = { | |
bucket: { | |
slug: 'next-app' | |
} | |
} | |
export default class extends React.Component { | |
static async getInitialProps({ req }) { | |
return new Promise((resolve, reject) => { | |
Cosmic.getObject(config, { slug: 'home' }, (err, res) => { | |
return resolve(res.object) | |
}) | |
}) | |
} | |
render() { | |
return ( | |
<div> | |
<div style={{ paddingTop: 100, backgroundImage: `url(${this.props.metadata.hero.imgix_url})`, backgroundSize: 'cover', width: '100%', height: 500 }}> | |
<h1 style={{ color: '#fff', textAlign: 'center' }}>{this.props.metadata.headline}</h1> | |
</div> | |
<div style={{ textAlign: 'center' }} dangerouslySetInnerHTML={{ __html: this.props.content }}></div> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment