Last active
February 1, 2016 23:46
-
-
Save milworm/cf740e0b3627fed377c6 to your computer and use it in GitHub Desktop.
This file contains 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
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