Created
August 22, 2017 00:12
-
-
Save tttimur/7e687228660cc8dd709f2a99a4475ba5 to your computer and use it in GitHub Desktop.
nano comp test
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
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