Skip to content

Instantly share code, notes, and snippets.

@NateRadebaugh
Last active February 27, 2020 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NateRadebaugh/9ae05d88161060154018f4fecba8c83e to your computer and use it in GitHub Desktop.
Save NateRadebaugh/9ae05d88161060154018f4fecba8c83e to your computer and use it in GitHub Desktop.
My Awesome Sketch
My Awesome Sketch
Inactive
focus -> Active
click -> Active
Active
cancel -> Inactive
blur -> Inactive
DateView
select -> Inactive
toMonth -> MonthView
toTime -> TimeView
TimeView
toDate -> DateView
MonthView
select -> DateView
toDate -> DateView
toYear -> YearView
YearView
select -> MonthView
toMonth -> MonthView
function render(model){
const current_state_name = model.active_states[0].name;
const views = {
Inactive: <input onClick={() => model.emit("click") } />,
DateView: <div><input /><br />dates <button type="button" onClick={() => model.emit("toTime") }>Time</button> <button type="button" onClick=>Months</button></div>,
TimeView: <div><input /><br />times</div>,
MonthView: <div><input /><br />months</div>,
YearView: <div><input /><br />years</div>
};
return <div>
({current_state_name})
<div>
{views[current_state_name] || null}
</div>
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment