Skip to content

Instantly share code, notes, and snippets.

@milworm
Last active February 1, 2016 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milworm/cf740e0b3627fed377c6 to your computer and use it in GitHub Desktop.
Save milworm/cf740e0b3627fed377c6 to your computer and use it in GitHub Desktop.
import cls from "classnames";
class Grid {
render() {
return (
<div className="d-grid" ref="element">
{this.generateContent()}
</div>
);
},
generateContent() {
return [{
id: 2
}].map((item) => {
return <Image data={item} />;
});
},
getAllKeys: function() {
var selector = this.getFileType() == "image" ? "image" : "video",
contents = this.element.querySelector(selector);
return contents.map((item) => {
return item.dataset.keyId;
});
}
}
class Image {
getInitalState() {
return this.props.data;
},
getDefaultProps() {
return {}
},
render() {
return (
<div className={cls("d-item", {
flagged: this.state.flagged
})}>
<button onClick={this.onClick}>bla</button>
</div>
);
},
onClick() {
var id = this.state.id;
},
onFlag() {
this.setState({
flagged: true
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment