Last active
August 29, 2015 14:24
-
-
Save No9/71d832cb43b70f8c2daa to your computer and use it in GitHub Desktop.
A tongue in cheek implementation of hyperscript to illustrating a 'pure ui' approach
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
// Based on http://rauchg.com/2015/pure-ui/ | |
var h = require('hyperscript') | |
function dashboard(opts){ | |
// with proper access to the layout data | |
// data CSS media queries can be redundant | |
if (opts.width > 375) { | |
return h('div', 'Twitter followers ' + opts.num) | |
} else { | |
return h('div', 'Twitter followers ' + (opts.num / 1000) + 'K') | |
} | |
} | |
console.log(dashboard({ width: 375, num: 400000 }).outerHTML) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment