Skip to content

Instantly share code, notes, and snippets.

@lvarayut
Last active April 20, 2017 09:05
Show Gist options
  • Save lvarayut/627f338c907197553bbaa68ba81216ea to your computer and use it in GitHub Desktop.
Save lvarayut/627f338c907197553bbaa68ba81216ea to your computer and use it in GitHub Desktop.
Step-5 Gallery and Thumbnail components
...
const Gallery = styled.div`
display: flex;
flex-wrap: wrap;
`;
const Thumbnail = styled.img`
flex-grow: 1;
width: 300px;
height: 250px;
padding: 5px;
margin: 15px;
border: 1px solid ${mainColor};
border-radius: 8px;
`;
class App extends Component {
render() {
const thumbnails = Array.from({ length: 5 }, (_, index) => {
return <Thumbnail key={index + 1} src={require(`../assets/thumbnail-${index + 1}.jpeg`)} />;
});
return (
<div className={this.props.className}>
<Title color={mainColor}>Mystagram</Title>
<Gallery>
{thumbnails}
</Gallery>
</div>
);
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment