Last active
June 20, 2018 21:43
-
-
Save tnightingale/fcb919e32a474bf38eb7de2a6a940fb2 to your computer and use it in GitHub Desktop.
Task states
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
Task states | |
Not in my list | |
addToList -> In my list | |
In my list | |
markDone -> Done | |
removeFromList -> Not in my list | |
Done | |
markNotDone -> In my list |
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){ | |
let current_state_name = model.active_states[0].name; | |
let buttonText; | |
switch(current_state_name) { | |
case 'Not in my list': | |
return <> | |
<button onClick={() => model.emit('addToList')}>Add to list</button> | |
</>; | |
case 'In my list': | |
return <> | |
<button onClick={() => model.emit('markDone')}>Mark done</button> | |
<button onClick={() => model.emit('removeFromList')}>Remove from my list</button> | |
</>; | |
case 'Done': | |
return <> | |
<button onClick={() => model.emit('markNotDone')}>Mark as not done</button> | |
</> | |
} | |
return <button style={{color: "darkBlue"}}>{current_state_name}</button> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment