Skip to content

Instantly share code, notes, and snippets.

@swissmanu
Last active February 28, 2019 10:40
Show Gist options
  • Save swissmanu/e5b62a15602606082ea7ab9a501373de to your computer and use it in GitHub Desktop.
Save swissmanu/e5b62a15602606082ea7ab9a501373de to your computer and use it in GitHub Desktop.
Button
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
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