Created
October 9, 2018 14:21
-
-
Save danhollick/39b338b00996c51bfff54abe3381bf62 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var containerStyle = { | |
display: 'flex', | |
alignItems: 'center', | |
justifyContent: 'center', | |
margin: 24, | |
height: '100vh', | |
} | |
var divStyle = { | |
margin: 24, | |
} | |
var imgStyle = { | |
maxHeight: 200, | |
} | |
class App extends Component { | |
state = { images: [ | |
{ name: '', url:'' } | |
] | |
} | |
componentDidMount() { | |
fetch('/frames') | |
.then(res => res.json()) | |
.then(data => this.setState({ images: data })) | |
.catch(error => console.log(error)); | |
} | |
render() { | |
return ( | |
<div className="App" style={containerStyle}> | |
{this.state.images.map( | |
(frame,i) => | |
<div key={i} style={divStyle}> | |
<img src={frame.url} style={imgStyle} alt={"figma component"}/> | |
<p>{frame.name}</p> | |
</div> | |
)} | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment