Last active
May 23, 2019 15:20
-
-
Save glebsexy/d8e4a0f5082a54d39a8685bc9f5c07e0 to your computer and use it in GitHub Desktop.
Green*
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
Green* | |
tick -> Yellow | |
Yellow | |
tick -> Red | |
Red | |
tick -> Green |
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
function light(color, is_illuminated){ | |
var attrs = {width: '20px', height: '20px', 'margin-left': '20px'}; | |
if(is_illuminated){ | |
attrs.backgroundColor = color; | |
} else { | |
attrs.backgroundColor = 'black'; | |
} | |
return $('div', {style: attrs}); | |
} | |
function render(model){ | |
var active_light = model.active_states[0].name; | |
return $('div', | |
light('Red', active_light === 'Red'), | |
light('Yellow', active_light === 'Yellow'), | |
light('Green', active_light === 'Green')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment