Last active
February 28, 2019 10:40
-
-
Save swissmanu/e5b62a15602606082ea7ab9a501373de to your computer and use it in GitHub Desktop.
Button
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
Button | |
Disabled | |
enable -> Enabled | |
Enabled* | |
disable -> Disabled | |
Inactive | |
focus -> Active | |
mouseEnter -> Hovered | |
Active | |
blur -> Inactive | |
mouseEnter -> ActiveHovered | |
pressEnter -> Active | |
Hovered | |
mouseLeave -> Inactive | |
focus -> ActiveHovered | |
click -> Hovered | |
ActiveHovered | |
mouseLeave -> Active | |
blur -> Hovered | |
click -> ActiveHovered | |
pressEnter -> ActiveHovered |
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 render(model){ | |
const enabled = model.active_states[0].name !== 'Disabled' | |
return button('Button', enabled, false, false); | |
} | |
function button(text, enabled, active, hovered) { | |
return $('div', { | |
style: { | |
display: 'inline-block', | |
padding: '5px 8px', | |
'background-color': enabled ? 'green' : 'red' | |
} | |
}, text); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment