Skip to content

Instantly share code, notes, and snippets.

@tttimur
Created August 22, 2017 00:12
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 tttimur/7e687228660cc8dd709f2a99a4475ba5 to your computer and use it in GitHub Desktop.
Save tttimur/7e687228660cc8dd709f2a99a4475ba5 to your computer and use it in GitHub Desktop.
nano comp test
var Nanocomponent = require('nanocomponent')
var html = require('choo/html')
class FeaturedPost extends Nanocomponent {
constructor () {
super()
this.post = null
this.emit = null
}
createElement (post, emit) {
return html`
<div id="featured" class="x xw xjc xac bgsc bgpc bgrn xac py4 vw100">
<div id='featured-sub' class="x xw pl4 pr4 mw1000">
</div>
</div>
`
}
update (newpost, emit) {
if (newpost !== this.post) {
this.post = newpost
this.emit = emit
var featured = document.getElementById('featured-sub')
featured.append(featuredImg(this.post.featured))
featured.append(featuredText(this.post.featured, this.emit))
}
return false
}
}
module.exports = FeaturedPost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment