Skip to content

Commit

Permalink
lib: add badge component
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlucas committed Mar 22, 2016
1 parent c70ce6f commit dcd7f70
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/views/components/badge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'

const h = require('virtual-dom/h')

module.exports = function badge(count) {
return h('.badge', '' + count)
}
3 changes: 2 additions & 1 deletion lib/views/sidebar/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const h = require('virtual-dom/h')
const inherits = require('util').inherits
const Base = require('vdelement')
const badge = require('../components/badge')

module.exports = Channels

Expand Down Expand Up @@ -61,7 +62,7 @@ Channels.prototype.render = function render(chans) {
]

if (chan.unread) {
kids.push(h('.badge', '' + chan.unread))
kids.push(badge(chan.unread))
}

let classNames = []
Expand Down

0 comments on commit dcd7f70

Please sign in to comment.