Last active
September 12, 2018 13:05
-
-
Save jgaskins/b386c127062697c4b62e75c60939380c to your computer and use it in GitHub Desktop.
Time travel component for Clearwater+GrandCentral
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
class TimeTravel | |
include Clearwater::Component | |
# @param store [GrandCentral::VersionedStore] | |
def initialize(store) | |
@store = store | |
end | |
def render | |
div([ | |
button({ onclick: proc { store.rollback } }, '<'), | |
input( | |
type: :range, | |
oninput: proc { |e| | |
store.go_to_version e.target.value.to_i | |
}, | |
), | |
button({ onclick: proc { store.redo } }, '<'), | |
" #{store.current_version} / #{store.total_versions}", | |
]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment