Skip to content

Instantly share code, notes, and snippets.

@danhollick
Created October 9, 2018 14:21
Show Gist options
  • Save danhollick/39b338b00996c51bfff54abe3381bf62 to your computer and use it in GitHub Desktop.
Save danhollick/39b338b00996c51bfff54abe3381bf62 to your computer and use it in GitHub Desktop.
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