made with esnextbin
Created
September 15, 2016 19:12
-
-
Save philholden/2965bb767365fd8466072b040692de3d to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNext Bin Sketch</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
</body> | |
</html> |
This file contains hidden or 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 {StyleSheet, css} from 'aphrodite' | |
const app = document.getElementById('app') | |
const randomColor = () => '#xxxxxx'.replace( | |
/x/g, | |
() => (Math.random() * 16 | 0).toString(16) | |
) | |
setInterval(() => { | |
const styles = StyleSheet.create({ | |
random: { | |
backgroundColor: randomColor(), | |
color: randomColor(), | |
} | |
}) | |
app.innerHTML = ` | |
<div class="${css(styles.random)}"> | |
This is red. | |
</div> | |
` | |
}, 500) |
This file contains hidden or 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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"aphrodite": "0.3.3" | |
} | |
} |
This file contains hidden or 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
'use strict'; | |
var _aphrodite = require('aphrodite'); | |
var app = document.getElementById('app'); | |
var randomColor = function randomColor() { | |
return '#xxxxxx'.replace(/x/g, function () { | |
return (Math.random() * 16 | 0).toString(16); | |
}); | |
}; | |
setInterval(function () { | |
var styles = _aphrodite.StyleSheet.create({ | |
random: { | |
backgroundColor: randomColor(), | |
color: randomColor() | |
} | |
}); | |
app.innerHTML = '\n <div class="' + (0, _aphrodite.css)(styles.random) + '">\n This is red.\n </div>\n '; | |
}, 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment