Created
November 3, 2016 16:39
-
-
Save thosakwe/f3dbc3da1352e2824e1b1ffd1323c121 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
@component() | |
export default class Layout { | |
render() { | |
return div { | |
this.title(), | |
this.content() | |
}; | |
} | |
} |
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 Layout from './layout'; | |
function userItem(name, avatar) { | |
return .item { | |
img.avatar[src=avatar] | |
a.info name | |
}; | |
} | |
@component() | |
export default class UserList extends Layout { | |
constructor(users) { | |
this.users = users; | |
} | |
title() { | |
return title `Users (${this.users.length})`; | |
} | |
content() { | |
return .menu { | |
this.users.map(user => { | |
return userItem(user.name, user.avatar); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment