Skip to content

Instantly share code, notes, and snippets.

@kory33
Last active November 30, 2017 08:16
Show Gist options
  • Select an option

  • Save kory33/d5530549b0f0fb10791038b92f34f13f to your computer and use it in GitHub Desktop.

Select an option

Save kory33/d5530549b0f0fb10791038b92f34f13f to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
export default class Thum extends Component {
constructor(props) {
super(props)
this.state = {
thums: {
main: 'sample/6.png',
sub: ['sample/1.png', 'sample/2.png', 'sample/3.png']
}
}
}
handleSubThumClick(thum, e) {
// TODO
}
render() {
return (
<div id="thums">
<div id="thum_1">
<img class="thum_1 blur" src={this.state.thums.main} alt="" width="100%" height="100%" style={{ 'object-fit': 'cover' }} />
<img class="thum_1" src={this.state.thums.main} alt="" width="100%" height="100%" />
</div>
<div class="thum_sub">
{this.state.thums.sub.map(thum =>
<img alt="" height="100%", src={thum} onClick={e => this.handleSubThumClick(thum, e)}>
)}
</div>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment