dao-game / react-multiplayer / files / src / react / Controls.tsx
Branch react-multiplayer · default branch · all branches
Controls.tsx
417dc266 2022-03-23 Pavel Safronov | 1 | import * as React from 'react'; |
| 2 | import './Controls.css'; | |
| 3 | ||
| 4 | export type Props = { | |
| 5 | isDisabled: boolean | |
| 6 | onUndo: () => void | |
| 7 | }; | |
| 8 | ||
| 9 | const reload = () => location.reload(); | |
| 10 | ||
| 11 | export const Controls = (props: Props): React.ReactElement => { | |
| 12 | const { isDisabled, onUndo } = props; | |
| 13 | return <div className='container'> | |
| 14 | <div className='controls'> | |
| 15 | <button | |
| 16 | disabled={isDisabled} | |
| 17 | type='button' | |
| 18 | onClick={onUndo} | |
| 19 | className='undo-button'>Undo</button> | |
| 20 | <button | |
| 21 | disabled={isDisabled} | |
| 22 | type='button' | |
| 23 | onClick={reload} | |
| 24 | className='reset-button'>Reset</button> | |
| 25 | </div> | |
| 26 | </div>; | |
| 27 | } |