Skip to content

Instantly share code, notes, and snippets.

@goldensunliu
Last active March 5, 2018 20:10
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 goldensunliu/f7491edda4502034aedbaca401d4d541 to your computer and use it in GitHub Desktop.
Save goldensunliu/f7491edda4502034aedbaca401d4d541 to your computer and use it in GitHub Desktop.
class Game extends Compoent {
...
renderActions() {
const { history } = this.state;
const selectedCell = this.getSelectedCell();
const prefilled = selectedCell && selectedCell.get('prefilled');
return (
<div className="actions">
<div className="action" onClick={history.size ? this.undo : null}>
<ReloadIcon />Undo
</div>
<div className="action redo" onClick={history.size ? this.redo : null}>
<ReloadIcon />Redo
</div>
<div className="action" onClick={!prefilled ? this.eraseSelected : null}>
<RemoveIcon />Erase
</div>
<div
className="action"
onClick={!prefilled ?
this.fillSelectedWithSolution : null}
>
<LoupeIcon />Hint
</div>
<style jsx>{ActionsStyle}</style>
</div>
);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment